Developer guide: deploying from the GitLab registry
This page is for the team, or anyone with read access to this GitLab project, who wants to run a specific build of Votion outside the dev Compose stack — a pinned commit, not whatever main happens to be today.
It assumes familiarity with Docker Compose and the project's own docker-compose.yml/.env.example; if you just want to run Votion without touching any of that, see the public self-hosting guide instead.
What CI publishes
.gitlab-ci.yml's publish stage builds five images from the root Dockerfile (see its header comment) and pushes them on every push to main, once lint/typecheck/test/build have all passed:
| Image | Dockerfile target | What it is |
|---|---|---|
registry.gitlab.com/venturini.codes/votion | runtime | all-in-one: API + all three web clients; what production and single-container installs run |
registry.gitlab.com/venturini.codes/votion/api | api | the API alone (bundled plugins and Chromium included, no web client) |
registry.gitlab.com/venturini.codes/votion/web | web | Votion's web client on nginx |
registry.gitlab.com/venturini.codes/votion/mail | mail | the Mail app on nginx |
registry.gitlab.com/venturini.codes/votion/calendar | calendar | the Calendar app on nginx |
The web clients are three separate Vite builds — Votion, Mail and Calendar, each with its own index.html, assets, manifest and service worker. The all-in-one image carries all three under /app/public/<client> and answers each host (or its single VOTION_SERVE client) from that client's directory only; each client image carries just its own. All five share the same build stages, so the job compiles the SPA and the API once. Before pushing anything, CI boots the all-in-one and the api image against a throwaway Postgres (migrations, /api/health, the bundled plugins' install), boots the all-in-one image as VOTION_SERVE=mail without a database and checks it serves only the Mail build, and checks that each client image serves its own page on / and on a deep link, answers 404 on /api and holds none of the other clients' files (scripts/smoke-api-image.sh, scripts/smoke-client-image.sh). Two tags land on every image on every run (shown here for the all-in-one image; the others get the same tags):
registry.gitlab.com/venturini.codes/votion:<short-sha>— pinned to the commit ($CI_COMMIT_SHORT_SHA). Prefer this one: you know exactly what you're running, and rolling back is pulling an older tag.registry.gitlab.com/venturini.codes/votion:latest— whatevermainlast published. Fine for a quick check, not for anything you want to be able to reproduce later.
To build one of them locally, from the repo root: docker build --target mail -t votion-mail . (runtime is the default target). The client targets need nothing from apps/api, so they also build on a checkout without bundled plugins.
If the push also qualifies for a release (see Releases & versioning), three more tags land on each of the five images once the release and publish-tags stages finish:
registry.gitlab.com/venturini.codes/votion:vX.Y.Z— a specific release. This is the one to pin to for anything you want reproducible by version number instead of by commit SHA.registry.gitlab.com/venturini.codes/votion:X.Y— floating, moves to the newest patch in that minor line.registry.gitlab.com/venturini.codes/votion:X— floating, moves to the newest release in that major line.
A docs-only or chore-only push produces neither a release nor these three tags — only the short-SHA and latest tags above.
The all-in-one and api images carry the bundled plugins' web bundles: the Dockerfile's web-plugins stage runs npm run build:plugins after the SPA build, so every bundled plugin with a web/src/ ships its built web/dist/entry.js, and CI fails the publish if one is missing. Nothing to do on the server; a plugin's browser code always matches the image.
The registry is this GitLab project's own container registry and is currently private — only a token with registry read access can pull from it.
1. Log in to the registry
Create a deploy token (project Settings → Repository → Deploy tokens, scope read_registry) or use a personal access token with the same scope, then:
docker login registry.gitlab.com -u <token-username> -p <token>Keep the token out of any committed file — shell history or a local, gitignored .env only.
2. Pull a pinned build
Find the short SHA you want (the GitLab project's Commits list, or git rev-parse --short HEAD on main locally), then:
docker pull registry.gitlab.com/venturini.codes/votion:<short-sha>3. Minimal production compose file
The image serves the compiled API and the built SPA from one process on port 3000 — no dev bind-mounts, no Mailpit, no Vite dev server. Only a database and this one app service are needed:
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
app:
image: registry.gitlab.com/venturini.codes/votion:<short-sha>
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"
ports:
- "3000:3000"
volumes:
- votion_uploads:/app/storage/uploads
- votion_avatars:/app/storage/avatars
# Installed plugin code: a named volume for the same reason as
# uploads/avatars above. Not strictly required for a bundled plugin
# (e.g. Daily Notes) to work — it's re-copied fresh from the image's
# own plugins-bundled/ on every boot — but without it any
# admin-installed (zip-upload) plugin is silently wiped on every
# redeploy/recreate. Bundled plugins' web bundles are served from
# the image (plugins-bundled/<id>/web/dist), not from this volume.
- votion_plugins:/app/storage/plugins
volumes:
votion_db_data:
votion_uploads:
votion_avatars:
votion_plugins:Put a real TLS-terminating reverse proxy in front of this (the way legion runs it with Traefik — see the root README.md); the image itself only speaks plain HTTP on 3000, same as the dev api service does inside the Compose network.
4. Environment variables
Copy the repo's .env.example next to this compose file as .env and fill it in — its comments document every variable. The ones that matter for a first boot:
| Variable | Notes |
|---|---|
POSTGRES_DB / POSTGRES_USER / POSTGRES_PASSWORD | match what db above creates on first init |
APP_KEY | required; see below |
ADMIN_EMAIL / ADMIN_PASSWORD | optional — bootstraps one admin account with its own workspace on first boot |
ALLOW_REGISTRATION | false by default: new accounts need an admin-minted invite |
VOTION_SERVE | unset = everything in one container; api, web, mail, calendar (comma list) split them — see Separate containers |
VOTION_APPS | standalone apps the instance offers: mail, calendar (default both) or none |
Generate APP_KEY from the same image before first boot:
docker run --rm registry.gitlab.com/venturini.codes/votion:<short-sha> node ace generate:key --showPaste the output into .env as APP_KEY=... and keep it stable across restarts — rotating it invalidates every existing session and signed link.
5. Run the migration, then start the stack
AdonisJS/Lucid refuses to run migrations in NODE_ENV=production without an explicit --force, as a guard against an accidental run:
docker compose run --rm app node ace migration:run --force
docker compose up -dRun the same migration:run --force again after pulling any later tag that changes the schema, before restarting app on it.
6. Verify
curl http://127.0.0.1:3000/api/health
# {"status":"ok","db":"up"}Rolling back
Pull the older pinned tag and docker compose up -d app again. Lucid migrations are forward-only by default; undoing a schema change needs node ace migration:rollback against the specific migration, not just redeploying an older image — check what that migration actually does before rolling it back on a database with real data in it.
Pulling and running the docs image standalone
The docs site (apps/docs, VitePress) publishes as its own image, on its own registry path — it has no database and nothing to migrate, so it's simpler than the app image above:
registry.gitlab.com/venturini.codes/votion/docs:<short-sha>
registry.gitlab.com/venturini.codes/votion/docs:latestSame publish CI stage, same tagging scheme as the app image (short-SHA, latest, and vX.Y.Z/X.Y/X once a release is cut) — see "What CI publishes" above; just swap in the /docs path.
Pull and run it directly; there is no .env, no database, and no migration step:
docker pull registry.gitlab.com/venturini.codes/votion/docs:<short-sha>
docker run -d --name votion-docs --restart unless-stopped \
-p 8080:8080 \
registry.gitlab.com/venturini.codes/votion/docs:<short-sha>
curl http://127.0.0.1:8080/Put the same TLS-terminating reverse proxy in front of this as the app image (see "3. Minimal production compose file" above) — the image itself only speaks plain HTTP on 8080. Run it as a docs service next to the app and route docs.<your host> to it, the same way this repo's own docker-compose.yml routes docs.votion.legion to the dev docs container.