fix issue prod deployment
This commit is contained in:
@@ -53,6 +53,34 @@ start_prod_services() {
|
||||
prod_compose up --build -d "$@"
|
||||
}
|
||||
|
||||
wait_for_healthy() {
|
||||
local service="$1"
|
||||
local timeout="${2:-120}"
|
||||
local container="${PROJECT_NAME}-${service}-1"
|
||||
local elapsed=0
|
||||
|
||||
echo "Waiting for ${service} to be healthy (timeout: ${timeout}s)..."
|
||||
while [[ $elapsed -lt $timeout ]]; do
|
||||
local status
|
||||
status=$(docker inspect --format='{{.State.Health.Status}}' "${container}" 2>/dev/null || echo "missing")
|
||||
case "$status" in
|
||||
healthy)
|
||||
echo "${service} is healthy."
|
||||
return 0
|
||||
;;
|
||||
unhealthy)
|
||||
echo "ERROR: ${service} is unhealthy. Check logs with: docker logs ${container}" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
sleep 5
|
||||
elapsed=$((elapsed + 5))
|
||||
done
|
||||
|
||||
echo "ERROR: Timed out waiting for ${service} to become healthy." >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
start_portainer() {
|
||||
ensure_env_file
|
||||
ensure_traefik_network
|
||||
|
||||
@@ -6,5 +6,6 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
source "${ROOT_DIR}/scripts/docker-prod-common.sh"
|
||||
|
||||
start_prod_services admin
|
||||
wait_for_healthy admin
|
||||
|
||||
echo "Admin is starting."
|
||||
echo "Admin is up and healthy."
|
||||
|
||||
@@ -7,5 +7,9 @@ source "${ROOT_DIR}/scripts/docker-prod-common.sh"
|
||||
|
||||
start_traefik
|
||||
start_prod_services
|
||||
wait_for_healthy api
|
||||
wait_for_healthy marketplace
|
||||
wait_for_healthy dashboard
|
||||
wait_for_healthy admin
|
||||
|
||||
echo "Production stack is starting: traefik, postgres, redis, api, marketplace, dashboard, admin, pgmanage"
|
||||
echo "Production stack is up and healthy: traefik, postgres, redis, api, marketplace, dashboard, admin, pgmanage"
|
||||
|
||||
@@ -6,5 +6,6 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
source "${ROOT_DIR}/scripts/docker-prod-common.sh"
|
||||
|
||||
start_prod_services api
|
||||
wait_for_healthy api
|
||||
|
||||
echo "API is starting."
|
||||
echo "API is up and healthy."
|
||||
|
||||
@@ -6,5 +6,6 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
source "${ROOT_DIR}/scripts/docker-prod-common.sh"
|
||||
|
||||
start_prod_services dashboard
|
||||
wait_for_healthy dashboard
|
||||
|
||||
echo "Dashboard is starting."
|
||||
echo "Dashboard is up and healthy."
|
||||
|
||||
@@ -6,5 +6,8 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
source "${ROOT_DIR}/scripts/docker-prod-common.sh"
|
||||
|
||||
start_prod_services marketplace dashboard admin
|
||||
wait_for_healthy marketplace
|
||||
wait_for_healthy dashboard
|
||||
wait_for_healthy admin
|
||||
|
||||
echo "Frontend production services are starting: marketplace, dashboard, admin"
|
||||
echo "All frontend services are up and healthy."
|
||||
|
||||
@@ -6,5 +6,6 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
source "${ROOT_DIR}/scripts/docker-prod-common.sh"
|
||||
|
||||
start_prod_services marketplace
|
||||
wait_for_healthy marketplace
|
||||
|
||||
echo "Marketplace is starting."
|
||||
echo "Marketplace is up and healthy."
|
||||
|
||||
Reference in New Issue
Block a user