Skip to content

Install dmsforall on a server

This page covers an installation on a server. The Quick start gives the short version for localhost.

At the end of this page, the stack runs on your server, and you have checked that it answers.

  • Docker Engine and Docker Compose v2.
  • For HTTPS on a domain: a DNS name that points to the server, and ports 80 and 443 open to the Internet.
  • Disk space for the PostgreSQL data, the backups and the uploaded documents.

Copy .env.example to .env and edit the values you need. Every setting is documented in the file and in the configuration reference. The most common ones are:

VariableDefaultEffect
DFA_SITE_ADDRESShttp://localhostAddress of the site. Set a domain name to get HTTPS.
DFA_PUBLIC_URLhttp://localhost:8080Public address that users type in the browser. Must match the site address.
DFA_HTTP_PORT8080Host port for HTTP.
DFA_HTTPS_PORT8443Host port for HTTPS.
DFA_VERSIONlatestImage version to run.
DFA_TRUST_PROXY_HOPS1Number of reverse proxies in front of the API.

The database passwords are not in the file. The init-secrets service generates them on the first start and keeps them in the dfa_secrets volume.

When DFA_SITE_ADDRESS is a domain name, Caddy obtains and renews a Let’s Encrypt certificate by itself. Ports 80 and 443 must reach the server.

ServiceRole
proxyCaddy. Publishes the HTTP and HTTPS ports and routes requests.
webThe web interface.
apiThe API. Not published.
workerBackground jobs, from the same image as the API.
migrateApplies the database migrations before the API starts.
postgresPostgreSQL 16. Not published.
redisRedis. Not published.
init-secretsGenerates the database passwords once.

PostgreSQL and Redis are never published on a host port.

  • --profile ocr: starts the image ghcr.io/selfhostr/dmsforall-ocr, which reads vehicle registration documents. This profile has not been started yet.
  • --profile backup: starts the nightly encrypted backups. It needs AGE_CLE_PUBLIQUE in .env. See Back up and restore.
Terminal window
docker compose --profile backup up -d

To build the images from the repository instead of pulling them:

Terminal window
docker compose -f docker-compose.yml -f docker-compose.build.yml up -d --build
Terminal window
docker compose ps
curl -s http://localhost:8080/api/v1/sante

Replace localhost:8080 with your domain for a server. Expected result: postgres and redis are healthy, migrate has exited without error, api and worker are running, and the health endpoint returns a JSON document.