server: implement graceful shutdown and reloads

This commit is contained in:
2025-11-29 21:57:25 +09:00
parent 4a6e49110a
commit 1fe08b59a3
8 changed files with 313 additions and 116 deletions

View File

@@ -101,13 +101,18 @@ in
systemd.sockets."muscl".wantedBy = [ "sockets.target" ];
systemd.services."muscl" = {
restartTriggers = [ config.environment.etc."muscl/config.toml".source ];
reloadTriggers = [ config.environment.etc."muscl/config.toml".source ];
serviceConfig = {
ExecStart = [
""
"${lib.getExe cfg.package} ${cfg.logLevel} server --systemd socket-activate"
];
ExecReload = [
""
"${lib.getExe' pkgs.coreutils "kill"} -HUP $MAINPID"
];
IPAddressDeny = "any";
IPAddressAllow = [
"127.0.0.0/8"