From 7a8cb9b0069469a79c29d25f65fb26ddcd65b6d7 Mon Sep 17 00:00:00 2001 From: xqtc161 Date: Wed, 19 Jun 2024 11:09:38 +0200 Subject: [PATCH] Move Caddyfile to caddy.virtualHosts --- hosts/x86_64-linux/beleth/default.nix | 124 ++++++++++++++++------- hosts/x86_64-linux/beleth/monitoring.nix | 8 +- 2 files changed, 91 insertions(+), 41 deletions(-) diff --git a/hosts/x86_64-linux/beleth/default.nix b/hosts/x86_64-linux/beleth/default.nix index b8884f9..8d6cfca 100644 --- a/hosts/x86_64-linux/beleth/default.nix +++ b/hosts/x86_64-linux/beleth/default.nix @@ -26,44 +26,94 @@ with lib; { services.caddy = { enable = true; email = "xqtc@tutanota.com"; - configFile = pkgs.writeText "Caddyfile" '' - heroin.trade { - root * /var/www/website/public/ - handle_errors { - rewrite * /404.html - file_server - } - file_server - } - syncthing.heroin.trade { - reverse_proxy http://localhost:8384 { - header_up Host {upstream_hostport} + # configFile = pkgs.writeText "Caddyfile" '' + # heroin.trade { + # root * /var/www/website/public/ + # handle_errors { + # rewrite * /404.html + # file_server + # } + # file_server + # } + # syncthing.heroin.trade { + # reverse_proxy http://localhost:8384 { + # header_up Host {upstream_hostport} + # } + # } + # demos.heroin.trade { + # root * /var/www/demos/ + # file_server browse + # } + # git.heroin.trade { + # reverse_proxy http://localhost:3002 + # } + # + # jellyfin.heroin.trade { + # reverse_proxy http://127.0.0.1:8096 + # } + # + # calibre.heroin.trade { + # reverse_proxy http://localhost:3000 + # } + # + # grafana.heroin.trade { + # reverse_proxy http://127.0.0.1:2342 + # } + # + # uptime.heroin.trade { + # reverse_proxy 127.0.0.1:3001 + # } + # ''; + virtualHosts = { + "heroin.trade" = { + extraConfig = '' + root * /var/www/website/public/ + handle_errors { + rewrite * /404.html + file_server } - } - demos.heroin.trade { - root * /var/www/demos/ - file_server browse - } - git.heroin.trade { - reverse_proxy http://localhost:3002 - } - - jellyfin.heroin.trade { - reverse_proxy http://127.0.0.1:8096 - } - - calibre.heroin.trade { - reverse_proxy http://localhost:3000 - } - - grafana.heroin.trade { - reverse_proxy http://127.0.0.1:2342 - } - - uptime.heroin.trade { - reverse_proxy 127.0.0.1:3001 - } - ''; + file_server + ''; + }; + "syncthing.heroin.trade" = { + extraConfig = '' + reverse_proxy http://localhost:8384 { + header_up Host {upstream_hostport} + } + ''; + }; + "demos.heroin.trade" = { + extraConfig = '' + root * /var/www/demos/ + file_server browse + ''; + }; + "git.heroin.trade" = { + extraConfig = '' + reverse_proxy http://localhost:3002 + ''; + }; + "jellyfin.heroin.trade" = { + extraConfig = '' + reverse_proxy http://127.0.0.1:8096 + ''; + }; + "calibre.heroin.trade" = { + extraConfig = '' + reverse_proxy http://localhost:3000 + ''; + }; + "grafana.heroin.trade" = { + extraConfig = '' + reverse_proxy http://127.0.0.1:2342 + ''; + }; + "uptime.heroin.trade" = { + extraConfig = '' + reverse_proxy http://127.0.0.1:3001 + ''; + }; + }; }; services.syncthing.settings.gui.insecureSkipHostcheck = true; diff --git a/hosts/x86_64-linux/beleth/monitoring.nix b/hosts/x86_64-linux/beleth/monitoring.nix index bd23009..33371b4 100644 --- a/hosts/x86_64-linux/beleth/monitoring.nix +++ b/hosts/x86_64-linux/beleth/monitoring.nix @@ -21,7 +21,7 @@ port = 9002; }; wireguard = { - enable = true; + enable = true; }; }; scrapeConfigs = [ @@ -30,9 +30,9 @@ static_configs = [ { targets = [ - "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" - "127.0.0.1:${toString config.services.prometheus.exporters.wireguard.port}" - ]; + "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" + "127.0.0.1:${toString config.services.prometheus.exporters.wireguard.port}" + ]; } ]; }