Skip to content

Docker

Run the engine as a container with Postgres and a mail catcher, for development or production.

Applies to Engine
View as Markdown
On this page
  1. Start
  2. Keys and a first user
  3. What runs
  4. Production

The repository has a docker-compose.yml that runs everything on one machine: Postgres 16, the engine and Mailpit, which catches every e-mail so you can read sign-up and password links locally.

Start

Terminal
git clone https://github.com/sespinosav/sypnia-data && cd sypnia-data
cp .env.example .env

Fill the two secrets in .env, generating them on your machine:

Terminal
openssl rand -base64 32   # SYPNIA_DATA_MASTER_KEY: keep it safe, without it every session ends
openssl rand -base64 24   # POSTGRES_PASSWORD
Terminal
docker compose up -d
docker compose ps          # db, mailpit and data become healthy
curl http://localhost:8080/health

On its first start the engine installs its schema in the database (it waits until Postgres is ready). After an upgrade it applies the new migrations before it serves. Both come from SYPNIA_DATA_INSTALL_ON_START=true.

Keys and a first user

Terminal
docker compose exec data sypnia-data keys api-key --kind publishable   # for your app (browser-safe)
docker compose exec data sypnia-data keys api-key --kind secret        # for your servers; shown once
docker compose exec -e SYPNIA_DATA_NEW_PASSWORD='a long passphrase' data sypnia-data users create ana@example.com

Sign-ups, magic links and password resets land in Mailpit at http://localhost:8025.

What runs

ServiceImagePortNotes
dbpostgres:16-bookworminside onlydata in the pgdata volume
mailpitaxllent/mailpit:v1.27127.0.0.1:8025the web UI; SMTP on mailpit:1025 inside
dataghcr.io/sespinosav/sypnia-data:${SYPNIA_DATA_VERSION}127.0.0.1:8080auth, Data API, SQL, and MCP at /mcp

The engine’s image is distroless and runs as a non-root user. It is built for linux/amd64 and linux/arm64, and its healthcheck is sypnia-data health. Compose caps each container’s memory.

Production

  • TLS in front. The engine speaks plain HTTP on port 8080. Put Caddy, nginx, Traefik or your cloud’s load balancer in front, and forward the Host header: the engine uses it to pick the project and to build links in e-mails.
  • Your address. Set SYPNIA_DATA_PUBLIC_URL to the address people reach (https://api.myapp.com).
  • A real mail provider. Replace Mailpit with SYPNIA_DATA_MAIL=smtp|resend|postmark|ses (configuration).
  • Pin a version. Use SYPNIA_DATA_VERSION=0.1.0, never latest.
  • Keep the master key out of files. In production, keep SYPNIA_DATA_MASTER_KEY in a secrets manager rather than in .env.
  • Replicas. Two replicas behind the proxy share nothing but the database.
  • Logs. They go to stdout as JSON lines with a request id; secrets are never logged.

Upgrading is in Upgrades and backups.

  1. Start
  2. Keys and a first user
  3. What runs
  4. Production

    Search pages, sections and terms