Spaces:
Running

WorkPilot-AI / deploy /scripts /release.sh
Aynkhn's picture
Deploy WorkPilot demo
fd5dd94 verified
Raw History Blame Contribute Delete
1.21 kB
#!/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"