Operations
What to check when the API will not boot or a migration is in play, and which operational facts are still unknown.
These entries are for an engineer who already has repository access. They are not a paging roster. No on-call rotation, escalation address, or status-page owner is named in the three application repositories. Escalation: unknown. When this page says “ask the team”, it means the people who hold the Railway and Neon access. This handbook cannot name them from source.
Nothing here was executed on 11 November 2026. Commands are copied from the Taskfile and workflows. Label them unexecuted when you follow them.
Each heading below is the symptom you see, so scan the headings for yours. Each entry then gives the impact, first checks, mitigation, and when it was last verified.
Warn before you mutate shared data. task migration:run and pnpm run migration:run apply TypeORM migrations to whatever DATABASE_URL points at.
API exits at boot with a config error
Symptom. The process prints Config validation error: and exits.
Impact. That app does not serve traffic. Other apps in the monorepo are unaffected until they boot with the same env file.
Audience. Whoever is starting apps/server, apps/worker, apps/audit, or apps/ehr locally or in a deploy.
First checks.
- Read the variable name in the Zod message.
- Compare
.env.localwithenvSchemainlibs/shared/src/config/env.config.ts. The clinic app usesehrEnvSchemainstead. - Remember that a key set to an empty string is present.
.default()does not replace"". URL fields such asEDUCATION_HUB_URLandR2_PUBLIC_BASE_URLreject an empty string. Most other required strings do not. - A missing
OPENAI_API_KEYis this same failure at APImain6bfb9f6b, the same tree as staging0d611c96. A search of that tree finds noOPENROUTER_API_KEY. Deployment was not verified. See Config and environment.
Mitigation. Put a development value in .env.local for the key the message names. Do not invent a production secret. Do not commit the file.
Resolution. If the key is new, add it to .env.example as an empty placeholder and to every deploy environment through the Railway variable flow in .railway/. A missing required key stops that environment from booting.
Last verified. Source read, 11 November 2026. The Rover key was read on API main a888ae352ca2d6ece9d22bf3c0ac90fcb01a425f on 23 November 2026. That commit shares a tree with staging b0a3d7eb. Not executed.
Redis or Centrifugo will not connect
Symptom. Redis or Centrifugo connection errors after the process has passed config validation.
Impact. Queues, cache, and realtime fail. At API fbb63d5178bcfe171292daebb19b6cbdac025a44 the server, the worker, and the audit app each construct RedisService through InstanceModule. A missing REDIS_URL throws REDIS_URL environment variable is not configured in the constructor, before the ping. After boot, a Redis error is not caught in sharedThrottler or ApiKeyRateLimitGuard, so a throttled route and an API-key route fail. Collaborative opens go through CollabSync and have no second path. This pass did not record a dedicated refusal string for that open, and it did not measure which other HTTP routes still answer.
First checks.
task infra:statustask infra starts Redis (localhost:6379), Centrifugo (localhost:8006), and Gotenberg (localhost:3010). It does not start Hub Postgres or RabbitMQ. Set REDIS_URL to redis://localhost:6379. The schema default of that string applies to the parsed config object. RedisService reads process.env and does not use the schema default. CENTRIFUGO_URL defaults to http://localhost:8006. RABBIT_MQ_URL has no local default. You need a broker URL you are allowed to use.
Mitigation. Start infra, or point the URL at a broker you are allowed to use. Do not point a laptop at a production broker to “see if it works”.
Last verified. The Redis sentences were read at API fbb63d5178bcfe171292daebb19b6cbdac025a44. task infra:status was not run.
Edits or Pip stops do not reach another browser
Symptom. An edit on one browser does not appear on another, a Pip stop or undo does nothing, or a throttled route returns an error while the health summary is still up.
Impact. Documents, Pip ownership, and the shared rate limits all go through Redis. One API process can still serve a request that never touches those paths. This was not measured against a live host.
First checks.
- Read the response header
X-Served-By. It isINSTANCE.replica:RAILWAY_REPLICA_ID, or the hostname when that variable is unset. The same string is thereplicafield on every log line. GET /health/detailed(platform admin) includesinstances. Each row’sidis the replica plus the boot. The list is copies that reported within 30 seconds. A Redis failure on the list is an empty array and does not by itself mark the check down..railway/environments.tssetsapiReplicasto 1 on staging and 2 on production (since API491254f1). The live counts after that change were not read. That is the replica count, not a browser or Pip check across two servers. See Several copies.
Mitigation. Do not point a laptop at the staging Redis to “see the other copy”. The checks that have no automated test are a browser editing one document across two servers, and a full Pip run stopped or undone from the other server. Only production runs two API copies now. See Several copies.
Last verified. Source read at API fbb63d5178bcfe171292daebb19b6cbdac025a44. Replica counts read from .railway/environments.ts at API 38525cf9. No header was captured and no school host was requested.
A column is missing or the migration check fails
Symptom. The API is up but a query fails because a column or table is missing, or a pull request cannot merge the migration check.
Impact. Schema drift between the TypeORM entities and the database. Writes can fail or, worse, succeed against the old shape.
First checks.
- Hub migrations live in
database/migrations/.DatabaseModulesetssynchronize: false. - Clinic migrations live in
database/ehr-migrations/. - CI workflow
migration-check.ymlruns on pull requests tostaging. It startspgvector/pgvector:pg16, builds, and runspnpm run migration:run. It does not run the full Vitest suite. A green check means that job migrated a disposable database, not that production migrated. deploy-migrations.ymlruns migrations on push tostagingand tomain, against Railway servicesNaalya-APIandNaalya-EHR.
Mitigation. Do not run migration:run against production from a laptop to “get unblocked”. Use the workflow, or a database you own.
Resolution. Generate a migration locally only against a database you are willing to diff. Review the SQL. Commit the file. The handbook recipe is Add an Entity & Migration.
Last verified. Workflow files read, 11 November 2026. Not executed.
API calls fail from the website or Hub
Symptom. Pages load and API calls fail immediately, or the chat widget renders nothing.
First checks.
- Hub:
VITE_API_URLin.env.local. The Axios instance does not throw when it is unset. - Website chat:
NaalyaChatWidgetreturnsnullwhenVITE_API_URLorVITE_NAALYA_API_KEYis missing (app/lib/naalya-chat/site.ts). - Hub PostHog stays off unless
VITE_APP_ENVisproductionand both PostHog variables are non-empty (isPostHogEnabled). An empty analytics screen in local dev is expected. - Website
openapi.jsonis not the list of routes the forms call. Compare with The API client.
Last verified. Source read, 11 November 2026. Not executed.
Health routes to check
| Process | Route | Symbol |
|---|---|---|
| Schools API | GET /api/v1 | AppController.getHello |
| Schools API | GET /api/v1/health | Health controller prefix health. The response body was not opened. |
| Schools API | GET /api/v1/debug-error | AppController. Do not call this against a shared environment. |
| Clinic API | prefix health under /api/v1 | EHR health controller. Body not opened. |
| Hub | GET /robots.txt | Railway healthcheck in .railway/railway.ts |
GET /api/v1/debug-error is a real route. Treat it as a fault-injection endpoint, not a health check. GET /health/detailed includes instances. That field was read at API fbb63d5178bcfe171292daebb19b6cbdac025a44. See Several copies. The public summary row in the table was not re-opened as a response body.
Old audit rows or notifications are gone
Symptom. Audit rows or in-app notifications older than a year are gone, or the worker log says Records retention hit its per-run batch cap.
Impact. RecordsRetentionService deletes from audit_log and notification only, where created_at is older than 365 days. It does not delete pupil, staff, or guardian profiles. One run deletes at most 20 batches of 5,000 rows per table. A capped run leaves older rows for the next schedule.
First checks. The scheduler id is records-retention. CRON_RECORDS_RETENTION defaults to 0 1 * * *. Confirm the worker is the process that runs crons, and that CRON_ENABLED is on in that environment. The committed Railway APP.settings set CRON_ENABLED to 1. That is source, not a live read.
Mitigation. Do not “restore” by pointing a laptop at production and inserting rows. If the cap is logging every night, the backlog is larger than one run. That is an operational fact, not a reason to widen the delete to other tables.
Last verified. records-retention.service.ts and CronJob.RecordsRetention read, 11 November 2026. The job was not executed.
Gaps in this runbook
- Name a person to escalate to.
- State a severity scheme. None is committed.
- Confirm that production basic-auth, domains, or replica counts match the TypeScript objects. They are source, not a live read.
- List every paging alert. No alert catalogue is in these repositories.
When you learn an operational fact the hard way, add an entry in this shape and put the date and the commit you checked under Last verified.