import { pino } from 'pino'; import { backupIdTime } from './backup-set.js'; import { loadBackupEnv } from './config.js'; import { performRestore } from './perform-restore.js'; /** * In-container half of the restore runbook (operations.md §Backup & restore): * the host-side `restore.sh` wraps this with stopping/starting the app * services — run through that, not directly, unless you know the api and * collab are down. The actual restore lives in perform-restore.ts, shared * with the in-app restore orchestrator (issue #103). */ const env = loadBackupEnv(); const log = pino({ level: env.LOG_LEVEL, base: { service: 'backup-restore' } }); const backupId = process.argv[2]; if (!backupId || !backupIdTime(backupId)) { log.error({ backupId }, 'usage: node dist/restore.js (e.g. 20260711-030000)'); process.exit(2); } try { await performRestore(env, backupId, log); } catch (error) { log.error({ backupId, error: String(error) }, 'restore failed'); process.exit(1); } log.info({ backupId }, 'restore complete — start the stack and verify /readyz');