Files
mtusi2026lab2/scripts/restart.sh
T
2026-11-05 14:24:40 +03:00

22 lines
613 B
Bash
Executable File

#!/bin/sh
set -eu
project_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
cd "$project_root"
if [ ! -d certs ]; then
make key-gen
fi
compose() {
docker compose --env-file "${COMPOSE_ENV_FILE:-.env}" -f docker-compose.yml "$@"
}
# Validate and build before stopping the API. Recreate containers to apply
# current Compose settings, preserve named volumes, and wait for healthchecks.
compose config --quiet
compose build api
compose stop api
compose up -d --force-recreate --wait --wait-timeout 120 postgres redis
compose up -d --no-build --pull never --force-recreate --wait --wait-timeout 60 api