I am trying to update tryton from the very old version 3.6 to the latest version available (7.4.3 at the moment). I did the manual migration steps listed in [1] up to version 6.2.
I am able to run trytond 6.2 with an empty database. But trying to get it running with the existing database seems not to work until now. For trytond I am using docker-compose.
My question now is: What additional steps are necessary for migrating the database? Is there something obvious that I did wrong? Whats the best way to get debug logging from trytond? Is it necessary to have all modules installed?
Welcome @looooo,
IMHO the best would be to proceed all steps up to 7.0.0 our LTS or 7.4 the latest release. After this it would be good to provide us your error messages when running Tryton. This way we can step by step solve your migration problems.
The steps you found in [1] are usually necessary. But not all steps may be related to your setup.
I don’t see any mistakes so far.
run verbose trytond -v
or -vvv
, works also with trytond-admin
.
Yes, otherwise you’ll get dependency errors. Usually you can deactivate modules in the client menu Administration --> Modules --> Modules
form view of the module, which is no longer available. This must be done with the latest Tryton version which support the module.
Also custom modules could produce problems, if they are not migrated correctly.
HIH
Thanks for the fast response @udono. Good to know that this task is not impossible.
The reason why I wanted to update to 6.2 first is that I need to use the trytond-console to upgrade to newer versions of tryton (see [1]). It was obvious to me that I first need to have trytond6.2 running before I can make this step. Is this conclusion wrong? Is it also possible to do this modification of the database with newer versions of trytond too?
I try to follow the hints you gave and update the status of my project here. Thanks again for the help.
Another thing I would like to mention:
We are using some custom modules in our company. Mainly one module specific for the company, reports, stock, template, trytond-report-webkit. I guess reports, stock, template, trytond-report-webkit are forks from the official repos and contain some modifications. The problem is that I do not have information about what is changed in these modules, so I tried to update them to work with python3, but for sure this is not done yet…
My question regarding these modules is:
If I use the official docker-container for trytond, do I simply have to add these modules into the modules directory to make them install and work with trytond?
I tried to run tryton6.2 with the modules again and see this if I am trying to connect via tryton6.2:
tryton.jsonrpc.Fault: relation "ir_module" does not exist
LINE 1: SELECT "a"."name" FROM "ir_module" AS "a" WHERE ("a"."state"...
seems like a module is missing?
when I try to connect via localhost:8000 I see the login screen but I cannot select a database.
after running
trytond-admin -c trytond.conf --all
I see another issue:
tryton.jsonrpc.Fault: File not found : /usr/local/lib/python3.9/dist-packages/trytond/modules/reports/tryton.cfg
the tryton.cfg is listed in the module. Maybe it wasn’t copied during the install. But I am guessing. I do not know how the installation of the module works with tryton/docker-compose.
This script must be run after so you can run it after your upgraded to 7.0 or 7.4.
But it is probably safest to go from LTS series to LTS series when doing such upgrade jump of 10 years.
You should first have your custom module working on your target environment before starting the upgrade process.
You must create a derivative image and install the custom module as it may have specific requirements.
Some years ago we renamed the table ir_module_module
into ir_module
but I think this automate migration has been removed in 6.2
.
We drop integrated automate migration after 2 LTS so 6.0
should no more have migration from before 4.0
.
For the record, I added with Clean migrations for series before 6.0 (!2121) · Merge requests · Tryton / Tryton · GitLab a comment about jumping more than 2 LTS series.
Thanks @cedric.
So if I got it right, I need to go from 3.6 to 4.x to 6.x to 7.x. Then I need to create my own docker-file to install the modules properly. Is this correct?
If I do the migration from 3.6 to 4.x is it better to use python3.5 or python2.7 for the 4.x version?
Or you could upgrade from 3.6 to 5.0 to 7.0.
As you do not seem to upgrade frequently, I would avoid non LTS series.
Yes, you can find an example on Dockerfile · branch/default · DISTILIBRE / DISTILIBRE · GitLab
Go for 5.0 this would avoid the need to use Python2.
Thanks for the clarification. So I tried to do the migration from 3.6 → 5.0.
- I based the docker-file on ubuntu 18.04 as there python 3.6 is the standard python3 interpreter.
# Basis-Image
FROM ubuntu:18.04
# Aktualisiere Paketlisten und installiere grundlegende Werkzeuge
RUN apt update && apt upgrade -y
RUN apt install -y python3
RUN apt install -y python3-pip
RUN DEBIAN_FRONTEND=noninteractive apt install -y python3-lxml slapd ldap-utils
RUN apt install -y libcairo2 libpango-1.0-0 libpango1.0-dev libgdk-pixbuf2.0-0 libffi-dev fonts-liberation python3-dev python3-psycopg2 python3-pil
RUN pip3 install relatorio genshi python-dateutil polib python-sql markdown2
RUN pip3 install trytond==5.0
ADD log_prod.conf /etc/tryton_log.conf
RUN mkdir -p /var/lib/trytond
ADD module /root/module
# installiere module
RUN pip3 install --no-cache-dir \
/root/module/trytond-report-webkit \
/root/module/stock \
/root/module/template \
/root/module/reports
-
create the dokcer-image with
docker build -t trytond_50 .
-
do the manual migration by starting a postgresql docker container and dump the database as a dump.sql
-
run docker compose with this configuration:
version: '3.9'
services:
db:
image: postgres:latest
container_name: tryton_db
ports:
- "5432:5432"
volumes:
- ./init:/docker-entrypoint-initdb.d
- ./data:/custom_pgdata
env_file:
- .env
trytond:
image: trytond_50
container_name: trytond
depends_on:
- db
ports:
- "8000:8000"
volumes:
- ./trytond.conf:/etc/tryton/trytond.conf
environment:
- TRYTOND_LOGGING_LEVEL=DEBUG
command: trytond --config /etc/tryton/trytond.conf -vvv
- trying to access localhost:8000
this is currently failing. withcurl -v localhost:8000
I get
curl: (56) Recv failure: Connection was reset by the peer
maybe you see some obvious mistakes I made with the configuration.
the logs of trytond and tryton_db container show this:
trytond:
INFO trytond.config using /etc/tryton/trytond.conf as configuration files
DEBUG passlib.utils.compat loaded lazy attr 'SafeConfigParser': <class 'configparser.ConfigParser'>
DEBUG passlib.utils.compat loaded lazy attr 'NativeStringIO': <class '_io.StringIO'>
DEBUG passlib.utils.compat loaded lazy attr 'BytesIO': <class '_io.BytesIO'>
DEBUG passlib.registry registered 'scrypt' handler: <class 'passlib.handlers.scrypt.scrypt'>
DEBUG passlib.registry registered 'pbkdf2_sha512' handler: <class 'passlib.handlers.pbkdf2.pbkdf2_sha512'>
INFO trytond.modules ir:registering classes
INFO trytond.modules res:registering classes
INFO trytond.modules country:registering classes
INFO trytond.modules currency:registering classes
INFO trytond.modules ldap_authentication:registering classes
INFO trytond.modules tests:registering classes
INFO trytond.modules party:registering classes
INFO trytond.modules company:registering classes
INFO trytond.modules account:registering classes
INFO trytond.modules product:registering classes
INFO trytond.modules report_webkit:registering classes
INFO trytond.modules account_product:registering classes
INFO trytond.modules stock:registering classes
INFO trytond.modules account_invoice:registering classes
INFO trytond.modules account_invoice_stock:registering classes
INFO trytond.modules sale:registering classes
INFO trytond.modules reports:registering classes
1 131340205188928 [2025-01-05 12:01:50,305] WARNING py.warnings /usr/local/lib/python3.6/dist-packages/PyPDF2/__init__.py:23: DeprecationWarning: PyPDF2 is deprecated. Please move to the pypdf library instead.
category=DeprecationWarning,
INFO trytond.modules template:registering classes
INFO trytond.modules <company>:registering classes
INFO werkzeug * Running on http://localhost:8000/ (Press CTRL+C to quit)
tryton_db:
LOG: starting PostgreSQL 17.2 (Debian 17.2-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
LOG: listening on IPv4 address "0.0.0.0", port 5432
LOG: listening on IPv6 address "::", port 5432
LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
LOG: database system was shut down at 2025-01-05 11:43:55 UTC
LOG: database system is ready to accept connections
LOG: checkpoint starting: time
LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.005 s, sync=0.004 s, total=0.012 s; sync files=2, longest=0.003 s, average=0.002 s; distance=0 kB, estimate=0 kB; lsn=0/1A8ED710, redo lsn=0/1A8ED6B8
We do not you reuse the existing image: https://hub.docker.com/layers/tryton/tryton/5.0/images/sha256-32b7e910ff64126be1e9a27d8f30a9cf4c79ae39977a27d1cd5ba697fada3164
Also why using docker image to perform the migration?
I personally find it simpler to perform the upgrade locally using a virtual env and use docker image only for deployment.
I know some people want to use docker for development, but for me it is an extra complication for no benefit.
Also why using docker image to perform the migration?
good question, I would like to avoid docker also. But I am new to tryton, so I reused existing things as much as possible.
You did not install the web client sao which is a good reason to use official docker image as basis.
using the official docker image (tryton/tryton:5.0) and further simplifying the docker-file:
# Basis-Image
FROM tryton/tryton:5.0
ADD log_prod.conf /etc/tryton_log.conf
RUN mkdir -p /var/lib/trytond
ADD module /root/module
# installiere module
RUN pip3 install --no-cache-dir \
/root/module/trytond-report-webkit \
/root/module/stock \
/root/module/template \
/root/module/reports \
/root/module/<company>
When i build the image I get an error while installing the extra modules:
Invalid requirement: '/root/module/trytond-report-webkit'
It looks like a path. File '/root/module/trytond-report-webkit' does not exist.
but the trytond-report-webkit directory should be there. Maybe trytond-report-webkit is already installed by the base image?
This is not a standard module.
This looks more like the directory is not a valid project directory.
It’s strange, as this was not a problem with ubuntu18:04 based image.
The problem was that I specified version 5.0 in the tryton.cfg of the modules. But the setup.py expected 3 numbers. So I set it to 5.0.33 and installed some additional packages via apt. Now the dockerfile builds.
Trying to connect via localhost:8000 I see the login screen but I cannot select a database (There is no database listed)
Trying to connect with the tryton-client (version 5.0.33) I see this error:
ERROR:tryton.common.common:Traceback (most recent call last):
File "/home/lorenz/.pixi/envs/tryton/lib/python3.6/site-packages/tryton/gui/main.py", line 275, in do_activate
common.Login()
File "/home/lorenz/.pixi/envs/tryton/lib/python3.6/site-packages/tryton/common/common.py", line 998, in __init__
func(parameters)
File "/home/lorenz/.pixi/envs/tryton/lib/python3.6/site-packages/tryton/rpc.py", line 87, in login
result = connection.common.db.login(username, parameters, language)
File "/home/lorenz/.pixi/envs/tryton/lib/python3.6/xmlrpc/client.py", line 1112, in __call__
return self.__send(self.__name, args)
File "/home/lorenz/.pixi/envs/tryton/lib/python3.6/site-packages/tryton/jsonrpc.py", line 286, in __request
raise Fault(*response['error'])
tryton.jsonrpc.Fault: <Fault "type object 'product.template' has no attribute 'category'":
category for product.template was removed with version 4.0. I guess this explains the error.
I am now in the process of updating the custom modules, but this seems to be very annoying when done with docker:
- modify modules
- dokcer build -t tryton_50 .
- docker.compose up -d
Would be nice to link the module directory into the docker container and install the modules with pip install -e <module>
. But I get errors like:
OSError: File not found : /usr/local/lib/python3.7/dist-packages/trytond/modules/report_webkit/tryton.cfg
so I am not sure if an editable install is supported.
you can try to make the /usr/local/lib/python3.7/dist-packages/trytond/modules/
dir a volume and symlink the modules into the directory to run the modules from source.