Mkdocs search fixers
This commit is contained in:
@@ -389,8 +389,18 @@ if [[ "$ROLLBACK" == "true" ]]; then
|
||||
docker compose build $SOURCE_CONTAINERS
|
||||
docker compose up -d
|
||||
success "Rolled back to $ROLLBACK_COMMIT"
|
||||
info "Database was NOT rolled back. To restore DB, see backup at:"
|
||||
info " $LATEST_ARCHIVE"
|
||||
|
||||
echo ""
|
||||
echo -e " ${BOLD}Database restore:${NC}"
|
||||
echo -e " Code has been rolled back. Database was NOT rolled back."
|
||||
echo -e " The backup archive contains a PostgreSQL dump."
|
||||
echo -e " To restore (${RED}DESTRUCTIVE — replaces current data${NC}):"
|
||||
echo ""
|
||||
ARCHIVE_DIR_NAME="$(basename "$LATEST_ARCHIVE" .tar.gz)"
|
||||
echo -e " ${CYAN}tar xzf $LATEST_ARCHIVE -C /tmp${NC}"
|
||||
echo -e " ${CYAN}gunzip -c /tmp/$ARCHIVE_DIR_NAME/v2-postgres.sql.gz | docker exec -i changemaker-v2-postgres psql -U changemaker -d changemaker_v2${NC}"
|
||||
echo ""
|
||||
|
||||
release_lock
|
||||
exit 0
|
||||
fi
|
||||
@@ -704,6 +714,16 @@ if [[ "$COMMIT_COUNT" -gt 20 ]]; then
|
||||
info " ... and $((COMMIT_COUNT - 20)) more"
|
||||
fi
|
||||
|
||||
# Flag commits that may require manual attention
|
||||
BREAKING_COMMITS="$(git log --oneline "$PRE_UPGRADE_COMMIT..HEAD" --grep="BREAKING" --grep="\[manual\]" 2>/dev/null || true)"
|
||||
if [[ -n "$BREAKING_COMMITS" ]]; then
|
||||
echo ""
|
||||
warn "Commits requiring manual attention:"
|
||||
echo "$BREAKING_COMMITS" | while read -r line; do
|
||||
echo -e " ${YELLOW}$line${NC}"
|
||||
done
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# Phase 4: Container Rebuild
|
||||
# =============================================================================
|
||||
@@ -746,6 +766,12 @@ if [[ "$PULL_SERVICES" == "true" ]]; then
|
||||
info "Pulling latest third-party images..."
|
||||
docker compose pull v2-postgres redis listmonk-app listmonk-db gitea-app nocodb-v2 mailhog 2>/dev/null || true
|
||||
success "Third-party images updated"
|
||||
|
||||
# Record image digests for audit trail
|
||||
info "Recording image digests for audit trail..."
|
||||
docker compose images --format json 2>/dev/null | \
|
||||
python3 -c "import sys,json; [print(f' {i[\"Repository\"]}:{i[\"Tag\"]} -> {i[\"ID\"][:12]}') for i in json.load(sys.stdin)]" \
|
||||
2>/dev/null || true
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
@@ -797,6 +823,17 @@ else
|
||||
success "No failed migrations found"
|
||||
fi
|
||||
|
||||
# Preview pending migrations before applying
|
||||
info "Checking pending migrations..."
|
||||
PENDING_OUTPUT="$(docker compose run --rm --no-deps --entrypoint "" api \
|
||||
npx prisma migrate status 2>&1 || true)"
|
||||
if echo "$PENDING_OUTPUT" | grep -q "Following migration"; then
|
||||
info "Pending migrations to apply:"
|
||||
echo "$PENDING_OUTPUT" | grep -E "^\s+[0-9]" | while read -r line; do
|
||||
echo " $line"
|
||||
done
|
||||
fi
|
||||
|
||||
# Run migrations in a one-off container (catches errors here, not in a restart loop)
|
||||
info "Running database migrations..."
|
||||
write_progress 5 "Database Migration" 60 "Applying migrations..."
|
||||
@@ -831,6 +868,17 @@ if ! docker compose run --rm --no-deps --entrypoint "" api \
|
||||
fi
|
||||
success "Database seed complete"
|
||||
|
||||
# Verify migration state is clean (no drift)
|
||||
info "Verifying migration state..."
|
||||
MIGRATE_STATUS="$(docker compose run --rm --no-deps --entrypoint "" api \
|
||||
npx prisma migrate status 2>&1 || true)"
|
||||
if echo "$MIGRATE_STATUS" | grep -qiE "failed|drift|out of sync"; then
|
||||
error "Schema drift detected after migration!"
|
||||
echo "$MIGRATE_STATUS"
|
||||
exit 1
|
||||
fi
|
||||
success "Schema state verified — no drift"
|
||||
|
||||
# =============================================================================
|
||||
# Phase 6: Service Restart
|
||||
# =============================================================================
|
||||
@@ -838,9 +886,10 @@ success "Database seed complete"
|
||||
phase "6" "Service Restart"
|
||||
write_progress 6 "Service Restart" 70 "Restarting services..."
|
||||
|
||||
# Stop application containers
|
||||
info "Stopping application containers..."
|
||||
docker compose stop $APP_CONTAINERS 2>/dev/null || true
|
||||
# Graceful shutdown with extended drain period (allow in-flight requests to complete)
|
||||
STOP_TIMEOUT=30
|
||||
info "Stopping application containers (${STOP_TIMEOUT}s grace period)..."
|
||||
docker compose stop -t $STOP_TIMEOUT $APP_CONTAINERS 2>/dev/null || true
|
||||
success "Application containers stopped"
|
||||
|
||||
# Force-recreate LSIO containers to prevent anonymous volume shadowing bind mounts.
|
||||
|
||||
Reference in New Issue
Block a user