Maintenance mode
Maintenance mode closes an instance on purpose: for a release that converts data in place, a large import, or the check after a restore (decision 0004 point 14). Visitors get a clear "back soon" answer instead of a proxy's error page, and admins keep working.
Two ways in
- The switch, in the admin (Settings → Maintenance mode, admins only) or from the console. It is stored in the database, so every container follows it, within 5 seconds. It has an optional message of at most 200 characters of plain text, which visitors and the team get.
SHADE_MAINTENANCE=truein a container's environment, for when the database cannot be used (a restore, a broken database). That container skips start-up: no database, no Redis, no modules. It answers the health checks and refuses everything else, admins included, until you start it again without the variable. It wins over the switch.
From the console, where the API runs (node console/maintenance.mjs in the image, pnpm --filter @shadestack/api maintenance in a checkout), with DATABASE_URL (and REDIS_URL, to tell the containers at once):
node console/maintenance.mjs on --message "Back at 12:00"
node console/maintenance.mjs off
This is the way back when the admin cannot be reached. It is in the audit log as system: maintenance.
What happens while it is on
| Who | What they get |
|---|---|
| Visitors on a static site | The pages, which are files. A form, a checkout, a sign-in or an island gets the answer below; an island's route call or form says closed instead of failed. |
The account API (/api/v1/account/*: forms, accounts, modules' public and account routes, payment webhooks) | 503, code UNAVAILABLE, key api.errors.maintenance, Retry-After: 120, and the admin's message (error.params.message). A payment provider retries its webhook. Open live streams and sockets end with a reconnect; new ones are refused. Users stay signed in. |
The content API (/api/v1/content) | Reads keep answering, so a frontend that renders per request stays up and a build can run. Rebuilds wait: no build hook is called, and one rebuild is asked for when it turns off, if any was asked meanwhile. |
| The admin | Admins sign in and work under a banner Maintenance mode is on, with who switched it on, since when, and Switch off. Every other team member gets a Back soon screen with the message, at sign-in too. |
| API tokens (automation, data, read tokens on anything but content reads) and MCP | The same 503. |
| Background work | Queued jobs wait in their queue. Schedules skip their due times: modules' runs are lost, not caught up; SHADE's own backup looks every 5 minutes, so it catches up. Modules' processes stop, and start again when it ends. |
| Always open | /health, /health/live, /.well-known/security.txt, /api/v1/openapi.json. |
/health keeps answering 200 when the container is otherwise ready, with "maintenance":"on" in its checks, so a
proxy keeps sending visitors to SHADE's own 503 instead of its error page. With SHADE_MAINTENANCE=true it leaves out
the redis and database checks: that container uses neither.
Updates and restores
- Ordinary updates need no maintenance mode: from 0.1.0 releases only add, and the admin container answers 503 on its own
while it applies migrations. A release that converts data in place says so in the changelog.
On a server of your own,
shade update --maintenanceswitches maintenance mode on, updates, and switches it off again (A release that needs maintenance); elsewhere switch it on before you pull the release, and off once the admin works again. - A restore leaves maintenance mode on. See Restoring.