fix(services): require postgresql.target in pgweb/mathesar and refresh all db collations

This commit is contained in:
Noah Masur committed 2026-10-25 20:59:14 +00:00
1 parent b3d9938f10
commit 9a458530d0
4 files changed
+12 -2

No files matched your search

+5
View File
@@ -1,5 +1,10 @@
# Changelog
## 2026-10-25: fix pgweb/mathesar postgresql.target dependency and refresh all DB collations
- **pgweb & mathesar**: Added `requires = [ "postgresql.target" ];` to `systemd.services.pgweb` (`platforms/nixos/modules/nmasur/presets/services/pgweb.nix`) and `"postgresql.target"` to `systemd.services.mathesar.requires` (`platforms/nixos/modules/nmasur/presets/services/mathesar/mathesar.nix`). Previously they only set `after = [ "postgresql.target" ]`, allowing `switch-to-configuration` to start `pgweb.service` before `postgresql.target` was queued and causing `pgweb` to fail with `connect: no such file or directory` on `/run/postgresql/.s.PGSQL.5432`.
- **PostgreSQL collation version refresh**: Updated `systemd.services.postgresql-setup.preStart` (`platforms/nixos/modules/nmasur/presets/services/postgresql.nix`) to iterate over all databases with `datallowconn` in `pg_database` and run `ALTER DATABASE ... REFRESH COLLATION VERSION;` instead of only refreshing `template1` and `postgres`.
## 2026-10-24: fix build failures for NixOS swan
- **Nextcloud**: Upstream NixOS removed `services.nextcloud.config.adminpassFile` and `services.nextcloud.config.adminuser`. Removed `adminpassFile` from `services.nextcloud.config`, updated `services.prometheus.exporters.nextcloud` to reference `config.secrets.nextcloud.dest` directly as `passwordFile` and set `username = "root"`, and added ordering dependencies on `nextcloud-secret` for `prometheus-nextcloud-exporter.service`.
@@ -30,6 +30,7 @@ in
"postgresql.target"
];
requires = [
"postgresql.target"
"mathesar-secret.service"
"mathesar-postgres-secret.service"
];
@@ -28,6 +28,9 @@ in
after = [
"postgresql.target"
];
requires = [
"postgresql.target"
];
# requires = [ "pgweb-secret.service" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
@@ -45,8 +45,9 @@ in
if ! systemctl is-active --quiet postgresql.service; then break; fi
sleep 0.1
done
${config.services.postgresql.package}/bin/psql -d postgres -tAc 'ALTER DATABASE template1 REFRESH COLLATION VERSION;' || true
${config.services.postgresql.package}/bin/psql -d postgres -tAc 'ALTER DATABASE postgres REFRESH COLLATION VERSION;' || true
for db in $(${config.services.postgresql.package}/bin/psql -d postgres -tAc 'SELECT datname FROM pg_database WHERE datallowconn;'); do
${config.services.postgresql.package}/bin/psql -d postgres -tAc "ALTER DATABASE \"$db\" REFRESH COLLATION VERSION;" || true
done
'';
};
};