travstats-db
官方Docker 应用程序 from Abrechen2's Repository
概述
PostgreSQL 15 with the PostGIS 3.4 spatial extension — the database TravStats expects.
This template is pre-filled with the container name travstats-db and the database/user pair flights/flights so the default DATABASE_URL in the TravStats template matches without further editing. Change the password to a strong value (e.g. openssl rand -base64 32) and reuse it in TravStats.
Install order: this container first, then the TravStats template. The database is published on the Unraid host at port 5432 (adjustable below) so TravStats can reach it via host.docker.internal:5432 without needing a shared Docker network. Keep the port free of conflicts with other PostgreSQL containers you may already run.
Storage: the default Application Data path (/mnt/user/appdata/travstats-db) maps to PostgreSQL's data directory. The actual cluster lives in a pgdata/ subdirectory (see the PGDATA variable below) — this is the officially recommended layout from the postgres Docker image and avoids a well-known Unraid permission issue where chown from inside the container can't reach the FUSE-backed share root.
The initial cluster is created on first start and then kept in place on updates; deleting the pgdata/ subdirectory wipes the database, so point your backup tool at this folder.
Why PostGIS, not plain Postgres? TravStats uses PostGIS for airport and route geometry. Plain postgres:15 fails the first TravStats migration.
Troubleshooting — "FATAL: could not open file global/pg_filenode.map: Permission denied"
If you see this error in the container log and TravStats shows "Error querying the database" on its setup page, your pgdata/ directory was created under the wrong UID by a previous (broken) install. Fix:
- Stop both containers (
TravStats,travstats-db). - On the Unraid console:
rm -rf /mnt/user/appdata/travstats-db/pgdata(or whichever Application Data path you chose). - Start
travstats-db— it now re-runsinitdbwith the correct UID (999, the Postgres user inside the image). - Start
TravStats— setup page should load without errors.
If the fresh start still fails on /mnt/user/..., switch the Application Data path to /mnt/cache/appdata/travstats-db (direct cache-pool mount, bypasses Unraid's FUSE layer) and repeat step 3. Requires a cache pool to be configured.
要求
运行时参数
- 网络
bridge- 外壳
sh- 特权
- false
- 额外参数
--restart=unless-stopped
模板配置
Parent directory for the PostgreSQL data. The actual cluster is created as a `pgdata/` subfolder here (see PGDATA). One persistent mount, survives container updates. Back this path up with your regular appdata backup.
- 目标
- /var/lib/postgresql/data
- 默认值
- /mnt/user/appdata/travstats-db
- 价值
- /mnt/user/appdata/travstats-db
Actual PostgreSQL data subdirectory inside the Application Data mount. Using a subfolder (instead of the bind-mount root) is the official postgres-image recommendation and avoids a common Unraid FUSE permission issue. Do not change unless you know what you're doing.
- 默认值
- /var/lib/postgresql/data/pgdata
- 价值
- /var/lib/postgresql/data/pgdata
Database name. TravStats default expects 'flights'.
- 默认值
- flights
- 价值
- flights
Database user. TravStats default expects 'flights'.
- 默认值
- flights
- 价值
- flights
Database password. Generate a strong one with `openssl rand -base64 32`, then paste the same value into the TravStats DATABASE_URL field.
- 默认值
- CHANGEME
- 价值
- CHANGEME
Port on the Unraid host that PostgreSQL listens on. TravStats connects through host.docker.internal:this port. Change only if 5432 is already in use by another Postgres.
- 目标
- 5432
- 默认值
- 5432
- 价值
- 5432
Container timezone. Keep UTC.
- 默认值
- UTC
- 价值
- UTC
下载统计数据
详细信息
在Unraid 上运行 travstats-db 。
travstats-db 已被列入Unraid OS 的社区应用程序。探索Unraid ,构建灵活的家庭服务器、NAS 或家庭实验室。