-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
docker/cron-docker/periodic/daily/restart_slow_worker_cron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
cd /opt/Internet.nl | ||
|
||
SERVICE=worker-slow | ||
REPLICAS=$WORKER_SLOW_REPLICAS | ||
COMPOSE_CMD="docker compose --env-file=docker/defaults.env --env-file=docker/host.env --env-file=docker/local.env" | ||
|
||
OLD_CONTAINERS=$($COMPOSE_CMD ps --format "{{ .Name }}"|grep "$SERVICE") | ||
|
||
# bring up new containers, wait until healthy | ||
$COMPOSE_CMD up --no-deps --wait --scale=$(($REPLICAS*2)) up "$SERVICE" | ||
|
||
# graceful shutdown and remove old containers | ||
docker rm --force "$OLD_CONTAINERS" | ||
|
||
# restore replica number to original | ||
$COMPOSE_CMD scale $SERVICE=$REPLICAS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters