fix: preserve Gateway release runtime context
This commit is contained in:
@@ -33,6 +33,9 @@ export const resolveReleaseControllerConfig = (env: NodeJS.ProcessEnv = process.
|
||||
if (!rawGatewayDatabaseUrl) {
|
||||
throw new Error('GATEWAY_DATABASE_URL or DATABASE_URL is required.');
|
||||
}
|
||||
if (!env.REDIS_URL?.trim()) {
|
||||
throw new Error('REDIS_URL is required.');
|
||||
}
|
||||
const workspaceRoot = path.resolve(env.RELEASE_CONTROLLER_WORKSPACE_ROOT ?? process.cwd());
|
||||
const gatewayDbSchema = env.GATEWAY_DB_SCHEMA?.trim() || 'public';
|
||||
return {
|
||||
@@ -51,6 +54,9 @@ export const resolveReleaseControllerConfig = (env: NodeJS.ProcessEnv = process.
|
||||
60000,
|
||||
'RELEASE_CONTROLLER_READINESS_TIMEOUT_MS'
|
||||
),
|
||||
baseEnv: sanitizeManagedProcessEnv(env),
|
||||
baseEnv: {
|
||||
...sanitizeManagedProcessEnv(env),
|
||||
REDIS_URL: env.REDIS_URL.trim(),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -59,12 +59,17 @@ export const buildGatewayProcessDefinitions = (
|
||||
workspaceRoot: string,
|
||||
config: ReleaseControllerConfig
|
||||
): ProcessDefinition[] => {
|
||||
const redisUrl = config.baseEnv.REDIS_URL?.trim();
|
||||
if (!redisUrl) {
|
||||
throw new Error('REDIS_URL is required to start Gateway processes.');
|
||||
}
|
||||
const apiCwd = path.join(workspaceRoot, 'app', 'gateway-api');
|
||||
const frontendCwd = path.join(workspaceRoot, 'app', 'gateway-frontend');
|
||||
const apiScript = path.join(apiCwd, 'dist', 'index.js');
|
||||
const frontendScript = path.join(frontendCwd, 'node_modules', 'vite', 'bin', 'vite.js');
|
||||
const env = {
|
||||
...sanitizeManagedProcessEnv(config.baseEnv),
|
||||
REDIS_URL: redisUrl,
|
||||
GATEWAY_API_HOST: '0.0.0.0',
|
||||
GATEWAY_API_PORT: String(config.gatewayApiPort),
|
||||
GATEWAY_DATABASE_URL: config.gatewayDatabaseUrl,
|
||||
@@ -232,7 +237,9 @@ export class GatewayReleaseController {
|
||||
try {
|
||||
const [api, frontend] = await Promise.all([this.fetchImpl(apiUrl), this.fetchImpl(frontendUrl)]);
|
||||
const processes = await this.processManager.list();
|
||||
const expected = processes.filter((process) => PROCESS_NAMES.includes(process.name as (typeof PROCESS_NAMES)[number]));
|
||||
const expected = processes.filter((process) =>
|
||||
PROCESS_NAMES.includes(process.name as (typeof PROCESS_NAMES)[number])
|
||||
);
|
||||
const safe = expected.filter(
|
||||
(process) => process.status.toLowerCase() === 'online' && (process.restartCount ?? 0) === 0
|
||||
);
|
||||
|
||||
@@ -46,7 +46,7 @@ export const buildReleaseControllerDefinition = (
|
||||
...sanitizeManagedProcessEnv(config.baseEnv),
|
||||
GATEWAY_DATABASE_URL: config.gatewayDatabaseUrl,
|
||||
GATEWAY_DB_SCHEMA: config.gatewayDbSchema,
|
||||
RELEASE_CONTROLLER_WORKSPACE_ROOT: workspaceRoot,
|
||||
RELEASE_CONTROLLER_WORKSPACE_ROOT: config.workspaceRoot,
|
||||
RELEASE_CONTROLLER_WORKTREE_ROOT: config.worktreeRoot,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user