Add private Docker UI relay for Nginx Proxy Manager
This commit is contained in:
+10
-6
@@ -21,10 +21,10 @@ rollback() {
|
||||
if [ "$HAD_PREVIOUS" = true ]; then
|
||||
cp "$RUNTIME/.env.previous" "$RUNTIME/.env"
|
||||
cp "$RUNTIME/compose.previous.yaml" "$RUNTIME/compose.yaml"
|
||||
docker compose --project-directory "$RUNTIME" --env-file "$RUNTIME/.env" -f "$RUNTIME/compose.yaml" up -d --force-recreate backend
|
||||
docker compose --project-directory "$RUNTIME" --env-file "$RUNTIME/.env" -f "$RUNTIME/compose.yaml" up -d --force-recreate --remove-orphans
|
||||
echo "Previous backend release restored; inspect its health."
|
||||
else
|
||||
docker compose --project-directory "$RUNTIME" --env-file "$RUNTIME/.env" -f "$RUNTIME/compose.yaml" stop backend || true
|
||||
docker compose --project-directory "$RUNTIME" --env-file "$RUNTIME/.env" -f "$RUNTIME/compose.yaml" stop backend ui-proxy || true
|
||||
echo "First deployment failed; backend stopped."
|
||||
fi
|
||||
}
|
||||
@@ -35,11 +35,15 @@ if ! docker compose --project-directory "$RUNTIME" --env-file "$RUNTIME/.env.nex
|
||||
fi
|
||||
mv "$RUNTIME/compose.next.yaml" "$RUNTIME/compose.yaml"
|
||||
mv "$RUNTIME/.env.next" "$RUNTIME/.env"
|
||||
if ! docker compose --project-directory "$RUNTIME" --env-file "$RUNTIME/.env" -f "$RUNTIME/compose.yaml" up -d --force-recreate backend; then rollback; exit 1; fi
|
||||
CID=$(docker compose --project-directory "$RUNTIME" --env-file "$RUNTIME/.env" -f "$RUNTIME/compose.yaml" ps -q backend)
|
||||
if ! docker compose --project-directory "$RUNTIME" --env-file "$RUNTIME/.env" -f "$RUNTIME/compose.yaml" up -d --force-recreate --remove-orphans; then rollback; exit 1; fi
|
||||
CIDS=$(docker compose --project-directory "$RUNTIME" --env-file "$RUNTIME/.env" -f "$RUNTIME/compose.yaml" ps -q backend ui-proxy)
|
||||
for attempt in $(seq 1 30); do
|
||||
HEALTH=$(docker inspect --format '{{.State.Health.Status}}' "$CID" 2>/dev/null || true)
|
||||
if [ "$HEALTH" = healthy ]; then echo "Backend healthy: $TAG"; exit 0; fi
|
||||
HEALTHY=true
|
||||
for CID in $CIDS; do
|
||||
HEALTH=$(docker inspect --format '{{.State.Health.Status}}' "$CID" 2>/dev/null || true)
|
||||
[ "$HEALTH" = healthy ] || HEALTHY=false
|
||||
done
|
||||
if [ "$HEALTHY" = true ] && [ -n "$CIDS" ]; then echo "Backend healthy: $TAG"; exit 0; fi
|
||||
sleep 2
|
||||
done
|
||||
echo "Backend health failed; rolling back" >&2
|
||||
|
||||
Reference in New Issue
Block a user