New Environment Runbook
Use this when provisioning a new Railway environment (e.g. staging-2, qa).
Prerequisites
RAILWAY_API_TOKENwith access to the projectfin-infrarepo cloned locally with Bun installed
Steps
1. Create environment in Railway dashboard
- Open Railway → select the project → Environments → New Environment
- Note the new
RAILWAY_ENVIRONMENT_ID
2. Copy and fill variable template
bash
cp environments/staging/variables.env.example environments/<new-env>/.env
# Edit the file and fill in real values3. Provision infrastructure
bash
cd railway
export RAILWAY_API_TOKEN=...
export RAILWAY_PROJECT_ID=...
export RAILWAY_ENVIRONMENT_ID=<new-env-id>
bun run provision:dry # Verify what will be created
bun run provision # Provision all infra + servicesThis provisions: PostgreSQL, RustFS, Valkey, Temporal, RabbitMQ, and all 6 microservices + frontend.
To provision in stages:
bash
bun run provision:infra # Infra services only (Postgres, RustFS, Valkey, Temporal)
bun run provision:services # Microservices + frontend only4. Initialise databases
bash
bun run init-dbCreates the finance and mgmt databases. Run once per environment.
5. Sync environment variables
bash
bun run vars:syncPushes all shared variables from shared/variables.ts to every backend service.
6. Set secrets manually in Railway dashboard
These are never stored in code and must be set by hand in the Railway environment variables UI:
| Secret | Required by |
|---|---|
JWTSECRET | All backend services |
GOOGLE_API_KEY | agents, wfw |
MINIO_ROOT_PASSWORD / MINIO_ROOT_SECRETKEY | RustFS service |
RABBITMQ_DEFAULT_PASS | RabbitMQ service |
RUSTFS_ACCESS_KEY / RUSTFS_SECRET_KEY | All services using object storage |
DATABASE_URL / POSTGRES_USER / POSTGRES_PASSWORD | All backend services |
7. Deploy services
bash
bun run deploy:allThen verify:
bash
bun run statusHealth checks should go green within a minute. Check logs if any service fails to start:
bash
bun run logs -- --service blitz-apiChecklist
- [ ] Environment created in Railway dashboard, ID noted
- [ ] Variable template copied and filled
- [ ] Infrastructure provisioned (
bun run provision:drythenbun run provision) - [ ] Databases initialised (
bun run init-db) - [ ] Variables synced (
bun run vars:sync) - [ ] Secrets set in Railway dashboard
- [ ] Services deployed (
bun run deploy:all) - [ ] All services healthy (
bun run status)