nixos/haproxy: add reloading support, use upstream service hardening

Refactor the systemd service definition for the haproxy reverse proxy,
using the upstream systemd service definition. This allows the service
to be reloaded on changes, preserving existing server state, and adds
some hardening options.
This commit is contained in:
Hugo Geoffroy
2020-05-20 09:29:27 +02:00
parent fbdbe12f50
commit c784d3ab76
2 changed files with 36 additions and 4 deletions

View File

@@ -43,5 +43,13 @@ import ./make-test-python.nix ({ pkgs, ...}: {
assert "haproxy_process_pool_allocated_bytes" in machine.succeed(
"curl -k http://localhost:80/metrics"
)
with subtest("reload"):
machine.succeed("systemctl reload haproxy")
# wait some time to ensure the following request hits the reloaded haproxy
machine.sleep(5)
assert "We are all good!" in machine.succeed(
"curl -k http://localhost:80/index.txt"
)
'';
})