diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 65c4bb4..7d80902 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -58,6 +58,10 @@ services: volumes: # Project directory - allows git pull and rebuild - .:/app/deploy + # SSH Keys for git authentication + - ~/.ssh/id_rsa:/home/bun/.ssh/id_rsa:ro + - ~/.ssh/id_ed25519:/home/bun/.ssh/id_ed25519:ro + - ~/.ssh/known_hosts:/home/bun/.ssh/known_hosts:ro working_dir: /app environment: - NODE_ENV=production diff --git a/shared/modules/admin/update.service.ts b/shared/modules/admin/update.service.ts index 88c5bb3..278efd4 100644 --- a/shared/modules/admin/update.service.ts +++ b/shared/modules/admin/update.service.ts @@ -24,7 +24,10 @@ async function execWithTimeout( options: { cwd?: string } = {} ): Promise<{ stdout: string; stderr: string }> { return new Promise((resolve, reject) => { - const process = exec(cmd, { cwd: options.cwd }, (error: ExecException | null, stdout: string, stderr: string) => { + const child = exec(cmd, { + cwd: options.cwd, + env: { ...process.env, GIT_TERMINAL_PROMPT: "0" } + }, (error: ExecException | null, stdout: string, stderr: string) => { if (error) { reject(error); } else { @@ -33,11 +36,11 @@ async function execWithTimeout( }); const timer = setTimeout(() => { - process.kill("SIGTERM"); + child.kill("SIGTERM"); reject(new Error(`Command timed out after ${timeoutMs}ms: ${cmd}`)); }, timeoutMs); - process.on("exit", () => clearTimeout(timer)); + child.on("exit", () => clearTimeout(timer)); }); } @@ -572,6 +575,7 @@ export class UpdateService { deployProcess.unref(); output += `🚀 Deploy triggered - container will restart\n`; + console.log("Deploy triggered successfully:", output); return { success: true,