Files
sentio/docker-compose.yml
T
Jens Nylander c3cfee3552 compose: pin every image, and say where the gate really is
rspamd and mailpit tracked `latest`, so the stack you got depended on the
day you pulled it and dependabot had nothing to raise a pull request
against. Pinned at 4.2.2 and v1.31.6, and NATS moved 2.11 -> 2.15 while
I was in there.

publish.yml still said main was validated by ci.yml, which is gone.
scripts/check.sh and scripts/e2e/run-e2e.sh are the gate, run before a
tag goes up.
2026-10-17 12:25:23 +02:00

217 lines
8.5 KiB
YAML

# ─────────────────────────────────────────────────────────────────────────────
# Sentio SMTP - OSS quickstart docker-compose stack
#
# docker compose up -d # pull the published image + start everything
# docker compose logs -f sentio # tail app logs
# docker compose down -v # stop and wipe volumes
#
# What runs:
# sentio - the SMTP + REST API server (ports 25, 465, 587, 8080)
# sentio-migrate - one-shot: applies DB migrations + seeds bootstrap tenant
# postgres - application state (tenants, messages, credentials, …)
# redis - KV backend (rate limits, greylist, bans, rspamd Bayes)
# nats - JetStream (queue + delivery pipeline)
# seaweedfs - S3-compatible blob storage for raw .eml / attachments
# clamav - antivirus (attachment scanning, port 3310)
# rspamd - spam scorer (port 11333)
#
# Bootstrap credentials (migration 002 auto-seeds these):
# Tenant ID : 00000000-0000-0000-0000-000000000001 ("Sentio Platform")
# API key : sentio_bootstrap_admin_CHANGE_ME
#
# ⚠ Rotate the API key immediately if this host is reachable from the
# internet. See README-docker.md.
#
# DNS / DNSBL note:
# Sentio and rspamd use Docker's embedded DNS by default. Spamhaus
# (zen.spamhaus.org, dbl.spamhaus.org) refuses queries from shared public
# resolvers and will return 127.255.255.254 under real volume. For
# production, either (a) register a free Spamhaus Data Query Service key
# and rewrite the DNSBL lists to use <key>.zen.dq.spamhaus.net, or
# (b) add an unbound recursive resolver service and point everything at it.
# ─────────────────────────────────────────────────────────────────────────────
name: sentio-oss
x-sentio-env: &sentio-env
RUST_LOG: info
# migrations/002_bootstrap.sql seeds a publicly-known admin key so the stack
# is usable immediately, and the server otherwise refuses to start while that
# key is active. The two cannot both hold on a first run: you cannot rotate
# the key through the API before the server will boot. This stack is for
# evaluation, so it starts with the guard lifted and tells you to rotate.
#
# Rotate before this stack is reachable by anything but you - see "Bootstrap
# credentials" in the README. A real deployment should not set this.
SENTIO_ALLOW_BOOTSTRAP_KEY: "1"
SENTIO__DATABASE__URL: "postgres://sentio:sentio@postgres:5432/sentio"
SENTIO__KV__BACKEND: "redis"
SENTIO__REDIS__URL: "redis://redis:6379/0"
SENTIO__NATS__URL: "nats://nats:4222"
SENTIO__STORAGE__ENDPOINT_URL: "http://seaweedfs:8333"
SENTIO__STORAGE__ACCESS_KEY: "sentio-dev"
SENTIO__STORAGE__SECRET_KEY: "sentio-dev-secret-CHANGE_ME"
SENTIO__STORAGE__BUCKET: "sentio-attachments"
SENTIO__SCANNING__CLAMD_HOST: "clamav:3310"
SENTIO__SPAM__RSPAMD__URL: "http://rspamd:11333"
services:
# ── Data plane ──────────────────────────────────────────────────────────
postgres:
image: postgres:18-alpine
restart: unless-stopped
environment:
POSTGRES_USER: sentio
POSTGRES_PASSWORD: sentio
POSTGRES_DB: sentio
volumes:
# PG18+ images store data in a major-version subdirectory and reject a
# mount at /var/lib/postgresql/data. Mount the parent instead.
- postgres_data:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sentio -d sentio"]
interval: 5s
timeout: 5s
retries: 20
networks: [sentio_net]
redis:
image: redis:8-alpine
restart: unless-stopped
command: ["redis-server", "--save", "60", "1000", "--appendonly", "yes"]
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 20
networks: [sentio_net]
nats:
image: nats:2.15-alpine
restart: unless-stopped
command: ["-c", "/etc/nats/nats-server.conf"]
volumes:
- ./docker/nats/nats-server.conf:/etc/nats/nats-server.conf:ro
- nats_data:/data
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://localhost:8222/healthz | grep -q ok"]
interval: 5s
timeout: 3s
retries: 20
networks: [sentio_net]
# `weed mini` is master + volume server + filer + S3 gateway in one
# process, which is all a single-node evaluation needs. MinIO stood here
# until its community edition was archived and the images were withdrawn
# from Docker Hub and quay.io, leaving `docker compose up` unable to pull
# anything. Production can still point at any S3-compatible endpoint -
# see [storage] in config/oss.toml.
seaweedfs:
image: chrislusf/seaweedfs:4.48
restart: unless-stopped
command: ["mini", "-dir=/data"]
environment:
# The S3 gateway's admin identity. Without them it accepts anyone who
# can reach the port.
AWS_ACCESS_KEY_ID: "sentio-dev"
AWS_SECRET_ACCESS_KEY: "sentio-dev-secret-CHANGE_ME"
# Created at startup when absent, which is what the mc one-shot did.
S3_BUCKET: "sentio-attachments"
volumes:
- seaweedfs_data:/data
# The admin UI (:23646) is deliberately not published. Reach it with
# `docker compose port` or an ssh tunnel if you want it.
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:8333/healthz"]
interval: 5s
timeout: 3s
retries: 20
networks: [sentio_net]
# ── Content scanners ────────────────────────────────────────────────────
clamav:
image: clamav/clamav:1.5.4
restart: unless-stopped
environment:
# Signature checks per day. The image defaults to 1, which can leave the
# scanner a full day behind; the feed publishes several times daily.
FRESHCLAM_CHECKS: "24"
volumes:
- clamav_data:/var/lib/clamav
healthcheck:
test: ["CMD", "clamdcheck.sh"]
interval: 30s
timeout: 10s
retries: 20
start_period: 300s # freshclam DB download can take a while
networks: [sentio_net]
rspamd:
image: rspamd/rspamd:4.2.2
restart: unless-stopped
depends_on:
redis: { condition: service_healthy }
volumes:
- ./docker/rspamd/local.d:/etc/rspamd/local.d:ro
- rspamd_data:/var/lib/rspamd
healthcheck:
test: ["CMD", "rspamadm", "control", "stat"]
interval: 10s
timeout: 5s
retries: 10
networks: [sentio_net]
# ── One-shot: run migrations + seed bootstrap tenant + API key ──────────
sentio-migrate:
image: ghcr.io/truespar/sentio:${SENTIO_TAG:-latest}
restart: "no"
depends_on:
postgres: { condition: service_healthy }
environment:
<<: *sentio-env
command: ["--config", "/etc/sentio/oss.toml", "migrate"]
networks: [sentio_net]
# ── The application ─────────────────────────────────────────────────────
sentio:
image: ghcr.io/truespar/sentio:${SENTIO_TAG:-latest}
restart: unless-stopped
depends_on:
sentio-migrate: { condition: service_completed_successfully }
postgres: { condition: service_healthy }
redis: { condition: service_healthy }
nats: { condition: service_healthy }
seaweedfs: { condition: service_healthy }
clamav: { condition: service_healthy }
rspamd: { condition: service_healthy }
environment:
<<: *sentio-env
ports:
- "25:25" # SMTP MX (edit / remove for laptops behind NAT)
- "465:465" # SMTPS
- "587:587" # Submission (STARTTLS)
- "8080:8080" # REST API
# - "9090:9090" # Prometheus metrics - unauth; keep internal
volumes:
- sentio_data:/var/lib/sentio
# Mount your own cert bundle at /etc/sentio/tls/ to enable STARTTLS +
# implicit TLS. Without these files Sentio runs plain SMTP only.
# - ./tls:/etc/sentio/tls:ro
networks: [sentio_net]
volumes:
postgres_data:
redis_data:
nats_data:
seaweedfs_data:
clamav_data:
rspamd_data:
sentio_data:
networks:
sentio_net:
driver: bridge