nixpkgs/nixos/modules
Maximilian Bosch 90787dbe89
nixos/nextcloud: set up base directories & override.config.php with tmpfiles
Closes #169733

The issue is that Nextcloud fails to start up after a GC because the
symlink from `override.config.php` is stale.

I'm relatively certain that this is not a bug in the Nix GC - that
would've popped up somewhere else already in the past years - and one of
the reporters seems to confirm that: when they restarted
`nextcloud-setup.service` after the issue appeared, an
`override.config.php` pointing to a different hash was there.

This hints that on a deploy `nextcloud-setup` wasn't restarted properly
and thus replacing the symlink update was missed. This is relatively
hard to trigger due to the nature of the bug unfortunately (you usually
keep system generations for a few weeks and you'll need to change the
configuration - or stdenv - to get a different `override.config.php`),
so getting pointers from folks who are affected is rather complicated.

So I decided to work around this by using systemd-tmpfiles which a lot
of other modules already utilize for this use-case. Now,
`override.config.php` and the directory structure aren't created by
`nextcloud-setup`, but by `systemd-tmpfiles`.

With that, the structure is guaranteed to exist

* on boot, since tmpfiles are always created/applied then
* on config activation, since this is done before services are
  (re)started which covers the case for new installations and existing
  ones.

Also, the recursive `chgrp` was used as transition tool when we switched
from `nginx` as owning group to a dedicated `nextcloud` group[1][2], but
this was several releases ago, so I don't consider this relevant
anymore.

[1] fd9eb16b24
[2] ca916e8cb3
2024-01-12 22:11:36 +01:00
..
config Merge pull request #243169 from 2xsaiko/outgoing/krb5 2024-01-10 21:06:15 +01:00
hardware Merge remote-tracking branch 'origin/master' into staging-next 2024-01-09 13:03:34 +03:00
i18n/input-method nixos/fcitx5: allow using the wayland frontend instead of the fcitx5 one 2024-01-04 15:06:58 -05:00
image image/repart: build image with buildPackages 2023-12-21 15:11:13 -08:00
installer Revert "nixVersions.stable: 2.18.1 -> 2.19.2" 2024-01-11 19:15:07 +01:00
misc nixos/doc: avoid bash argument list size limit 2023-12-31 18:08:46 +01:00
profiles Merge pull request #273308 from Stunkymonkey/install-device-fix-mdadm 2023-12-25 23:41:10 +01:00
programs nixos/singularity: disable setuid for apptainer 2024-01-10 20:47:57 +00:00
security Merge pull request #243169 from 2xsaiko/outgoing/krb5 2024-01-10 21:06:15 +01:00
services nixos/nextcloud: set up base directories & override.config.php with tmpfiles 2024-01-12 22:11:36 +01:00
system Revert "nixos/systemd-boot: init boot counting" 2024-01-11 01:00:43 +01:00
tasks nixos/bcachefs: use linuxPackages_latest 2024-01-08 10:47:51 +03:00
testing nixos/test-instrumentation: Fix backdoor ordering 2023-11-12 15:04:38 -05:00
virtualisation Merge pull request #274813 from pbsds/lxd-package-option-fix 2024-01-09 23:36:42 +01:00
module-list.nix Merge branch 'master' into staging-next 2024-01-10 23:12:44 +01:00
rename.nix prayer: remove 2023-11-10 20:44:28 -03:00