fix: zero-downtime deploy with --wait flag + fallback
Deploy FileDrop / deploy (push) Canceled after 0s
Deploy FileDrop / deploy (push) Canceled after 0s
This commit is contained in:
@@ -155,12 +155,15 @@ vps "rm -rf '${DEPLOY_DIR}.old' && mv '${DEPLOY_DIR}' '${DEPLOY_DIR}.old' 2>/dev
|
|||||||
|
|
||||||
ok "Files shipped to ${DEPLOY_DIR}"
|
ok "Files shipped to ${DEPLOY_DIR}"
|
||||||
|
|
||||||
# ── 5. Build Docker image & restart on VPS ───────────────────────────────────
|
# ── 5. Build Docker image & restart ──────────────────────────────────────
|
||||||
log "Building Docker image on VPS..."
|
log "Building Docker image on VPS..."
|
||||||
vps "cd '${DEPLOY_DIR}' && docker compose build --pull 2>&1" | tail -5 || die "Docker build failed on VPS"
|
vps "cd '${DEPLOY_DIR}' && docker compose build --pull 2>&1" | tail -5 || die "Docker build failed on VPS"
|
||||||
|
|
||||||
log "Restarting container..."
|
log "Restarting container (zero-downtime via healthcheck)..."
|
||||||
vps "cd '${DEPLOY_DIR}' && docker compose up -d --force-recreate 2>&1" || die "Container restart failed"
|
vps "cd '${DEPLOY_DIR}' && docker compose up -d --force-recreate --wait --wait-timeout 60 2>&1" || {
|
||||||
|
log "Warn: --wait not supported on this docker-compose version, falling back to basic restart"
|
||||||
|
vps "cd '${DEPLOY_DIR}' && docker compose up -d --force-recreate 2>&1" || die "Container restart failed"
|
||||||
|
}
|
||||||
|
|
||||||
# ── 6. Verify container is running ────────────────────────────────────────────
|
# ── 6. Verify container is running ────────────────────────────────────────────
|
||||||
log "Waiting for container to be healthy..."
|
log "Waiting for container to be healthy..."
|
||||||
|
|||||||
Reference in New Issue
Block a user