Spaces:
Running
Running
File size: 1,205 Bytes
fd5dd94 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #!/bin/sh
# Release step: runs ONCE per deploy, before any new api/worker instance starts
# (Fly.io release_command, Railway preDeployCommand, ECS one-off task, compose "migrate").
# Uses the owner role (WP_OWNER_DATABASE_URL); the app role never runs migrations.
#
# 0. check-config: refuse development defaults (JWT secret, DB passwords, SSRF relaxations).
# 1. check-deploy: refuse a release whose graph no longer has nodes that waiting runs are
# paused in (LangGraph cannot resume them). Runs BEFORE migrating, so a refused release
# changes nothing. Drain those runs (approve/reject them) or keep the nodes, then retry.
# 2. alembic upgrade head. Migrations must be expand-only (additive) so the OLD release,
# still serving while the new one starts (blue-green / rolling), keeps working.
# 3. sync-tools: re-index pack tools for tool search.
# 4. Optional (WP_RELEASE_SEED_DEMO=1): create the public demo tenant if missing (idempotent).
set -eu
cd "$(dirname "$0")/../.."
python -m core.cli check-config
python -m core.cli check-deploy
alembic upgrade head
python -m core.cli sync-tools
if [ "${WP_RELEASE_SEED_DEMO:-0}" = "1" ]; then
python -m core.cli seed-demo
fi
echo "release: ok"
|