Separate containers for Votion, Mail and Calendar
By default one Votion container does everything: it answers the API, serves Votion itself and — on mail.<your host> and calendar.<your host> — the Mail and Calendar apps. That is the right setup for most instances, and it needs no configuration.
If you would rather run the parts on their own, Votion is also published as four separate images. Typical reasons: scale or update the API on its own, run Votion without the Mail app, or keep the web clients on a machine that has no access to the database.
The images
| Image | Contains | Port | Needs |
|---|---|---|---|
registry.gitlab.com/venturini.codes/votion/api | the API, the background jobs, the bundled plugins, the browser used for PDF export | 3000 | the database and your .env |
registry.gitlab.com/venturini.codes/votion/web | Votion's web app | 8080 | nothing |
registry.gitlab.com/venturini.codes/votion/mail | the Mail app | 8080 | nothing |
registry.gitlab.com/venturini.codes/votion/calendar | the Calendar app | 8080 | nothing |
All four carry the same tags as the all-in-one image: latest, the commit, and on a release vX.Y.Z, X.Y and X. Run the same tag for all four.
apianswers every request under/api(including the live collaboration connection at/api/collab) and runs the background work — installing the bundled plugins, automations, the cover library. It is the only one that uses the database, so it is the only one that needs the database variables,APP_KEY,WEB_ORIGINand the rest of.env, and the only one you runnode ace migration:run --forcein. It serves no web page: everything outside/apianswers404.web,mailandcalendareach hold one web client and nothing else — no API code, no other app's files. A small web server (nginx, running as an unprivileged user) answers its files and, for every other path, the app's page, so a reload or a bookmark like/trashon the Mail host opens Mail's Trash folder./apiand everything below it answer404: your reverse proxy sends those toapi. These images need no environment variables, no database and no secrets.
The all-in-one image, registry.gitlab.com/venturini.codes/votion, stays published as before. It is the one for single-container installs, and it can also be split by role — see One image, several roles below.
Which apps the instance offers
VOTION_APPS says which of the two apps your instance offers at all: a comma list of mail, calendar, or none (default: both). Set it on the api container. An app that is switched off has its sign-in refused, and the other app no longer links to it: Mail opens calendar links in Votion's own Calendar page instead of the Calendar app, and the app switcher leaves it out. Do not run that app's container either, and drop its host from your reverse proxy.
Routing
Your reverse proxy decides which container gets a request, by host name and path:
| Host | Path | Container |
|---|---|---|
| every Votion host | /api and below | api (port 3000) |
votion.example.com | everything else | web (port 8080) |
mail.votion.example.com | everything else | mail (port 8080) |
calendar.votion.example.com | everything else | calendar (port 8080) |
The /api rule must come first and must apply to the Mail and Calendar hosts too: the apps call the API on their own host name. Keep websocket upgrades enabled for /api (Caddy and Traefik do this by default; nginx needs proxy_http_version 1.1 and the Upgrade/Connection headers). Pass the original Host header through.
The client images already send the right caching headers: files under /assets/ have a content hash in their name and are cached for a year; the page itself, the service workers and the manifests are revalidated on every load, so a new version is picked up at once. They also send compressed responses (gzip) to browsers that accept them. A cache or CDN in front of them should keep these headers.
Example: Docker Compose with Caddy
Save these two files next to your .env (set up as in the self-hosting guide, plus VOTION_DOMAIN, the host of your WEB_ORIGIN, e.g. VOTION_DOMAIN=votion.example.com). Both are also available for download: docker-compose.split.yml, Caddyfile.
# Votion as separate containers: the API, the main web app, Votion Mail and
# Votion Calendar each run from their own image, behind Caddy (HTTPS
# included). Use the same tag for all four. Leave out the `mail` or
# `calendar` service — and set VOTION_APPS in .env to match — to run without
# that app.
#
# Next to this file: `.env` (see the self-hosting guide) and the `Caddyfile`
# from the same folder of the docs site. Before the first start, and after
# every upgrade:
# docker compose run --rm api node ace migration:run --force
services:
db:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- votion_db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 12
# Answers /api/* on every host and runs the background jobs. The only
# service that needs the database, APP_KEY and the rest of .env.
api:
image: registry.gitlab.com/venturini.codes/votion/api:latest
restart: unless-stopped
depends_on:
db:
condition: service_healthy
env_file:
- .env
environment:
HOST: "0.0.0.0"
PORT: "3000"
NODE_ENV: production
LOG_LEVEL: info
DB_HOST: db
DB_PORT: "5432"
volumes:
- votion_uploads:/app/storage/uploads
- votion_avatars:/app/storage/avatars
- votion_plugins:/app/storage/plugins
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:3000/api/health').then((r) => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"]
interval: 10s
timeout: 5s
retries: 5
# The web clients: each image holds one app and serves its page for
# every path (port 8080). No database, no secrets, no settings; each checks
# its own health (/healthz).
web:
image: registry.gitlab.com/venturini.codes/votion/web:latest
restart: unless-stopped
mail:
image: registry.gitlab.com/venturini.codes/votion/mail:latest
restart: unless-stopped
calendar:
image: registry.gitlab.com/venturini.codes/votion/calendar:latest
restart: unless-stopped
# The reverse proxy: /api on every host to `api`, everything else to the
# host's own app (see the Caddyfile).
caddy:
image: caddy:2
restart: unless-stopped
depends_on:
- api
- web
environment:
VOTION_DOMAIN: ${VOTION_DOMAIN}
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
volumes:
votion_db_data:
votion_uploads:
votion_avatars:
votion_plugins:
caddy_data:# Caddy in front of Votion's separate containers (docker-compose.split.yml).
# VOTION_DOMAIN is the host of WEB_ORIGIN, e.g. votion.example.com; Mail and
# Calendar live on mail.<it> and calendar.<it>. On every host, /api goes to
# the api container (collaboration's websocket at /api/collab included);
# everything else to that host's own app. Drop a block for an app you
# don't run.
{$VOTION_DOMAIN} {
handle /api* {
reverse_proxy api:3000
}
handle {
reverse_proxy web:8080
}
}
mail.{$VOTION_DOMAIN} {
handle /api* {
reverse_proxy api:3000
}
handle {
reverse_proxy mail:8080
}
}
calendar.{$VOTION_DOMAIN} {
handle /api* {
reverse_proxy api:3000
}
handle {
reverse_proxy calendar:8080
}
}Then, once and after every upgrade:
docker compose -f docker-compose.split.yml pull
docker compose -f docker-compose.split.yml run --rm api node ace migration:run --force
docker compose -f docker-compose.split.yml up -dTo run Votion without the Calendar app, delete the calendar service and its block in the Caddyfile, and add VOTION_APPS=mail to .env.
Traefik
With Traefik, give each container a router on its host and one router for the API with a higher priority, for example as labels:
api:
labels:
- "traefik.http.routers.votion-api.rule=(Host(`votion.example.com`) || Host(`mail.votion.example.com`) || Host(`calendar.votion.example.com`)) && PathPrefix(`/api`)"
- "traefik.http.routers.votion-api.priority=20"
- "traefik.http.services.votion-api.loadbalancer.server.port=3000"
web:
labels:
- "traefik.http.routers.votion-web.rule=Host(`votion.example.com`)"
- "traefik.http.services.votion-web.loadbalancer.server.port=8080"
mail:
labels:
- "traefik.http.routers.votion-mail.rule=Host(`mail.votion.example.com`)"
- "traefik.http.services.votion-mail.loadbalancer.server.port=8080"
calendar:
labels:
- "traefik.http.routers.votion-calendar.rule=Host(`calendar.votion.example.com`)"
- "traefik.http.services.votion-calendar.loadbalancer.server.port=8080"Add your entrypoints and certificate resolver as for any other service.
Health checks
The api container reports at /api/health ({"status":"ok","db":"up"}). The client images answer /healthz with 200 and check it themselves (Docker's HEALTHCHECK), so docker ps shows them as healthy without any setting in your compose file.
One image, several roles
The all-in-one image can be split too, without switching images: start it several times and tell each container what it is with VOTION_SERVE, a comma list of api, web, mail, calendar, or all (the default).
- A container with
apiworks like theapiimage above. - A container with exactly one of
web,mail,calendarserves that client's page for every path, plus its own files, and needs onlyHOST,PORT,NODE_ENVandLOG_LEVEL— no database, no secrets, noWEB_ORIGIN. It listens on the image's port 3000. - A container without
apianswers/api/...with404. A container with several clients (for exampleweb,mail) picks the client by host name, like the all-in-one container, and therefore needsWEB_ORIGIN.
An unknown name in either VOTION_SERVE or VOTION_APPS stops the container at start with an error, so a typo never starts a container that serves nothing. With the separate images you do not need VOTION_SERVE at all: each image runs one part.
Links between the apps
The Mail and Calendar apps are programs of their own: each knows only its own pages, and a path it does not know (say /p/… typed on the Mail host) opens the app's start page. Anything that belongs elsewhere opens in a new tab on the host that owns it, never inside the app: a page, a database, Home, the Trash, CRM or any other plugin opens in Votion; a calendar event opened from Mail opens in the Calendar app (or in Votion's Calendar page when the Calendar app is switched off), and the other way round. Where the browser supports it, an installed app picks up links to its own host in its own window. Votion itself is unchanged: /mail and /calendar stay its own Mail and Calendar pages.