From 0781c7cb30d05176589e39e3e491c3be7ce74e25 Mon Sep 17 00:00:00 2001 From: alexion Date: Sat, 22 Aug 2026 12:51:34 -0400 Subject: [PATCH] refactor(reverse-proxy): use endpoints for deployed routes --- flake.nix | 27 ++++++++++++++------------- hosts/pikachu/default.nix | 6 ++++-- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/flake.nix b/flake.nix index fc01b8d..7207781 100644 --- a/flake.nix +++ b/flake.nix @@ -150,24 +150,24 @@ reverse-proxy-actualbudget-guest-route = let - testConfig = - (self.nixosConfigurations.pikachu.extendModules { - modules = [ - { - guests.actualbudget.reverseProxy = { - enable = true; - host = "budget.alexion.dev"; - backend = "http://10.23.20.42:5006"; - }; - } - ]; - }).config; + testConfig = self.nixosConfigurations.pikachu.config; route = testConfig.modules.reverse-proxy.routes.actualbudget; + vhost = testConfig.containers.reverse-proxy.config.services.nginx.virtualHosts."budget.alexion.dev"; in pkgs.runCommand "reverse-proxy-actualbudget-guest-route-check" { } '' ${ lib.optionalString ( - !(route.host == "budget.alexion.dev" && route.backend == "http://10.23.20.42:5006") + !( + route.host == "budget.alexion.dev" + && route.backend == null + && route.endpoint == "pikachu-actualbudget" + && route.port == 5006 + && route.tls + && route.aliases == [ ] + && route.path == "/" + && !route.websockets + && vhost.locations."/".proxyPass == "http://10.23.20.42:5006" + ) ) "exit 1" } touch $out @@ -261,6 +261,7 @@ && fleetRoutes ? pikachu-actualbudget && vhosts."worker.alexion.dev".locations."/".proxyPass == "http://10.23.20.126:3923" && vhosts."budget.alexion.dev".locations."/".proxyPass == "http://10.23.20.42:5006" + && vhosts."files.alexion.dev".locations."/".proxyPass == "http://10.23.20.126:3923" ) ) "exit 1" } diff --git a/hosts/pikachu/default.nix b/hosts/pikachu/default.nix index 60ad6d4..3a4a7c3 100644 --- a/hosts/pikachu/default.nix +++ b/hosts/pikachu/default.nix @@ -79,10 +79,11 @@ vlan = 20; mac = "BC:24:11:C1:CD:28"; dataPath = "/pikachu/data/actualbudget"; + endpoint.address = "10.23.20.42"; reverseProxy = { enable = true; host = "budget.alexion.dev"; - backend = "http://10.23.20.42:5006"; + port = 5006; }; }; @@ -97,10 +98,11 @@ vlan = 20; mac = "02:23:20:39:23:01"; statePath = "/pikachu/data/copyparty"; + endpoint.address = "10.23.20.126"; reverseProxy = { enable = true; host = "files.alexion.dev"; - backend = "http://10.23.20.126:3923"; + port = 3923; }; volumes = { "/inbox" = {