Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:22-alpine AS base

ARG VERSION_ARG
RUN apk add --no-cache openssl
RUN apk add --no-cache openssl openssh-keygen

FROM base AS deps

# Install necessary packages for building
RUN apk add --no-cache libc6-compat python3 make g++
RUN apk add --no-cache libc6-compat python3 make g++

WORKDIR /app

Expand Down Expand Up @@ -36,7 +36,7 @@ ENV PYTHON=/usr/bin/python3
ENV QS_VERSION=$VERSION_ARG
ENV DATABASE_URL="file:/app/storage/db/data.db"

RUN apk add --no-cache git
RUN apk add --no-cache git openssh-client

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
Expand Down
11 changes: 11 additions & 0 deletions prisma/migrations/20260426090000_add_app_git_ssh_key/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE "AppGitSshKey" (
"id" TEXT NOT NULL PRIMARY KEY,
"appId" TEXT NOT NULL,
"publicKey" TEXT NOT NULL,
"encryptedPrivateKey" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "AppGitSshKey_appId_fkey" FOREIGN KEY ("appId") REFERENCES "App" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE UNIQUE INDEX "AppGitSshKey_appId_key" ON "AppGitSshKey"("appId");
14 changes: 13 additions & 1 deletion prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ model App {
appType String @default("APP") // APP, POSTGRES, MYSQL, MONGO
projectId String
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
sourceType String @default("GIT") // GIT, CONTAINER
sourceType String @default("GIT") // GIT, GIT_SSH, CONTAINER
buildMethod String @default("RAILPACK") // RAILPACK, DOCKERFILE

containerImageSource String?
Expand Down Expand Up @@ -227,12 +227,24 @@ model App {
appVolumes AppVolume[]
appFileMounts AppFileMount[]
appBasicAuths AppBasicAuth[]
appGitSshKey AppGitSshKey?
roleAppPermissions RoleAppPermission[]

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model AppGitSshKey {
id String @id @default(uuid())
appId String @unique
app App @relation(fields: [appId], references: [id], onDelete: Cascade)
publicKey String
encryptedPrivateKey String

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model AppPort {
id String @id @default(uuid())
appId String
Expand Down
51 changes: 51 additions & 0 deletions src/__tests__/git-test-repositories.utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { AppExtendedModel } from "@/shared/model/app-extended.model";

export const GitTestRepositories = {
publicHttpsUrl: 'https://github.com/biersoeckli/dummy-node-app.git',
publicSshUrl: 'git@github.com:biersoeckli/dummy-node-app.git',
privateSshUrl: 'git@github.com:biersoeckli/dummy-node-app-private.git',
branch: 'main',
} as const;

export const GitTestEnvironment = {
privateSshKey: 'INTEGRATION_TEST_GIT_PRIVATE_SSH_KEY'
} as const;

export function getPrivateGitSshKeyFromEnv() {
return process.env[GitTestEnvironment.privateSshKey]?.replace(/\\n/g, '\n').trim();
}

export function createGitApp(input: Pick<AppExtendedModel, 'id' | 'sourceType' | 'gitUrl'>): AppExtendedModel {
return {
id: input.id,
name: input.id,
appType: 'APP',
projectId: 'proj-git-service-integration',
sourceType: input.sourceType,
buildMethod: 'RAILPACK',
gitUrl: input.gitUrl,
gitBranch: GitTestRepositories.branch,
dockerfilePath: './Dockerfile',
replicas: 1,
envVars: '',
ingressNetworkPolicy: 'ALLOW_ALL',
egressNetworkPolicy: 'ALLOW_ALL',
useNetworkPolicy: true,
healthCheckPeriodSeconds: 15,
healthCheckTimeoutSeconds: 5,
healthCheckFailureThreshold: 3,
createdAt: new Date(),
updatedAt: new Date(),
project: {
id: 'proj-git-service-integration',
name: 'Git Service Integration',
createdAt: new Date(),
updatedAt: new Date(),
},
appDomains: [],
appPorts: [],
appFileMounts: [],
appVolumes: [],
appBasicAuths: [],
} as AppExtendedModel;
}
Loading
Loading