docs(postgres): name the Docker Compose version the Postgres compose file needs

The file creates TREK's role from an inline config, which Compose reads only from 2.23.1 on; the file header and the wiki now say so, with the error an older Compose prints.
This commit is contained in:
Maurice
2026-11-23 15:06:32 +01:00
parent 9ae99b42ec
commit ca367d9cfc
3 changed files with 7 additions and 1 deletions
+4
View File
@@ -1,6 +1,10 @@
# TREK on a Postgres database instead of the SQLite file. See the wiki page
# Database-Postgres for what this changes, the requirements and the backups.
#
# Needs Docker Compose 2.23.1 or newer, which reads the inline config
# (configs.trek-db-role below). An older Compose, as some NAS bundles ship,
# refuses the whole file with "Additional property content is not allowed".
#
# Set two passwords in a .env file beside this file (or in the shell) before
# the first start:
# POSTGRES_ADMIN_PASSWORD=<a long random value> the database's superuser, postgres
+2
View File
@@ -67,6 +67,8 @@ The password is passed to the tools in the `PGPASSWORD` environment variable of
[`docker-compose.postgres.yml`](https://github.com/liketrek/TREK/blob/main/docker-compose.postgres.yml) runs a `postgres:18` service beside TREK, on a named volume, with the TREK container waiting for the database to pass its health check. Set two passwords in a `.env` file beside it before the first start: `POSTGRES_ADMIN_PASSWORD` for the database's superuser `postgres`, and `POSTGRES_PASSWORD` for the role `trek` that TREK connects as. On the database's first start, the superuser creates the role `trek`, which owns TREK's database and is not a superuser. See [Install: Docker Compose](Install-Docker-Compose#running-on-postgres).
The file needs Docker Compose 2.23.1 or newer: it creates that role from an inline config, which an older Compose refuses with `Additional property content is not allowed` before anything starts. Some NAS bundles ship an older Compose; check with `docker compose version`.
If that first start fails because a password is missing, the database is already created but without the role `trek`, and a restart does not create it any more. Set the password and start again on a new volume: `docker compose -f docker-compose.postgres.yml down -v` removes the database volume with it, so run it only while that database is still empty.
#### Postgres versions and the volume path
+1 -1
View File
@@ -118,7 +118,7 @@ See [Reverse-Proxy](Reverse-Proxy) for complete proxy configuration examples.
## Running on Postgres
[`docker-compose.postgres.yml`](https://github.com/liketrek/TREK/blob/main/docker-compose.postgres.yml) runs TREK beside a `postgres:18` service instead of the SQLite file. Its `db` service keeps the database in a named volume and publishes no port, and the `app` service (container `trek`) waits for the database's health check before it starts. The `app` service sets only a few environment variables; add the others you need (`APP_URL`, `FORCE_HTTPS`, OIDC, SMTP and so on) as in `docker-compose.yml`.
[`docker-compose.postgres.yml`](https://github.com/liketrek/TREK/blob/main/docker-compose.postgres.yml) runs TREK beside a `postgres:18` service instead of the SQLite file. Its `db` service keeps the database in a named volume and publishes no port, and the `app` service (container `trek`) waits for the database's health check before it starts. The `app` service sets only a few environment variables; add the others you need (`APP_URL`, `FORCE_HTTPS`, OIDC, SMTP and so on) as in `docker-compose.yml`. It needs Docker Compose 2.23.1 or newer (`docker compose version`); an older one refuses the file with `Additional property content is not allowed`.
The volume path depends on the Postgres major version: `postgres:18` keeps its data under `/var/lib/postgresql`, the images for 14 to 17 under `/var/lib/postgresql/data`. Change the image tag and the volume path together, and only for a new database. A database stays on the major it was created with, so when you update the compose file later, keep your image tag and volume path; moving to another major needs `pg_upgrade` or a backup and restore, never just a new tag. See [Database: Postgres](Database-Postgres#postgres-versions-and-the-volume-path).