From fdb646b04e0e7fc49b9f20ae4f54e1d41f582f9d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 29 Jun 2024 14:57:42 +0200 Subject: linde: set up goatcounter --- system/linde.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'system') diff --git a/system/linde.nix b/system/linde.nix index 2ae0b714..3a4b66ec 100644 --- a/system/linde.nix +++ b/system/linde.nix @@ -22,6 +22,7 @@ in imports = [ + @@ -344,6 +345,17 @@ in # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.05"; # Did you read the comment? + services.goatcounter = { + enable = true; + listenAddress = "localhost"; + port = 8082; + package = (import { inherit pkgs; }).goatcounter; + settings = { + tls = "proxy"; + websocket = true; + }; + }; + services.powerdns = let inherit (lib.lists) flatten; @@ -597,6 +609,9 @@ in reloadServices = map (x: "kresd@${toString x}") (range 1 config.services.kresd.instances); group = "knot-resolver"; }; + certs."stats.alanpearce.eu" = { + extraDomainNames = [ "*.stats.alanpearce.eu" ]; + }; }; users.groups.acme.members = [ "caddy" @@ -729,6 +744,17 @@ in reverse_proxy ${srv.settings.bindHTTP} ''; }; + "stats.alanpearce.eu" = + let + srv = config.services.goatcounter; + in + { + useACMEHost = "stats.alanpearce.eu"; + serverAliases = [ "*.stats.alanpearce.eu" ]; + extraConfig = '' + reverse_proxy ${srv.listenAddress}:${toString srv.port} + ''; + }; }; }; systemd.services.caddy.serviceConfig = { -- cgit 1.4.1