thread-master/scripts/prod-update.sh

29 lines
731 B
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
set -euo pipefail
# 只重建/重啟 API、Web、Workers不碰 mongo/redis資料留在 volume
# shellcheck source=scripts/prod-common.sh
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/prod-common.sh"
prod_load_env
prod_require_docker
cd "$BACKEND_DIR"
prod_build_web_if_static
cd "$DEPLOY_DIR"
if ! prod_deps_healthy; then
echo "[prod] mongo/redis 未在運行,先啟動依賴(不會清 volume..."
prod_ensure_deps
else
echo "[prod] mongo + redis 維持運行 — 只更新應用層"
fi
echo "[prod] building app images (api, web, workers)..."
prod_compose build api web go-worker node-worker-style-8d
prod_start_app_services
prod_wait_api_health
prod_print_stack_summary