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:8.0to stay on the same series as this documentation. Avoidlatestin production because it may move to a newer series. - The
8.0-officetag adds OpenDocument conversion capabilities such as PDF output. - Record the deployed digest for fully reproducible recovery.
- Never mix a 8.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:8.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:8.0
Open http://localhost:8000/. This is an evaluation setup, not a production deployment.
Recommended Compose 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:8.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:8.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
| Component | Responsibility | Persistence |
|---|---|---|
postgres | Transactional data and schema | PostgreSQL volume plus external backups |
tryton | API, web client, interactive work | Filestore at /var/lib/trytond/db |
cron | Scheduled Tryton jobs | Shares server configuration and filestore |
| TLS proxy | HTTPS, certificates, limits, headers | Configuration 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:8.0
USER root
RUN pip install --no-cache-dir \
unpaismejor-account-do==8.0.* \
unpaismejor-dgii-reports==8.0.*
# Restore the non-root user defined by the base image.
Inspect the configured user with docker image inspect tryton/tryton:8.0. Never install packages manually in a running container because recreation discards them.
Backup, restore, and upgrades
- Record tags, digests, modules, and configuration.
- Back up PostgreSQL and the matching
tryton-datafilestore. - Encrypt and keep a copy away from the host.
- Restore regularly into an isolated Compose project and verify attachments, balances, and reports.
- Rehearse every upgrade on a production clone.
- Run
trytond-admin -d <database> --allas a controlled one-off task. - 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:8.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/dbmount 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.