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