nixpkgs/nixos/tests/plausible.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
993 B
Nix
Raw Normal View History

2024-11-22 12:52:18 +00:00
import ./make-test-python.nix (
{ lib, ... }:
{
2021-05-21 21:15:23 +00:00
name = "plausible";
2024-11-22 12:52:18 +00:00
meta = {
maintainers = lib.teams.cyberus.members;
2021-05-21 21:15:23 +00:00
};
2022-03-20 23:15:30 +00:00
nodes.machine =
{ pkgs, ... }:
{
2021-05-21 21:15:23 +00:00
virtualisation.memorySize = 4096;
services.plausible = {
enable = true;
server = {
baseUrl = "http://localhost:8000";
secretKeybaseFile = "${pkgs.writeText "dont-try-this-at-home" "nannannannannannannannannannannannannannannannannannannan_batman!"}";
};
};
2021-05-21 21:15:23 +00:00
};
testScript = ''
start_all()
machine.wait_for_unit("plausible.service")
machine.wait_for_open_port(8000)
# Ensure that the software does not make not make the machine
# listen on any public interfaces by default.
machine.fail("ss -tlpn 'src = 0.0.0.0 or src = [::]' | grep LISTEN")
2021-05-21 21:15:23 +00:00
machine.succeed("curl -f localhost:8000 >&2")
2023-09-20 01:42:16 +00:00
machine.succeed("curl -f localhost:8000/js/script.js >&2")
2021-05-21 21:15:23 +00:00
'';
}
)