Skip to content

Commit f091d53

Browse files
Test Userclaude
andcommitted
fix(download-server): harden service deps, NFS timeouts, and firewall
Three reliability/correctness fixes found during config audit: - Add qbittorrent.service as a hard dependency for btfs-bridge, which connects to qBittorrent's WebUI but previously had no ordering guarantee and could fail on boot - Add x-systemd.mount-timeout=30 to all NFS mounts to prevent indefinite hangs when the storage server is unreachable (previously caused systemd-tmpfiles to enter D-state for 41+ minutes, blocking deploys) - Open Prometheus exporter ports (9100, 9113, 9586, 9707-9710) in the nftables allowedServices list — the servers module was opening these via networking.firewall which is force-disabled by proxy-vpn-gateway Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent de47ece commit f091d53

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

flake-modules/hosts/download-server-1/default.nix

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,8 +762,9 @@ in {
762762
# BTFS Bridge: watches qBittorrent for "stream" category and mounts via BTFS
763763
systemd.services.btfs-bridge = {
764764
description = "BTFS Bridge - qBittorrent to BTFS streaming";
765-
after = [ "network-online.target" "btfs-restore.service" ];
765+
after = [ "network-online.target" "btfs-restore.service" "qbittorrent.service" ];
766766
wants = [ "network-online.target" ];
767+
requires = [ "qbittorrent.service" ];
767768
wantedBy = [ "multi-user.target" ];
768769

769770
serviceConfig = {
@@ -942,7 +943,7 @@ EOF
942943
# - actimeo=30 (cache attributes for 30 sec = faster stale handle detection)
943944
# - lookupcache=all (aggressive file lookup caching)
944945
# - hard,intr (reliable, but interruptible on hung operations)
945-
options = "rw,hard,intr,tcp,nfsvers=4.2,rsize=1048576,wsize=1048576,timeo=600,retrans=2,noatime,nodiratime,async,lookupcache=all,actimeo=30";
946+
options = "rw,hard,intr,tcp,nfsvers=4.2,rsize=1048576,wsize=1048576,timeo=600,retrans=2,noatime,nodiratime,async,lookupcache=all,actimeo=30,x-systemd.mount-timeout=30";
946947
wantedBy = [ ];
947948
requires = [ "network-online.target" ];
948949
after = [ "network-online.target" ];
@@ -953,7 +954,7 @@ EOF
953954
type = "nfs";
954955
# No async for movies/tv (Radarr/Sonarr move completed files here)
955956
# actimeo=30 for faster stale handle detection after server reboots
956-
options = "rw,hard,intr,tcp,nfsvers=4.2,rsize=1048576,wsize=1048576,timeo=600,retrans=2,noatime,nodiratime,lookupcache=all,actimeo=30";
957+
options = "rw,hard,intr,tcp,nfsvers=4.2,rsize=1048576,wsize=1048576,timeo=600,retrans=2,noatime,nodiratime,lookupcache=all,actimeo=30,x-systemd.mount-timeout=30";
957958
wantedBy = [ ];
958959
requires = [ "network-online.target" ];
959960
after = [ "network-online.target" ];
@@ -964,7 +965,7 @@ EOF
964965
type = "nfs";
965966
# No async for movies/tv (Radarr/Sonarr move completed files here)
966967
# actimeo=30 for faster stale handle detection after server reboots
967-
options = "rw,hard,intr,tcp,nfsvers=4.2,rsize=1048576,wsize=1048576,timeo=600,retrans=2,noatime,nodiratime,lookupcache=all,actimeo=30";
968+
options = "rw,hard,intr,tcp,nfsvers=4.2,rsize=1048576,wsize=1048576,timeo=600,retrans=2,noatime,nodiratime,lookupcache=all,actimeo=30,x-systemd.mount-timeout=30";
968969
wantedBy = [ ];
969970
requires = [ "network-online.target" ];
970971
after = [ "network-online.target" ];
@@ -1414,6 +1415,35 @@ EOF
14141415
"192.168.1.66"
14151416
];
14161417
}
1418+
# Prometheus exporters (node, nginx, wireguard, exportarr)
1419+
{
1420+
port = 9100; # node exporter
1421+
sources = [ "192.168.1.187" "192.168.1.190" "192.168.1.39" "192.168.1.66" ];
1422+
}
1423+
{
1424+
port = 9113; # nginx exporter
1425+
sources = [ "192.168.1.187" "192.168.1.190" "192.168.1.39" "192.168.1.66" ];
1426+
}
1427+
{
1428+
port = 9586; # wireguard exporter
1429+
sources = [ "192.168.1.187" "192.168.1.190" "192.168.1.39" "192.168.1.66" ];
1430+
}
1431+
{
1432+
port = 9707; # exportarr radarr
1433+
sources = [ "192.168.1.187" "192.168.1.190" "192.168.1.39" "192.168.1.66" ];
1434+
}
1435+
{
1436+
port = 9708; # exportarr sonarr
1437+
sources = [ "192.168.1.187" "192.168.1.190" "192.168.1.39" "192.168.1.66" ];
1438+
}
1439+
{
1440+
port = 9709; # exportarr bazarr
1441+
sources = [ "192.168.1.187" "192.168.1.190" "192.168.1.39" "192.168.1.66" ];
1442+
}
1443+
{
1444+
port = 9710; # exportarr prowlarr
1445+
sources = [ "192.168.1.187" "192.168.1.190" "192.168.1.39" "192.168.1.66" ];
1446+
}
14171447
];
14181448

14191449
vpnIncomingPorts = {

0 commit comments

Comments
 (0)