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 --- packages | 2 +- system/linde.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/packages b/packages index e44b42f0..1f22eb1d 160000 --- a/packages +++ b/packages @@ -1 +1 @@ -Subproject commit e44b42f082aee425459182711649283986ef5e46 +Subproject commit 1f22eb1d157275d40400c83b57fac4ad65ecb1a2 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