Install OpenSequence in production
How to install for production: build the one image, point it at your Postgres, run the api and worker roles with real secrets, create the first project.
This page takes you from a clone to a production install: one Docker image, a Postgres you own, an api role and a worker role. To try it on a laptop with mock providers, run docker compose up from a clone, as in the Quickstart.
Get the image
docker pull ghcr.io/lguerberg/open-sequence:mainEvery push to main publishes ghcr.io/lguerberg/open-sequence:main and :sha-<commit> (amd64). A release tag v* publishes :<version>, :<major>.<minor> and :latest for amd64 and arm64. Pin a sha- or version tag in production so a redeploy never changes the code under you. To build it yourself instead: docker build -f apps/server/Dockerfile -t opensequence/server . from a clone.
The image runs Node 22 on Alpine as the non-root user oseq (uid 100, gid 101). It starts node dist/main.js, listens on port 8080 and has a Docker HEALTHCHECK on /healthz. NODE_ENV=production is baked in. The operator CLI ships inside as dist/cli.js.
Provision Postgres
Give OpenSequence its own database on Postgres 14 or newer. It needs no extensions. It creates and owns two schemas, seq and seq_auth, so it can share a database such as Supabase's. A transaction pooler is fine. See Database.
Generate the secrets
docker run --rm ghcr.io/lguerberg/open-sequence:main node dist/cli.js secrets new-key
# kmvb1mvo3:Y2ItLFqx5NZ9+b+jHrY01i2ZrnGE+pnxdoeMna58BzM= -> SEQ_ENCRYPTION_KEYS
openssl rand -base64 32 # -> SEQ_ADMIN_TOKENSEQ_ENCRYPTION_KEYS encrypts every stored secret: each sender's SMTP and IMAP passwords, the Allo and Attio keys and the webhook signing secrets. SEQ_ADMIN_TOKEN is the operator token that creates projects.
SEQ_ENCRYPTION_KEYS with the database. A database restored without the key that encrypted it has unreadable credentials, and every one must be entered again.Run the api role
docker run -d --name oseq-api -p 8080:8080 \
-e SEQ_ROLES=api \
-e SEQ_DB_DSN=postgres://oseq:secret@db.internal:5432/opensequence \
-e SEQ_ENCRYPTION_KEYS='kmvb1mvo3:…' \
-e SEQ_ADMIN_TOKEN='…' \
-e SEQ_PUBLIC_URL=https://sequences.example.com \
-e SEQ_RUN_MIGRATIONS=1 \
ghcr.io/lguerberg/open-sequence:mainWith SEQ_RUN_MIGRATIONS=1 the process applies the seq and seq_auth migrations before it opens its port. Each migration runs in its own transaction behind a row lock, so replicas that start together do not race. If a migration fails, the process exits with code 1. To migrate from a pipeline instead, see Upgrades.
SEQ_PUBLIC_URL is the HTTPS origin the outside world reaches. Allo posts webhooks to it, and every email's unsubscribe link points at it. It defaults to http://localhost:8080, so always set it in production. The service speaks plain HTTP: put a TLS terminator in front.
Run the worker role
docker run -d --name oseq-worker \
-e SEQ_ROLES=worker \
-e SEQ_DB_DSN=postgres://oseq:secret@db.internal:5432/opensequence \
-e SEQ_ENCRYPTION_KEYS='kmvb1mvo3:…' \
-e SEQ_PUBLIC_URL=https://sequences.example.com \
ghcr.io/lguerberg/open-sequence:mainThe worker runs the scheduler and the queue consumers. It needs no SEQ_ADMIN_TOKEN. It still listens on SEQ_PORT for /healthz and /readyz, but the API routes answer on that port too, so never expose it. It needs the same SEQ_PUBLIC_URL because it writes the unsubscribe links into emails.
For a small install, one container with SEQ_ROLES=all does both jobs. You can split it later without a migration.
Create the first project
docker exec oseq-api node dist/cli.js projects create acme --name "Acme CRM"
# or over HTTP with the operator token
curl -X POST https://sequences.example.com/v1/admin/projects \
-H "Authorization: Bearer $SEQ_ADMIN_TOKEN" -H "Content-Type: application/json" \
-d '{"slug":"acme","name":"Acme CRM"}'Both return the project and its first admin API key, shown once. Keep that key for configuration. Give your application a narrower key:
curl -X POST https://sequences.example.com/v1/api-keys \
-H "Authorization: Bearer $ADMIN_KEY" -H "Content-Type: application/json" \
-d '{"name":"app","scopes":["enroll"]}'Register the providers
With mock providers off, nothing is sent until the project has credentials. Each one is stored encrypted and is write-only.
| What you want | What to register |
|---|---|
| each sender's SMTP and IMAP settings, Gmail included: Email | |
| SMS and call tasks | one Allo API key per project, then a number and user per sender: Allo |
crm.* conditions | one Attio API key per project: Attio |
GET /v1/project shows the inbound webhook URL (webhook_urls.allo), built from SEQ_PUBLIC_URL.
Check it is healthy
| Path | Answers |
|---|---|
GET /healthz | { "ok": true } while the process runs. Use it for liveness |
GET /readyz | 503 when the database does not answer. On worker and all, also 503 until the scheduler has run a job, and whenever it has not run one in the last 2 minutes |
GET /v1/admin/engine/health | queue depths and the last run of every scheduler job, with the operator token |
GET /v1/engine/health | the same plus the project's flags, with an admin key |
Logs are Pino JSON on stdout. See Observability.