23 lines
718 B
Bash
23 lines
718 B
Bash
#!/bin/sh
|
|
# Restart API and every state store without deleting volumes.
|
|
#
|
|
# Used by make test-persistence. Sessions live in Valkey with AOF and users,
|
|
# chats and messages in PostgreSQL, so the same bearer token and data survive.
|
|
set -eu
|
|
stack=${STACK_NAME:-lab3}
|
|
for service in "${stack}_postgres" "${stack}_valkey" "${stack}_api"; do
|
|
printf 'restarting %s\n' "$service"
|
|
docker service update --force "$service" >/dev/null
|
|
done
|
|
|
|
i=0
|
|
while [ "$i" -lt 60 ]; do
|
|
if curl -fsS "http://127.0.0.1:${APP_PORT:-8080}/health/ready" >/dev/null 2>&1; then
|
|
printf 'stack ready after restart\n'
|
|
exit 0
|
|
fi
|
|
i=$((i + 1))
|
|
sleep 2
|
|
done
|
|
printf 'stack did not become ready within 120s\n' >&2
|
|
exit 1 |