1{ pkgs, ... }:
2{
3 name = "graphite";
4 nodes = {
5 one =
6 { ... }:
7 {
8 time.timeZone = "UTC";
9 services.graphite = {
10 web = {
11 enable = true;
12 extraConfig = ''
13 SECRET_KEY = "abcd";
14 '';
15 };
16 carbon.enableCache = true;
17 seyren.enable = false; # Implicitly requires openssl-1.0.2u which is marked insecure
18 };
19 };
20 };
21
22 testScript = ''
23 start_all()
24 one.wait_for_unit("default.target")
25 one.wait_for_unit("graphiteWeb.service")
26 one.wait_for_unit("carbonCache.service")
27 # The services above are of type "simple". systemd considers them active immediately
28 # even if they're still in preStart (which takes quite long for graphiteWeb).
29 # Wait for ports to open so we're sure the services are up and listening.
30 one.wait_for_open_port(8080)
31 one.wait_for_open_port(2003)
32 one.succeed('echo "foo 1 `date +%s`" | nc -N localhost 2003')
33 one.wait_until_succeeds(
34 "curl 'http://localhost:8080/metrics/find/?query=foo&format=treejson' --silent | grep foo >&2"
35 )
36 '';
37}