hive-matrix: turn off tuwunel's log preallocation on btrfs and zfs
Refs #6885
This commit is contained in:
parent
82710f4fa8
commit
7c7c94d184
1 changed files with 58 additions and 0 deletions
|
|
@ -158,6 +158,25 @@ let
|
|||
# the database directory under /var/lib.
|
||||
stateName = "tuwunel";
|
||||
|
||||
# tuwunel's `rocksdb_allow_fallocate` is off only where its database sits on
|
||||
# a filesystem that cannot honour RocksDB's log preallocation. A swarm's
|
||||
# filesystem is not known at evaluation, so the unit's `ExecStartPre` reads
|
||||
# it at each start, from the same superblock magics tuwunel itself tests for
|
||||
# its warning (btrfs `9123683e`, ZFS `2fc12fc1`), and writes the override
|
||||
# to an environment file. tuwunel applies `TUWUNEL_*` variables over its
|
||||
# config file. Anywhere else, or if `stat` fails, the file is empty and the
|
||||
# default (`true`) stands.
|
||||
tuwunelRuntimeDir = "/run/tuwunel";
|
||||
fallocateEnvFile = "${tuwunelRuntimeDir}/fallocate.env";
|
||||
fallocateProbe = pkgs.writeShellScript "tuwunel-fallocate-probe" ''
|
||||
set -u
|
||||
: > ${fallocateEnvFile}
|
||||
magic=$(${pkgs.coreutils}/bin/stat -f -c %t /var/lib/${stateName}) || exit 0
|
||||
case "$magic" in
|
||||
9123683e | 2fc12fc1) echo TUWUNEL_ROCKSDB_ALLOW_FALLOCATE=false > ${fallocateEnvFile} ;;
|
||||
esac
|
||||
'';
|
||||
|
||||
# ── the swarm's own appservice ──────────────────────────────────────
|
||||
#
|
||||
# The homeserver's one appservice registration, and the swarm's identity on
|
||||
|
|
@ -1098,6 +1117,12 @@ in
|
|||
# Upstream's `ProtectSystem = "strict"` leaves `/run` read-only.
|
||||
systemd.services.tuwunel.serviceConfig.ReadWritePaths = [ socketDir ];
|
||||
|
||||
# The `RuntimeDirectory` is upstream's. The file is read before each
|
||||
# command of the unit runs, so `ExecStartPre` writes what `ExecStart`
|
||||
# sees; the `-` keeps a missing file from failing the start.
|
||||
systemd.services.tuwunel.serviceConfig.ExecStartPre = [ fallocateProbe ];
|
||||
systemd.services.tuwunel.serviceConfig.EnvironmentFile = [ "-${fallocateEnvFile}" ];
|
||||
|
||||
# Keeps DynamicUser=true + PrivateUsers=true intact — no
|
||||
# host-side chown :tuwunel / GID-pin gymnastics needed.
|
||||
# See `man systemd.exec` → LoadCredential.
|
||||
|
|
|
|||
Loading…
Reference in a new issue