Database
This page is about the configuration and maintenance of the PostgreSQL database that xltrail uses.
NOTE: Always back up your data before doing any database maintenance.
Container-based installation (default)
Both installation types (Docker and Kubernetes), will install a container-based version of PostgreSQL by default. The data is stored under
- Docker (bind mount):
<DATA_DIR>/postgres
(the default value for<DATA_DIR>
is/var/lib/xltrail
) - Kubernetes (PVC):
xt-db-volume-xt-db-0
External database
For production, you may prefer to host your own installation of PostgreSQL by adjusting the configuration accordingly:
- Docker: See Database configuration
- Kubernetes: See section
postgresql
undervalues.yaml
Docker installation: Upgrade PostgreSQL version
If you use the PostgreSQL container with Docker, the version will be pinned in the xltrail.conf
file, under the key POSTGRES_VERSION
.
If you'd like to upgrade your database version to a new minor version, e.g., from
16.0
to16.1
, you can edit thexltrail.conf
file directly and simply restart the app viaxltrail restart
.If you'd like to upgrade to a new major version, e.g., from
15.3
to16.1
, you have to upgrade the database as follows:While xltrail is running with the old version of PostgreSQL, run the following commands:
xltrail backupdb xltrail stop
Change
POSTGRES_VERSION
inxltrail.conf
(if it doesn't exist, add it in a new line), e.g.:POSTGRES_VERSION=16.0
Now upgrade the database like so:
xltrail restoredb
After a successful database upgrade, start xltrail again via
xltrail start
.
NOTE: Offline ("air-gapped") installations
The air-gapped bundles come with a specific version of PostgreSQL. Whenever you upgrade an xltrail installation via air-gapped bundle, you should run xltrail backupdb
before upgrading your xltrail installation so you can upgrade the database if required.