Site Overlay

Installing Tryton as a Docker stack

This post kicks of a new series on the Tryton FOSS ERP system. Today’s quick post is about installing Tryton as a docker stack. As usual, the most tricky part is to come up with a functioning docker-compose.yml file.

Useful resources

Most online documentations I came across are geared towards running Tryton as separate Docker containers via the docker run command rather than as a stack via docker compose. Even the instructions for the tryton/tryton repository on the Docker hub are quite thin-lipped when it comes to docker compose. The reader is mainly referred to a sample compose.yml file which I could not get working.

The best point to start from I could find is a docker-compose.yml file from the tryton-docker-compose repo on GitHub by user Chris927, which again was forked from Eric Hemmerlin’s tryton repo on GitHub.

Step by step installation

1. Prepare a docker-compose.yml file

This is by far the most important step. As already mentioned, we start from the template provided by GitHub user Chris927. The things we modify are:

Warning messages issued by postgres service

The command for running the healthcheck test of the postgres service produces a series of debug messages Fatal: role "root" does not exist. The reason these warnings pop up is that the following line fails:

There is a discussion on how to appropriately expand environment variables in docker YAML files (not sure if it’s only related to the healthcheck feature or a general problem). The suggestion which solved the issue for me was to change the line as follows:

Removal of mailhog service

I don’t know much about the purpose of the mailhog service which is included in the original compose file. On its GitHub page, mailhog is – among others – described as an “email testing tool for developers”.

As our aim is to come up with a dockerized Tryton for production and not for development purposes and as for the time being, there is no evidence of an extensive need for operating SMTP services out of Tryton, I removed the complete mailhog section from the services list of the docker-compose.yaml file.

2. Prepare the .env file

While most environment variables in the docker-compose.yml file come with a default value, it looks reasonable to set some values in the .env file:

3. Set up the admin user

Note that the POSTGRES_USER and POSTGRES_PASSWORD in the above .env file are the credentials for the admin superuser of the Postgres database. They don’t have anything to do with the Tryton user authentication and authorization.

Start the docker stack by running docker compose up -d.

From the directory holding the docker-compose.yml file, execute trytond-admin to set the Tryton login password for the admin user:

  • tryton_chris972-app-1 is the name of the Tryton container running the main Tryton app.
  • -d tryton specifies the name of the Tryton database as set in the POSTGRES_DB variable in the .env file.

You will be asked to set a password for the Tryton superuser admin and confirm the password.

4. Initial login into Tryton as admin

The only combination of credentials that allow a login after a fresh installation are for user admin and with the password you just set in step 3.

Initial login screen of Tryton after a fresh install

After entering the password in the next window, Tryton will walk you through a basic setup of your ERP. This however will be covered in a later blog post.

Having a closer look at the PostgreSQL database

You can access the PostgreSQL database directly from the command line with the following command:

  • tryton_chris972_postgres-1 is the name of the container running the PostgreSQL server
  • -d tryton is the Tryton database as specified in the POSTGRES_DB variable of your .env file
  • -U ilek is the PostgreSQL admin user as specified in the POSTGRES_USER variable of your .env file. Once again: The POSTGRES_USER is the superuser of the PostgreSQL server. It does not refer to any user that can log into the Tryton system.

Is it possible to run Tryton on a Raspberry Pi?

Running Tryton on a Raspberry Pi machine would require an image that has been compiled for the Raspberry’s ARM architecture. While there are some ARM images on the Docker hub, these are inofficial builds with sparse to non-existant maintenance and outdated versions. I would therefore not recommend to run Tryton on such a machine.