Commit Graph
10 Commits
Author SHA1 Message Date
tanshu 4297e5a71e Run Postgres as a rootless Podman Quadlet, and move the 17 cluster across
Replaces the docker_container playbook, which published 5432 on 0.0.0.0 and kept
its data in /var/lib/postgresql. Postgres is now the base Quadlet unit, the same
shape as Caddy: it knows nothing about its clients, and a service attaches itself
by dropping a file into postgres.container.d/ via postgres/roles/attach. Nothing
here changes when a service is added or removed.

Pinned to 18, which is two decisions rather than one tag. Postgres 18 moved both
the image's VOLUME (/var/lib/postgresql/data -> /var/lib/postgresql) and its
default PGDATA (/var/lib/postgresql/data/pgdata -> /var/lib/postgresql/18/docker),
and the 18 entrypoint refuses to start when it finds a cluster in the old layout.
So postgres_major is the single knob: it picks the image tag and the PGDATA path
together, and the mount is now the parent directory. That also settles the
migration: a PGDATA copy cannot cross a major version, so monoco's 17.5 cluster
comes across as a pg_dumpall.

Three things that bit us and are worth keeping:

- PGDATA and its version directory are created by the role, not left to the
  container. The entrypoint runs as container-root, which under keep-id is a
  subuid on the host, and it only chowns PGDATA and its contents -- so
  ~/podman-data/postgres/18 would have been stranded subuid-owned, and the host
  user could not even rm -rf it without podman unshare.

- NetworkAlias= applies to every network the container joins, which is what a
  database hub wants, but it is one fixed value in a shared drop-in rather than
  per-service: two services writing their own would make Quadlet pass
  --network-alias twice. It is not in postgres.container itself because on a
  fresh host that unit has no Network= at all.

- The credentials live in a 0600 file read with EnvironmentFile=, not in
  Environment= lines: the unit is world-readable in ~/.config.

The play no longer uses become, and does not apply the rootless-Podman
prerequisites -- those are the shared task file at caddy/roles/podman, and the
three variables they need are duplicated at the top of vars/default.yml.

migrate-from-monoco.md records the one-time 17.5 -> 18.6 move: the dump, transfer
and restore commands, the checks that prove the restore is complete (per-database
table counts against the source), and the verified result.

The dead nginx/php-fpm templates in postgres/files/ are removed.
2026-10-16 06:52:27 +05:30
tanshu 5d276dd182 Upgraded postgres to 17 2025-07-31 11:11:27 +00:00
tanshu ddf6b5a54c Postgres:
Pinned a version so that watchdog does not upgrade versions.
Made the host directory configurable
2024-09-19 06:51:53 +05:30
tanshu e26809cec9 Cleanup 2024-01-23 21:16:42 +05:30
tanshu 5713d3d410 Updates 2022-08-02 06:40:29 +05:30
tanshu 426bd8e82a Fix:
Postgres as supplying wrong env variable
2020-10-17 12:28:18 +05:30
tanshu fc8a7795e6 Added: Readme
Added: Restart policy
2020-04-20 18:13:06 +05:30
tanshu 518871ff16 Postgres: changed image to the :alpine
All: Check if nginx config exists before updating. This is to prevent overwriting of certbot-auto certificates and redirect
2020-04-03 13:01:44 +05:30
tanshu 9264828051 Gitea: Only update nginx if conf files do not exist to prevent fucking up let's encrypt certificate and redirect. 2020-04-03 10:42:58 +05:30
tanshu e0e7b07468 Initial rough commit to save the code before cleanup 2020-04-03 09:24:02 +05:30