1import ./make-test-python.nix (
2 { lib, ... }:
3 {
4 name = "plausible";
5 meta = {
6 maintainers = lib.teams.cyberus.members;
7 };
8
9 nodes.machine =
10 { pkgs, ... }:
11 {
12 virtualisation.memorySize = 4096;
13 services.plausible = {
14 enable = true;
15 server = {
16 baseUrl = "http://localhost:8000";
17 secretKeybaseFile = "${pkgs.writeText "dont-try-this-at-home" "nannannannannannannannannannannannannannannannannannannan_batman!"}";
18 };
19 };
20 };
21
22 testScript = ''
23 start_all()
24 machine.wait_for_unit("plausible.service")
25 machine.wait_for_open_port(8000)
26
27 # Ensure that the software does not make not make the machine
28 # listen on any public interfaces by default.
29 machine.fail("ss -tlpn 'src = 0.0.0.0 or src = [::]' | grep LISTEN")
30
31 machine.succeed("curl -f localhost:8000 >&2")
32
33 machine.succeed("curl -f localhost:8000/js/script.js >&2")
34 '';
35 }
36)