diff --git a/scripts/deploy_remote.sh b/scripts/deploy_remote.sh index f8be0d8..772386d 100755 --- a/scripts/deploy_remote.sh +++ b/scripts/deploy_remote.sh @@ -48,7 +48,30 @@ mkdir -p \ mkdir -p docker/mysql/init -docker compose up -d --build +docker_compose_up_with_retry() { + local max_attempts=3 + local attempt=1 + + while (( attempt <= max_attempts )); do + echo "[deploy] docker compose up attempt ${attempt}/${max_attempts}" + + if docker compose up -d --build; then + return 0 + fi + + if (( attempt == max_attempts )); then + echo "[deploy] docker compose up failed after ${max_attempts} attempts" >&2 + echo "[deploy] check server docker/systemd state: systemctl status docker, systemctl status dbus, journalctl -u docker -n 200" >&2 + return 1 + fi + + echo "[deploy] docker compose up failed, retrying shortly..." >&2 + sleep 10 + attempt=$((attempt + 1)) + done +} + +docker_compose_up_with_retry if [[ -f "$db_dump_path" && ! -f "$db_import_marker" ]]; then for _ in $(seq 1 30); do