{"id":2021,"date":"2025-03-03T19:13:48","date_gmt":"2025-03-03T18:13:48","guid":{"rendered":"https:\/\/hobbykeller.spdns.de\/?p=2021"},"modified":"2025-03-03T19:13:48","modified_gmt":"2025-03-03T18:13:48","slug":"upgrading-tryton-docker-stacks","status":"publish","type":"post","link":"https:\/\/hobbykeller.spdns.de\/?p=2021","title":{"rendered":"Upgrading Tryton Docker Stacks"},"content":{"rendered":"\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-info\" role=\"alert\">These instructions are based on the <a href=\"https:\/\/hub.docker.com\/layers\/tryton\/tryton\/7.0\/images\/sha256-9947ef6cb677b7e29d7432572b6328caae0bb4f72554066fe58ea9e15c55b6e0\">tryton\/tryton:7.0 Docker image<\/a>, which is upgraded to the tryton\/tryton:7.2 Docker image. (There are no Docker images for Tryton 7.1 available)<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">\u00d7<\/span><\/button><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Make volume backups<\/h2>\n\n\n\n<p>As the upgrade procedure (potentially) involves modifications on the database, it is <a href=\"https:\/\/docs.tryton.org\/latest\/server\/topics\/setup_database.html#update-a-database\">recommended to backup<\/a> the Docker volumes of our Tryton stack. We therefore use the loomchild\/backup Docker. In my case, there are two Docker volumes dedicated to Tryton:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>tryton_data<\/code> (which is an empty volume)<\/li>\n\n\n\n<li><code>tryton_db<\/code> (which holds anything related to the PostgreSQL database)<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -v tryton_db:\/volume --rm --log-driver none loomchild\/volume-backup backup - > tryton\/tryton_db.tar.bz2\n\ndocker run -v tryton_data:\/volume --rm --log-driver none loomchild\/volume-backup backup - > tryton\/tryton_data.tar.bz2\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Manual preparations in the existing database<\/h2>\n\n\n\n<p>The Tryton database documentation recommends to check the <a href=\"https:\/\/docs.tryton.org\/latest\/migration.html\">release migration page<\/a> if there are manual preparations to perform prior to the upgrade. Indeed the record for version 7.2 shows a couple of SQL commands to use NULL values instead of empty foreign keys. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ilek@i5:~\/docker\/tryton$ docker compose up --detach postgres\nilek@i5:~\/docker\/tryton$ docker exec -it tryton-postgres-1 bash<\/code><\/pre>\n\n\n\n<p>Now inside the container connect to the <code>psql<\/code> prompt (assuming our Tryton database has the name <code>tryton_db<\/code> and the dedicated Tryton database user has the name <code>tryton_db_user<\/code>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@b2dc5b761016:\/# psql -d tryton_db -U tryton_db_user<\/code><\/pre>\n\n\n\n<p>Now we can perform the manual preparations as shown on the release migration page (we can copy and paste the complete block of commands and execute it in one shot). Before updating from Tryton 7.0 to Tryton 7.2:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tryton_db=# UPDATE \"ir_ui_view\" SET \"model\" = NULL WHERE \"model\" = '';\nUPDATE \"ir_action_act_window\" SET \"res_model\" = NULL WHERE \"res_model\" = '';\nUPDATE \"ir_action_wizard\" SET \"model\" = NULL WHERE \"model\" = '';\nUPDATE \"ir_action_report\" SET \"model\" = NULL WHERE \"model\" = '';\nUPDATE \"ir_action_report\" SET \"module\" = NULL WHERE \"module\" = '';\nUPDATE \"ir_translation\" SET \"module\" = NULL WHERE \"module\" = '';<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Pull the 7.2 Docker image<\/h2>\n\n\n\n<p>We first stop any Docker container of the 7.0 Tryton stack:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ilek@i5:~\/docker\/tryton$ docker compose down<\/code><\/pre>\n\n\n\n<p>Then edit the .env file of the Docker stack to bump the version tag from 7.0 to 7.2:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TRYTON_TAG=<strong>7.2<\/strong>\nPOSTGRES_VERSION=16\nPOSTGRES_DB=tryton_db\nPOSTGRES_USER=tryton_db_user\nPOSTGRES_PASSWORD=&lt;removed>\nEMAIL_FROM=&lt;removed><\/code><\/pre>\n\n\n\n<p>To be on the safe side we check with <code>docker ps -a<\/code> if there are any &#8220;stale&#8221; Tryton containers which have just been stopped but not removed. If so, we remove them with <code>docker container rm ...<\/code><\/p>\n\n\n\n<p>Now we are ready to relaunch our 7.2 Tryton stack. If all went according to plan, Docker should start with pulling the new image. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ilek@i5:~\/docker\/tryton$ docker compose up -d<\/code><\/pre>\n\n\n\n<p>Finally we have to replace our Tryton 7.0 desktop client against a Tryton 7.2 client.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ilek@i5:~\/docker\/tryton$ flatpak remove org.tryton.Tryton-70\nilek@i5:~\/docker\/tryton$ sudo flatpak install flathub org.tryton.Tryton-72<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Step 1: Make volume backups As the upgrade procedure (potentially) involves modifications on the database, it is recommended to backup the Docker volumes of our Tryton stack. We therefore use<span class=\"more-button\"><a href=\"https:\/\/hobbykeller.spdns.de\/?p=2021\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Upgrading Tryton Docker Stacks<\/span><\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[374,64],"tags":[338,377,379,375],"class_list":["post-2021","post","type-post","status-publish","format-standard","hentry","category-erp","category-linux","tag-docker","tag-erp","tag-loomchild-backup","tag-tryton"],"_links":{"self":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/2021","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2021"}],"version-history":[{"count":4,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/2021\/revisions"}],"predecessor-version":[{"id":2025,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/2021\/revisions\/2025"}],"wp:attachment":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}