Skip to content

Commit

Permalink
Merge pull request #278 from kobotoolbox/276-pass-signals-to-database…
Browse files Browse the repository at this point in the history
…-servers

Pass signals and give grace period to database servers
  • Loading branch information
jnm authored Apr 30, 2020
2 parents fb661e8 + 36b79ef commit b159e71
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docker-compose.backend.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
- ./postgres:/kobo-docker-scripts
command: "/bin/bash /kobo-docker-scripts/entrypoint.sh"
restart: on-failure
stop_grace_period: 5m
# Ports should be declared in `docker-compose.backend.master.override.yml` and docker-compose.backend.slave.override.yml`
#ports:
# - 5432:5432
Expand All @@ -36,6 +37,7 @@ services:
- ./log/mongo:/srv/logs
restart: on-failure
command: "/bin/bash /kobo-docker-scripts/entrypoint.sh"
stop_grace_period: 5m
# Ports should be declared in `docker-compose.backend.master.override.yml` and docker-compose.backend.slave.override.yml`
#ports:
# - 27017:27017
Expand All @@ -56,6 +58,7 @@ services:
- ./redis/entrypoint.sh:/tmp/redis/entrypoint.sh:ro
- ./log/redis_main:/var/log/redis
restart: on-failure
stop_grace_period: 2m30s
# Ports should be declared in `docker-compose.backend.master.override.yml` and docker-compose.backend.slave.override.yml`
#ports:
# - 6379:6379
Expand All @@ -73,6 +76,7 @@ services:
- ./redis/entrypoint.sh:/tmp/redis/entrypoint.sh:ro
- ./log/redis_cache:/var/log/redis
restart: on-failure
stop_grace_period: 2m30s
# Ports should be declared in `docker-compose.backend.master.override.yml` and docker-compose.backend.slave.override.yml`
#ports:
# - 6380:6380
Expand Down
4 changes: 3 additions & 1 deletion mongo/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ echo "Copying init scripts ..."
cp $KOBO_DOCKER_SCRIPTS_DIR/init_* /docker-entrypoint-initdb.d/

echo "Launching official entrypoint..."
$BASH_PATH /entrypoint.sh mongod
# `exec` here is important to pass signals to the database server process;
# without `exec`, the server will be terminated abruptly with SIGKILL (see #276)
exec $BASH_PATH /entrypoint.sh mongod
4 changes: 3 additions & 1 deletion postgres/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ BASH_PATH=$(which bash)
$BASH_PATH $KOBO_DOCKER_SCRIPTS_DIR/toggle-backup-activation.sh

echo "Launching official entrypoint..."
/bin/bash /docker-entrypoint.sh postgres
# `exec` here is important to pass signals to the database server process;
# without `exec`, the server will be terminated abruptly with SIGKILL (see #276)
exec /bin/bash /docker-entrypoint.sh postgres
5 changes: 4 additions & 1 deletion redis/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ if [ "${KOBO_REDIS_SERVER_ROLE}" == "main" ]; then
$BASH_PATH $KOBO_DOCKER_SCRIPTS_DIR/toggle-backup-activation.sh
fi

su redis -c "redis-server /etc/redis/redis.conf"
# `exec` and `gosu` (vs. `su`) here are important to pass signals to the
# database server process; without them, the server will be terminated abruptly
# with SIGKILL (see #276)
exec gosu redis redis-server /etc/redis/redis.conf

0 comments on commit b159e71

Please sign in to comment.