Skip to content

Commit a2ecdb4

Browse files
committed
Add a delay between restarts of individual workers, only restart
containers for own instance
1 parent 6c0d51c commit a2ecdb4

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

docker/compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ services:
656656
- CRON_DAILY_DATABASE_CLEANUP
657657
- CRON_WORKER_RESTART
658658
- INTERNETNL_INSTALL_BASE
659+
- COMPOSE_PROJECT='{{index .Container.Labels "com.docker.compose.project"}}'
659660
restart: unless-stopped
660661
logging:
661662
driver: $LOGGING_DRIVER

docker/cron-docker/periodic/15min/restart_nassl_worker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ if [ ! "$CRON_WORKER_RESTART" = "True" ];then
66
fi
77

88
# find nassl worker and restart the container(s)
9-
docker ps --filter label=com.docker.compose.service=worker-nassl --quiet | xargs --no-run-if-empty docker restart
9+
docker ps --filter label=com.docker.compose.service=worker-nassl --filter label=com.docker.compose.project="$COMPOSE_PROJECT" --quiet | xargs -n1 --no-run-if-empty -I% sh -c 'docker restart %; sleep 30'

docker/cron-docker/periodic/hourly/restart_worker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ if [ ! "$CRON_WORKER_RESTART" = "True" ];then
66
fi
77

88
# find worker and restart the container(s)
9-
docker ps --filter label=com.docker.compose.service=worker --quiet | xargs --no-run-if-empty docker restart
9+
docker ps --filter label=com.docker.compose.service=worker --filter label=com.docker.compose.project="$COMPOSE_PROJECT" --quiet | xargs -n1 --no-run-if-empty -I% sh -c 'docker restart %; sleep 30'

0 commit comments

Comments
 (0)