diff --git a/Dockerfile b/Dockerfile index d941c1e91..069b15b44 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,9 +70,14 @@ COPY server/package.json ./server/ # gypfile:false (npm/cli#9837). The only other install scripts among the runtime # deps are esbuild's binary check, redundant next to its optional platform # package, and a telemetry ping. +# +# postgresql-client-17 (Debian 13's own) brings pg_dump and pg_restore to +# /usr/lib/postgresql/17/bin, which back up an install on Postgres +# (TREK_DB_URL). pg_dump refuses a server newer than itself, so it stays at the +# newest major TREK supports. RUN apt-get update && \ apt-get install -y --no-install-recommends tzdata dumb-init wget ca-certificates \ - libkitinerary-bin libsqlite3-0 && \ + libkitinerary-bin libsqlite3-0 postgresql-client-17 && \ npm ci --workspace=server --omit=dev --ignore-scripts && \ { ln -sf "$(find /usr/lib -name kitinerary-extractor -type f | head -1)" /usr/local/bin/kitinerary-extractor || true; } && \ rm -rf /var/lib/apt/lists/* /usr/local/lib/node_modules/npm /usr/local/bin/npm /usr/local/bin/npx && \ diff --git a/server/.env.example b/server/.env.example index 8778acca5..68b86d0af 100644 --- a/server/.env.example +++ b/server/.env.example @@ -47,12 +47,13 @@ DEMO_MODE=false # Demo mode: resets data hourly # DEMO_ADMIN_EMAIL=admin@trek.app # Email of that seeded demo admin. (default: admin@trek.app) # DEMO_ADMIN_PASS=admin12345 # Initial password of that seeded demo admin. Change it on a public demo. (default: admin12345) -# RESTORE_FROM_BACKUP=/app/data/backup.zip # Restore this backup on the first start, before any setup. Ignored once a database exists. +# RESTORE_FROM_BACKUP=/app/data/backup.zip # Restore this backup on the first start, before any setup. Ignored once a database exists (on Postgres: once the database holds a table). # FILE_UPLOAD_LIMIT_MB=50 # Max size (MB) of a file uploaded to a trip, a booking or a note. Videos keep their own 500 MB cap. Raise your reverse proxy's upload limit too. # BACKUP_MAX_DECOMPRESSED_MB=5120 # Max size (MB) a restore archive may unpack to, on both restore paths: the zip-bomb guard. Raise it if a large backup is refused with "Backup exceeds the maximum decompressed size". (default: 5120) # BACKUP_UPLOAD_LIMIT_MB=500 # Max size (MB) of a backup archive you can upload when restoring. Raise it if your backup exceeds 500 MB. If you sit behind a reverse proxy, raise its upload limit too (e.g. nginx client_max_body_size). # TREK_DB_URL=postgres://trek:password@db:5432/trek # Run on a Postgres database instead of the SQLite file in data/. TREK creates its schema in an empty database and refuses one holding tables it did not create. sslmode=disable, require, verify-ca or verify-full (the last three always verify the certificate; sslrootcert= names the CA file). Cannot be combined with TREK_DB_FILE, TREK_DB_JOURNAL_MODE or TREK_DB_SYNCHRONOUS. +# TREK_DB_PG_BIN_DIR=/usr/lib/postgresql/17/bin # The directory holding pg_dump, pg_restore and psql, which back up and restore a Postgres database. Unset, TREK looks in /usr/lib/postgresql/<17..14>/bin, /usr/local/bin and /usr/bin (the Docker image installs the version 17 tools, which cannot dump a newer server). Unused on SQLite. # TREK_DB_POOL_MAX=10 # Most connections TREK opens to the Postgres database (1 to 100). Unused on SQLite. (default: 10) # TREK_DB_JOURNAL_MODE=WAL # SQLite journal mode (DELETE, TRUNCATE, PERSIST, MEMORY, WAL, OFF). WAL is fastest and the right choice on local disk. Set DELETE if the data directory lives on network storage (Azure App Service, an SMB/NFS volume on a NAS) — WAL coordinates writers through a shared-memory file that those filesystems do not implement reliably. The mode is stored inside the database file, so it survives a restart; changing this applies on the next boot. # TREK_DB_PRE_MIGRATE_SNAPSHOT=true # Copy the database to data/pre-migrate--