nixos/lighttpd: add reload support

Allow reloading the webserver, which is useful when e.g there are new
certificates available that we want lighttpd to use, but don't want to
completely shut down the server.
This commit is contained in:
Bjørn Forsman 2023-10-18 12:17:45 +02:00
parent 321b684c40
commit cc7791cfd9
2 changed files with 2 additions and 0 deletions

View File

@ -253,6 +253,7 @@ in
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = "${cfg.package}/sbin/lighttpd -D -f ${configFile}";
serviceConfig.ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR1 $MAINPID";
# SIGINT => graceful shutdown
serviceConfig.KillSignal = "SIGINT";
};

View File

@ -17,5 +17,6 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: {
server.wait_for_unit("lighttpd.service")
res = server.succeed("curl --fail http://localhost/file.txt")
assert "hello nixos test" in res, f"bad server response: '{res}'"
server.succeed("systemctl reload lighttpd")
'';
})