From a499eeb00f12ebe18330dfed8599509846faa917 Mon Sep 17 00:00:00 2001 From: meliurwen Date: Fri, 21 Aug 2020 00:57:22 +0200 Subject: [PATCH] Added stop_grace_period --- .env.example | 9 ++++++--- docker-compose.yml | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 8987722..933f603 100644 --- a/.env.example +++ b/.env.example @@ -17,11 +17,14 @@ GT_TAG= GT_CONTAINER_NAME= # Database -# If using PostgreSQL is better to use SIGINT to power off the container which -# enables the "Fast Shutdown" mode. +# If using PostgreSQL is better to use SIGTERM to power off the container which +# enables the "Smart Shutdown", after the grace period it gets SIGKILL which +# can lead to corruption of backups, but is still better than using SIGINT. # https://www.postgresql.org/docs/10/server-shutdown.html # https://github.com/docker-library/postgres/issues/184#issuecomment-394822161 +# https://github.com/docker-library/postgres/issues/714#issuecomment-631306363 DB_IMG= DB_TAG= DB_CONTAINER_NAME= -DB_STOP_SIG=SIGINT +DB_STOP_SIG= +DB_STOP_GRC=30s diff --git a/docker-compose.yml b/docker-compose.yml index e596937..3c66498 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,6 +32,7 @@ services: container_name: ${DB_CONTAINER_NAME:-gitea-db} restart: unless-stopped stop_signal: ${DB_STOP_SIG:-SIGTERM} + stop_grace_period: ${DB_STOP_GRC:-10s} environment: - POSTGRES_USER=${DB_USER} - POSTGRES_PASSWORD=${DB_PASSWD}