forked from mtusi2026/mtusi2026lab2
After make up, which builds with --build, a plain up in the restart hook saw a different service hash and recreated migrate and the API replicas instead of starting the stopped ones, so the replicas came back with new hostnames. The hook now passes --no-recreate: lb and the replicas are the same containers restarted, migrate reruns in its old container, and only volumes and data carry state across the restart. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
13 lines
468 B
Bash
Executable File
13 lines
468 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
defined=$(docker compose config --services)
|
|
stores=""
|
|
for service in ${STATE_SERVICES:-postgres valkey}; do
|
|
if printf '%s\n' "$defined" | grep -qx "$service"; then stores="$stores $service"; fi
|
|
done
|
|
[ -n "$stores" ] || { echo "no state services found" >&2; exit 3; }
|
|
docker compose stop lb "${API_SERVICE:-api}"
|
|
docker compose restart $stores
|
|
docker compose up -d --no-recreate --wait --wait-timeout "${WAIT_TIMEOUT:-75}"
|