Upgrade Guide 7.1.0 to 7.2.1
If you are upgrading from version 7.0.0 you must upgrade to version 7.1.0 first!
Important Note
Backup Your Data Before Proceeding!
Moreover, this guide assumes that the steps below are executed in one session.
If the session is interrupted (e.g. due to a logout) then the passwords need to
be re-export
ed in given order. Only then, the upgrade procedure can be
continued at an intermediate step without receiving errors.
Acceptance Testing
Before upgrading your production instance we encourage you to exercise the upgrade scenario on your acceptance testing instance.
Shutting down 21Travel services
Enter the following to shut down 21Travel services.
The passwords assigned to the environment variables below have been chosen
during initial deployment. The
export
statements can be omitted in case an .env
file is used.
cd 21-travel-deployment
export POSTGRES_PASSWORD=secret_password_1
export AUTOD_DB_PW=secret_password_2
export AOPD_DB_PW=secret_password_3
export TRPD_DB_PW=secret_password_4
export KEYCLOAK_DB_PW=secret_password_5
export KEYCLOAK_ADMIN=your_keycloak_admin_username
export KEYCLOAK_ADMIN_PASSWORD=secret_password_6
docker compose down
Obtaining the 7.2.1 deployment environment
To obtain the 7.2.1 deployment environment enter the following.
git fetch origin
git rebase 7.2.1
If you get stuck during the rebase you can restore your previous state by entering the following.
git rebase --abort
If you would like to switch to the 7.2.1 deployment environment discarding your
custom changes (e.g. domain names in Caddyfile
) then enter the following.
git fetch origin
git reset --hard 7.2.1
# add necessary changes to Caddyfile
nano Caddyfile
git commit -m "Caddyfile: adjusted domain names" Caddyfile
Modifying the Audit Logs Table
Version 7.2.1 has introduced an additional column in the audit logs database table. Due to its append-only nature, the table cannot be extended through normal database migrations, and has to be modified manually as follows.
Add Keycloak ID column to Audit Logs Table
docker compose up -d postgres
docker exec -i -e PGUSER=postgres -e PGDATABASE=21travel postgres psql <<EOF
ALTER TABLE autod.audit_logs ADD COLUMN keycloak_id TEXT NOT NULL DEFAULT 'n/a';
ALTER TABLE autod.audit_logs ALTER COLUMN keycloak_id DROP DEFAULT;
\q
EOF
Remove Unknown User in Custodial Data Table
It is important to make sure that none of sent_transactions is originated from Unknown User. To check this execute following SQL against trpd database (assuming Postgres is already running):
docker exec -i -e PGUSER=postgres -e PGDATABASE=21travel postgres psql <<EOF
DELETE FROM trpd.custodial_data WHERE first_name = 'Unknown' AND last_name = 'User';
\q
EOF
If the deletion fails due to foreign key constraint
(ERROR: update or delete on table "custodial_data" violates foreign key constraint
),
open a support ticket for a migration guidance to remove the 'Unknown User'
entries. Nevertheless, you should continue with the upgrade procedure to 7.2.1
because this error is not fatal. Resolving the error is merely a preparation
step for a future version upgrade.
Starting 21Travel services
export TRAVEL_LOG=info
docker compose up -d