The multi-tenant edition starts. compose.multi.yaml runs several copies behind Caddy, with the managed Postgres and Garage outside. A test walks every page and fragment, with ids filled in, and every MCP tool, as one team, and none shows another team's data or changes it; another has three copies share six teams' work, each team's turn once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
2.9 KiB
YAML
80 lines
2.9 KiB
YAML
# Supermarket's multi-tenant edition: many teams at one address, each
|
|
# working on its own domain, with its data in its own Postgres schema.
|
|
# Several copies of the app run behind Caddy; Postgres and the object
|
|
# storage are outside (the cloud's managed Postgres, and Garage), named in
|
|
# multi.env:
|
|
#
|
|
# docker compose -f compose.multi.yaml --env-file multi.env up -d --build
|
|
#
|
|
# multi.env holds:
|
|
# SUPERMARKET_DOMAIN the address people open, e.g. app.example.com
|
|
# SUPERMARKET_DATABASE_URL postgres://…; its user needs CREATEROLE
|
|
# SUPERMARKET_SECRET_KEY supermarket secret-key makes one: keep a copy
|
|
# SUPERMARKET_MAIL_URL smtp://… or smtps://…
|
|
# SUPERMARKET_STORAGE s3://bucket/prefix
|
|
# SUPERMARKET_S3_ENDPOINT https://… (Garage's S3 API)
|
|
# SUPERMARKET_S3_ACCESS_KEY, SUPERMARKET_S3_SECRET_KEY
|
|
# SUPERMARKET_PLATFORM_ADMINS the platform admins' emails, comma-separated
|
|
# SUPERMARKET_COPIES how many copies of the app (default 3)
|
|
name: supermarket-multi
|
|
|
|
services:
|
|
supermarket:
|
|
build:
|
|
context: .
|
|
args:
|
|
VERSION: ${SUPERMARKET_VERSION:-dev}
|
|
image: supermarket:multi
|
|
restart: unless-stopped
|
|
init: true
|
|
user: "10001:10001"
|
|
deploy:
|
|
replicas: ${SUPERMARKET_COPIES:-3}
|
|
environment:
|
|
SUPERMARKET_MODE: multi
|
|
SUPERMARKET_PUBLIC_URL: https://${SUPERMARKET_DOMAIN:?}
|
|
SUPERMARKET_DATABASE_URL: ${SUPERMARKET_DATABASE_URL:?}
|
|
SUPERMARKET_SECRET_KEY: ${SUPERMARKET_SECRET_KEY:?}
|
|
SUPERMARKET_MAIL_URL: ${SUPERMARKET_MAIL_URL:?}
|
|
SUPERMARKET_MAIL_FROM: ${SUPERMARKET_MAIL_FROM:-}
|
|
SUPERMARKET_STORAGE: ${SUPERMARKET_STORAGE:?}
|
|
SUPERMARKET_S3_ENDPOINT: ${SUPERMARKET_S3_ENDPOINT:?}
|
|
SUPERMARKET_S3_REGION: ${SUPERMARKET_S3_REGION:-garage}
|
|
SUPERMARKET_S3_ACCESS_KEY: ${SUPERMARKET_S3_ACCESS_KEY:?}
|
|
SUPERMARKET_S3_SECRET_KEY: ${SUPERMARKET_S3_SECRET_KEY:?}
|
|
SUPERMARKET_PLATFORM_ADMINS: ${SUPERMARKET_PLATFORM_ADMINS:-}
|
|
TZ: ${SUPERMARKET_TZ:-UTC}
|
|
# Scratch only (sites' clones, previews): everything a request needs is
|
|
# in Postgres, and files are in the object storage, so any copy can
|
|
# answer any request.
|
|
tmpfs:
|
|
- /data:uid=10001,gid=10001,mode=0700
|
|
- /tmp
|
|
read_only: true
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
|
|
caddy:
|
|
image: caddy:2-alpine
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${SUPERMARKET_HTTP_PORT:-80}:80"
|
|
- "${SUPERMARKET_HTTPS_PORT:-443}:443"
|
|
- "${SUPERMARKET_HTTPS_PORT:-443}:443/udp"
|
|
environment:
|
|
SUPERMARKET_DOMAIN: ${SUPERMARKET_DOMAIN:?}
|
|
SUPERMARKET_ACME: ${SUPERMARKET_ACME:-}
|
|
SUPERMARKET_TLS: ${SUPERMARKET_TLS:-}
|
|
volumes:
|
|
- ./server/Caddyfile.multi:/etc/caddy/Caddyfile:ro
|
|
- ./server/certs:/certs:ro
|
|
- caddydata:/data
|
|
- caddyconfig:/config
|
|
depends_on: [supermarket]
|
|
|
|
volumes:
|
|
caddydata:
|
|
caddyconfig:
|