Hibernate / pause runbook
Hibernate / pause runbook
Use this when the project is on hold and you want to stop background work and reclaim disk without dropping the database schema.
For the full operational version, see docs/ops/server-hold-runbook.md.
Goal
- stop Cornice background processing
- preserve the database schema
- optionally preserve users and encrypted secrets
- free disk held by runtime tables
Recommended server steps
Fast path:
./scripts/hibernate_server.sh
That script:
- writes
HIBERNATE_MODE=trueandINGEST_ENABLED=falseinto the env file - stops
cornice - stops
cornice-monitorif present - disables both services so they stay shelved
- clears runtime tables while preserving users, profiles, secrets, market catalogs, and opportunity catalogs
Manual path:
-
Stop services.
If you run only the API service:
sudo systemctl stop corniceIf you also run a separate monitor service, stop that too:
sudo systemctl stop cornice-monitor -
Put the API into hibernate mode before the next restart.
In your server env file:
HIBERNATE_MODE=true INGEST_ENABLED=falseHIBERNATE_MODE=truekeeps the FastAPI app available but skips all background tasks on startup. -
Clear runtime data.
Preserve users, profiles, secrets, market catalogs, and opportunity catalogs:
python3 scripts/clear_runtime_data.pyAlso clear the
opportunitiescatalog:python3 scripts/clear_runtime_data.py --include-opportunitiesFully empty all application tables, including auth/secrets:
python3 scripts/clear_runtime_data.py --include-opportunities --include-auth -
If you still want the API up for login/inspection, restart only the API service:
sudo systemctl start cornice
What the cleanup script removes by default
execution_ordersexecutionssimulator_tradessimulator_runsagent_findingsagent_runsopportunity_observationshourly_pricesmarket_snapshotsorderbook_snapshotsrequestsarb_go_signalsarb_observations
What it preserves by default
usersuser_profilesuser_secretsopportunitiesglobal_marketsmarketsmarket_linksarb_monitor_profilesarb_opportunity_instancesarb_opportunity_legs
Notes
- This does not drop tables or migrations.
TRUNCATE ... RESTART IDENTITY CASCADEis used so disk-heavy runtime tables are emptied cleanly.- If you want the smallest server footprint, keep both services stopped instead of restarting the API in hibernate mode.