nixpkgs/nixos/modules/services/matrix
Maximilian Bosch 7f08d0ebd8
nixos/matrix-synapse: drop old DB check assertion, actually require DB to be up
Closes #236062

The PR #236062 was submitted because of the following problem: a synapse
instance was running in a NixOS container attached to the host network
and a postgresql instance on the host as database. In this setup,
synapse connected to its DB via 127.0.0.1, but the DB wasn't locally set
up and thus not configured in NixOS (i.e.
`config.services.postgresql.enable` was `false`). This caused the
assertion removed in this patch to fail.

Over three years ago this assertion was introduced when this module
stopped doing autoconfiguration of postgresql entirely[1] because a
breaking change in synapse couldn't be managed via an auto-upgrade on
our side. To make sure people don't deploy their DB away by accident,
this assertion was introduced.

Nowadays this doesn't serve any value anymore because people with
existing instances should've upgraded by now (otherwise it's their job
to carefully read the release notes when missing upgrades for
several years) and people deploying fresh instances are instructed by
the docs to also configure postgresql[2].

Instead, it only causes issues in corner cases like #236062, so after
some discussion in that PR I think it's time to remove the assertion
altogether.

Also, there's no `Requires=` for `postgresql.service` in the systemd
units which means that it's not strictly guaranteed that the DB is up
when synapse starts up. This is fixed now by adding `requires`. To avoid
being bitten by above mentioned cases again, this only happens if
`config.services.postgresql.enable` is `true`.

If somebody uses a non-local postgresql, but has also deployed a local
postgresql instance on the synapse server (rather unlikely IMHO), it's
their job to opt out of this behavior with `mkForce` (this is precisely one
of the use-cases `mkForce` and friends were built for IMHO).

[1] https://github.com/NixOS/nixpkgs/pull/80447
[2] https://nixos.org/manual/nixos/stable/#module-services-matrix-synapse
2023-10-09 14:06:50 +02:00
..
appservice-discord.nix nixos/appservice-discord: customizable package 2023-02-11 01:08:46 +08:00
appservice-irc.nix matrix-appservice-irc: 0.38.0 -> 1.0.1 2023-07-31 11:19:42 +02:00
conduit.nix nixos/conduit: disable update checks by default 2023-08-10 23:16:19 -07:00
dendrite.nix dendrite: 0.11.0 -> 0.12.0 2023-03-18 15:35:47 +01:00
matrix-sliding-sync.nix nixos/matrix-sliding-sync: Fix missing lib.mdDoc 2023-09-28 19:37:07 +00:00
mautrix-facebook.nix nixos.mautrix-facebook: Fix appservice name 2023-05-26 12:39:37 -04:00
mautrix-telegram.nix nixos/mautrix-telegram: drop removed --base-config flag 2023-09-03 08:59:57 -04:00
mautrix-whatsapp.nix nixos/mautrix-whatsapp: log to the journal only 2023-09-04 01:20:17 +02:00
mjolnir.md nixos/mjolnir: convert manual chapter to MD 2023-01-10 10:31:56 +01:00
mjolnir.nix nixos/mjolnir: explicitly set --mjolnir-config 2023-05-15 18:40:57 +08:00
mx-puppet-discord.nix nixos/mx-puppet-discord: move into matrix category 2023-01-16 06:23:25 +00:00
pantalaimon-options.nix nixos/*: automatically convert option docs 2022-08-06 20:39:12 +02:00
pantalaimon.nix nixos/*: automatically convert option docs 2022-08-06 20:39:12 +02:00
synapse.md Merge pull request #246117 from Ralith/fix-synapse-well-known-example 2023-10-08 19:53:26 +02:00
synapse.nix nixos/matrix-synapse: drop old DB check assertion, actually require DB to be up 2023-10-09 14:06:50 +02:00