forked from mtusi2026/mtusi2026lab4
Add two API replicas, safe object reconciliation, upload validation, regression tests and documented load experiments.
24 lines
895 B
Bash
24 lines
895 B
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
project_dir=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
cd "$project_dir"
|
|
|
|
for service in api nginx reconciler postgres redis s3; do
|
|
if [ -z "$(docker compose ps --all --quiet "$service")" ]; then
|
|
printf '%s\n' "Missing container for $service; start the Compose stack first." >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
replicas=$(docker compose ps --all --quiet api | wc -l | tr -d ' ')
|
|
if [ "$replicas" -lt 1 ]; then
|
|
printf 'No API replicas found.\n' >&2
|
|
exit 1
|
|
fi
|
|
|
|
docker compose stop --timeout 30 nginx reconciler api postgres redis s3
|
|
docker compose up --detach --no-recreate --no-build --no-deps --wait --wait-timeout 45 postgres redis s3
|
|
docker compose up --detach --no-recreate --no-build --no-deps --scale "api=$replicas" --wait --wait-timeout 45 api
|
|
docker compose up --detach --no-recreate --no-build --no-deps --wait --wait-timeout 30 nginx reconciler
|