perf(deploy): faster builds and zero-downtime streamer rollover

- Multi-stage Dockerfile with BuildKit npm cache mounts and a separate
  prod-deps stage so source edits don't reinstall or prune.
- Tighter .dockerignore to shrink build context.
- Healthchecks: add start_period and tighten interval/retries so
  containers report healthy as soon as the process is actually ready
  instead of after a full polling interval.
- Move recoverStuckPreparing() off the startup critical path; the
  recovery sweep now runs in the background after app.listen.
- depends_on uses condition: service_healthy and the obsolete
  compose 'version' key is gone.
- New scripts/build.sh + scripts/deploy.sh: deploy.sh builds, exits
  early if the image is unchanged, runs a blue/green streamer swap
  (scale to 2N, wait healthy in parallel, drop olds), then recreates
  the API with --no-deps to avoid compose's depends_on re-poll.
This commit is contained in:
tdurieux
2026-05-06 13:38:19 +03:00
parent 371693dc3b
commit 06a098fba7
6 changed files with 165 additions and 27 deletions
+3 -1
View File
@@ -255,9 +255,11 @@ export default async function start() {
repositoryStatusCheck();
await connect();
await recoverStuckPreparing();
app.listen(config.PORT);
logger.info("server started", { port: config.PORT });
recoverStuckPreparing().catch((err) =>
logger.error("recoverStuckPreparing failed", { err })
);
}
start();