Skip to main content
Version: Tryton 6.0 (LTS)

Deploy Tryton with the official Docker image

The tryton/tryton image is published by the Tryton Private Foundation. Tryton uses PostgreSQL, the image serves interactive requests, and a separate container runs trytond-cron.

Choose the right tag

  • Use tryton/tryton:6.0 to stay on the same series as this documentation. Avoid latest in production because it may move to a newer series.
  • The 6.0-office tag adds OpenDocument conversion capabilities such as PDF output.
  • Record the deployed digest for fully reproducible recovery.
  • Never mix a 6.0 server with modules from another series.

Quick evaluation

The official sequence starts PostgreSQL, initializes the database with trytond-admin, and exposes port 8000. Prefer a user-defined network over the historical --link examples:

docker network create tryton-net
docker run --name tryton-postgres --network tryton-net \
-e POSTGRES_DB=tryton -e POSTGRES_USER=tryton \
-e POSTGRES_PASSWORD='change-this-password' -d postgres:<supported-version>
docker run --rm --network tryton-net \
-e DB_HOSTNAME=tryton-postgres -e DB_PASSWORD='change-this-password' \
tryton/tryton:6.0 trytond-admin -d tryton --all
docker run --name tryton --network tryton-net -p 127.0.0.1:8000:8000 \
-e DB_HOSTNAME=tryton-postgres -e DB_PASSWORD='change-this-password' -d tryton/tryton:6.0

Open http://localhost:8000/. This is an evaluation setup, not a production deployment.

services:
postgres:
image: postgres:${PG_VERSION}
restart: unless-stopped
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: tryton
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U tryton -d ${DB_NAME}"]
interval: 10s
timeout: 5s
retries: 10

tryton:
image: tryton/tryton:6.0
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
DB_HOSTNAME: postgres
DB_NAME: ${DB_NAME}
DB_USER: tryton
DB_PASSWORD: ${DB_PASSWORD}
ports:
- "127.0.0.1:8000:8000"
volumes:
- tryton-data:/var/lib/trytond/db

cron:
image: tryton/tryton:6.0
restart: unless-stopped
depends_on:
- tryton
environment:
DB_HOSTNAME: postgres
DB_NAME: ${DB_NAME}
DB_USER: tryton
DB_PASSWORD: ${DB_PASSWORD}
volumes:
- tryton-data:/var/lib/trytond/db
command: ["trytond-cron", "-d", "${DB_NAME}"]

volumes:
postgres-data:
tryton-data:

Create a protected .env file excluded from Git:

DB_NAME=tryton
PG_VERSION=<supported-postgresql-major>
DB_PASSWORD=<generate-a-long-random-password>

Restrict permissions on .env and never commit it. On platforms with a secret manager, inject DB_PASSWORD at deployment time instead of storing it in the file.

Initialize and start

docker compose up -d postgres
docker compose run --rm tryton trytond-admin -d "$DB_NAME" --all
docker compose up -d tryton cron
docker compose ps
docker compose logs --tail=200 tryton cron postgres

Run trytond-admin --all against an existing database only after a tested backup and with the exact expected module versions.

Persistence and responsibilities

ComponentResponsibilityPersistence
postgresTransactional data and schemaPostgreSQL volume plus external backups
trytonAPI, web client, interactive workFilestore at /var/lib/trytond/db
cronScheduled Tryton jobsShares server configuration and filestore
TLS proxyHTTPS, certificates, limits, headersConfiguration and certificates

A volume is not a backup. Back up PostgreSQL consistently together with its matching filestore.

Reverse proxy and security

Bind port 8000 to 127.0.0.1 or a private network. Publish an HTTPS reverse proxy with suitable upload limits, timeouts, and proxy headers. Never expose PostgreSQL to the Internet.

Additional modules

Build a reproducible derived image for custom modules. Pin versions and preserve the series:

FROM tryton/tryton:6.0
USER root
RUN pip install --no-cache-dir \
unpaismejor-account-do==6.0.* \
unpaismejor-dgii-reports==6.0.*
# Restore the non-root user defined by the base image.

Inspect the configured user with docker image inspect tryton/tryton:6.0. Never install packages manually in a running container because recreation discards them.

Backup, restore, and upgrades

  1. Record tags, digests, modules, and configuration.
  2. Back up PostgreSQL and the matching tryton-data filestore.
  3. Encrypt and keep a copy away from the host.
  4. Restore regularly into an isolated Compose project and verify attachments, balances, and reports.
  5. Rehearse every upgrade on a production clone.
  6. Run trytond-admin -d <database> --all as a controlled one-off task.
  7. Roll back by restoring the pre-upgrade backup, never by placing old code over a migrated database.

Troubleshooting

docker compose ps
docker compose logs --since=15m tryton cron postgres
docker compose exec postgres pg_isready -U tryton -d "$DB_NAME"
docker compose run --rm tryton trytond-admin --help
docker image inspect tryton/tryton:6.0
  • Database connection fails: check service name, user, database, password, network DNS, and pg_isready.
  • Database is missing: verify initialization and database-listing configuration.
  • Menus are missing: update the module list, activate dependencies, run the update, and sign in again.
  • Cron does not run: verify it targets the same database and that another cron is not duplicating jobs.
  • Files are missing: verify the /var/lib/trytond/db mount and the database/filestore pairing.

Production checklist

  • Image tags and versions are pinned.
  • PostgreSQL and Tryton expose no unnecessary ports.
  • TLS works and secrets are absent from Git and images.
  • Server and cron share configuration, database, and filestore.
  • Resource limits, restart, health, logs, and alerts are configured.
  • PostgreSQL and filestore backups restore successfully.
  • Upgrade and restore-based rollback were rehearsed.

Sources