From 0f498115337b40cc441fadb7735b89ec91d5c8a6 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 3 Oct 2026 22:07:41 +0200 Subject: [PATCH] Graceful shutdown of the server --- apps/api/src/main.ts | 5 +++++ docker/docker-compose.yml | 3 +++ 2 files changed, 8 insertions(+) diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index 8b17cbca50..4fa764632e 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -65,6 +65,11 @@ async function bootstrap() { }); app.enableCors(); + + // Let the open requests and the active queue jobs finish on SIGTERM before + // the process stops + app.enableShutdownHooks(); + app.enableVersioning({ defaultVersion: '1', type: VersioningType.URI diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 8c69e5420e..091cbd04d6 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -5,6 +5,9 @@ services: container_name: ghostfolio restart: unless-stopped init: true + # Time for the open requests and the active queue jobs to finish before + # the container is killed + stop_grace_period: 1m cap_drop: - ALL security_opt: