More than one machine
One server is enough for most teams. When it isn’t, Lyra scales by running more copies of the same image. Every copy is the same code; a setting called ROLE decides which parts each one runs.
What each copy needs
Section titled “What each copy needs”Copies on different machines can’t share Docker volumes or memory, so they share these instead:
| Why | |
|---|---|
| One Postgres 17 database | The only place Lyra keeps data for good. Give Lyra its own, so heavy database views never slow down another product’s database |
| One Redis 7 | Passes live edits and events between copies, so two people on different copies see each other type, and counts rate limits for all copies together. It holds nothing that can’t be lost |
| One S3-compatible bucket | Uploaded files. See Your own proxy and S3 |
| The same settings | The same APP_URL, AUTH_SECRET and the rest, on every copy |
ROLE |
Runs |
|---|---|
all |
Everything, in one process. The default |
api |
The API, the MCP endpoint, live updates (/api/live) and the web app. No live editing and no background jobs |
collab |
The same as api, plus live editing (/collab). No background jobs |
jobs |
Only background jobs, such as emails, imports and cleanup. It answers no requests |
Any role other than all needs REDIS_URL; the server refuses to start without it.
A typical split:
┌──▶ ROLE=api (2 or more copies) ──┐ docs.acme.com ──▶ load balancer ─┤ ├──▶ Postgres, Redis, S3 └──▶ ROLE=collab (/collab only) ──────┤ ROLE=jobs (1 or more copies) ──┘Send /collab to the collab copies, and everything else to the api copies. Run at least one jobs copy: emails, sign-in links included, and imports are background jobs, so without one they never run. Follow Your own proxy for the load balancer’s settings.
Each copy opens up to DATABASE_POOL_SIZE database connections, 20 by default. Check that your Postgres allows that many for every copy together.
Serving the web app from a CDN
Section titled “Serving the web app from a CDN”The web app is static files. To serve it from a CDN instead of Lyra:
- Leave
WEB_DIST_DIRempty on the server, so it serves only the API. - Put the built web app on the CDN, at
APP_URL. - Have the CDN send
/api,/collab,/oauth,/.well-knownand/mcpto the server, so the app and the API share one address and one sign-in cookie.
If you publish pages on a separate domain with SHARE_URL, point that domain straight at the server, not at the CDN.
When Redis is down
Section titled “When Redis is down”Postgres is the only place data lives, so losing Redis or a copy of Lyra loses nothing. While Redis is down, people on different copies stop seeing each other’s changes live, and rate limits are skipped rather than refusing every request.