29 lines
935 B
Bash
Executable File
29 lines
935 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
docker compose --env-file .env restart postgres rabbitmq s3-core s3
|
|
|
|
for service in postgres rabbitmq s3-core s3; do
|
|
ready=0
|
|
attempt=0
|
|
while [ "$attempt" -lt 90 ]; do
|
|
ready=1
|
|
containers=$(docker compose --env-file .env ps -q "$service")
|
|
[ -n "$containers" ] || ready=0
|
|
for container in $containers; do
|
|
status=$(docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{else}}running{{end}}' "$container")
|
|
[ "$status" = healthy ] || ready=0
|
|
done
|
|
[ "$ready" -eq 1 ] && break
|
|
attempt=$((attempt + 1))
|
|
sleep 1
|
|
done
|
|
[ "$ready" -eq 1 ] || {
|
|
printf 'Service %s did not become healthy after restart.\n' "$service" >&2
|
|
exit 1
|
|
}
|
|
done
|
|
|
|
docker compose --env-file .env restart api publisher worker reconciler
|
|
printf '%s\n' 'Restarted API and application stores without changing volumes.'
|