Skip to content

Let the server keep Postgres on its data disk; pin postgres 18 - #103

Merged
Maharsh17 merged 1 commit into
mainfrom
db-data-on-data-volume
Oct 28, 2026
Merged

Maharsh17 merged 1 commit into
mainfrom
db-data-on-data-volume

Conversation

@Maharsh17

Copy link
Copy Markdown
Member

Part of the INVITE server layout cleanup (28 October 2026): code in /var/www/<app>, data that cannot be rebuilt in /data/<app>. Please review: nothing on the server moves until you agree.

What changed

  • DB_DATA in .env picks where Postgres keeps its files. Without it the database keeps the pgdata volume, so merging this changes nothing on the server or on a laptop.
  • postgres:latest becomes postgres:18. Prod runs 18.4. Once Postgres 19 is out, a pull of latest would give a container that refuses to open version 18 data.
  • docs/guides/configuration.md describes DB_DATA.

The move, after merge (about a minute of database downtime)

  1. Take a fresh dump.
  2. Stop db.
  3. Copy the volume's files to /data/lm-dashboard/postgres, keeping their owner.
  4. Set DB_DATA=/data/lm-dashboard/postgres in the server's .env.
  5. docker compose -f compose.yml up -d.
  6. Compare row counts with the dump.

The old volume stays for a week as a fallback.

How it was checked

docker compose -f compose.yml config: without DB_DATA the volume is the existing production volume, as before; with it, a bind mount of the folder. The image resolves to postgres:18.

Nightly dumps of this database now go to /var/backups/apps on the root disk and /data/backups/db (restore checked: row counts match).

DB_DATA in .env picks where Postgres keeps its files. Without it the db
keeps the pgdata volume, so this changes nothing until the server sets it.
Prod would set /data/lm-dashboard/postgres, so the database lives on the data disk
and outlives the root disk.

postgres:latest would move to a new major version on the next pull, and a
new major cannot open this one's data folder, so the image is pinned to 18,
the version running now (18.4).
@Maharsh17
Maharsh17 merged commit 36c3988 into main Oct 28, 2026
2 checks passed
@Maharsh17
Maharsh17 deleted the db-data-on-data-volume branch October 28, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant