fix: preserve migrated storage guards during deployment
This commit is contained in:
@@ -6,6 +6,25 @@ const bootstrap = readFileSync(resolve(import.meta.dirname, 'production-bootstra
|
||||
const apiMain = readFileSync(resolve(import.meta.dirname, '../../api/src/main.ts'), 'utf8');
|
||||
const apiTimeouts = readFileSync(resolve(import.meta.dirname, '../../api/src/http-server-timeouts.ts'), 'utf8');
|
||||
const workerMain = readFileSync(resolve(import.meta.dirname, '../../api/src/send-worker.ts'), 'utf8');
|
||||
const storageCheck = readFileSync(resolve(import.meta.dirname, 'check-data-storage.sh'), 'utf8');
|
||||
for (const [name, script] of [['deploy', deploy], ['bootstrap', bootstrap]]) {
|
||||
const guard = script.indexOf('/usr/local/sbin/cmpp-data-storage-check all');
|
||||
const initialization = script.indexOf('APP_DIR=');
|
||||
if (guard < 0 || initialization < 0 || guard > initialization) {
|
||||
throw new Error(`${name} must verify migrated storage before initialization or release writes`);
|
||||
}
|
||||
for (const marker of ['data-disk.uuid', '50-cmpp-data-disk.conf', '[[ ! -x /usr/local/sbin/cmpp-data-storage-check ]]', 'refusing to continue.']) {
|
||||
if (!script.includes(marker)) throw new Error(`${name} is missing the data-disk fail-closed guard: ${marker}`);
|
||||
}
|
||||
}
|
||||
for (const marker of [
|
||||
'mountpoint -q /data', 'findmnt -rn -M /data -o UUID', '/data/.cmpp-data-disk.uuid',
|
||||
'mountpoint -q "$target"', 'findmnt -rn -M "$target" -o UUID', "stat -Lc '%d:%i'",
|
||||
'findmnt -rn -M "$target" -o OPTIONS', '/data/postgresql', '/data/redis', '/data/minio',
|
||||
'PG_VERSION', 'dump.rdb', '.minio.sys/format.json',
|
||||
]) {
|
||||
if (!storageCheck.includes(marker)) throw new Error(`data storage guard is missing: ${marker}`);
|
||||
}
|
||||
const required = [
|
||||
'compression_config=/etc/nginx/conf.d/cmpp-compression.conf',
|
||||
': >"$compression_config"',
|
||||
@@ -65,4 +84,4 @@ if (gatewayRestart < 0 || apiRestart < gatewayRestart || workerRestart < apiRest
|
||||
throw new Error('production deploy must restart Gateway before API and the send worker so API startup restores active channels');
|
||||
}
|
||||
|
||||
console.log('Production deployment verified: Nginx/API guards and the split durable send worker contract are present.');
|
||||
console.log('Production deployment verified: migrated storage fail-closed guards, Nginx/API guards and the split durable send worker contract are present.');
|
||||
|
||||
Reference in New Issue
Block a user