Skip to content

Commit 5d094c2

Browse files
committed
nixos/alloy: set After=network.target
This prevents the network from being torn down before alloy itself it stopped. Alloy tries to flush its WAL on SIGTERM, and if the network stack is already down, it tries to flush logs up to 90s during shutdown/reboot. From https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/: > network.target has very little meaning during start-up. It only > indicates that the network management stack is up after it has been > reached. Whether any network interfaces are already configured when > it is reached is undefined. Its primary purpose is for ordering > things properly at shutdown: since the shutdown ordering of units in > systemd is the reverse of the startup ordering, any unit that is order > After=network.target can be sure that it is stopped before the network > is shut down if the system is powered off. This allows services to > cleanly terminate connections before going down, instead of abruptly > losing connectivity for ongoing connections, leaving them in an > undefined state. […]
1 parent f2b33de commit 5d094c2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

nixos/modules/services/monitoring/alloy.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ in
6565

6666
config = lib.mkIf cfg.enable {
6767
systemd.services.alloy = {
68+
after = [ "network.target" ];
6869
wantedBy = [ "multi-user.target" ];
6970
reloadTriggers = lib.mapAttrsToList (_: v: v.source or null) (
7071
lib.filterAttrs (n: _: lib.hasPrefix "alloy/" n && lib.hasSuffix ".alloy" n) config.environment.etc

0 commit comments

Comments
 (0)