fix(caddy): switch dns provider from hetzner to cloudflare across all services

This commit is contained in:
uttarayan21
2025-11-27 22:17:31 +05:30
parent 9542689024
commit e53c1d2f25
16 changed files with 53 additions and 4845 deletions

View File

@@ -4,10 +4,10 @@
...
}: {
sops = {
secrets."hetzner/api_key".owner = config.services.caddy.user;
secrets."cloudflare/api_key".owner = config.services.caddy.user;
templates = {
"HETZNER_API_KEY.env".content = ''
HETZNER_API_KEY=${config.sops.placeholder."hetzner/api_key"}
"CLOUDFLARE_API_KEY.env".content = ''
CLOUDFLARE_API_KEY=${config.sops.placeholder."cloudflare/api_key"}
'';
};
};
@@ -15,28 +15,22 @@
caddy = {
enable = true;
extraConfig = ''
(hetzner) {
(cloudflare) {
tls {
propagation_timeout -1
propagation_delay 120s
dns hetzner {env.HETZNER_API_KEY}
dns cloudflare {env.CLOUDFLARE_API_KEY}
resolvers 1.1.1.1
}
}
'';
package = pkgs.caddyWithHetzner;
# package = pkgs.caddy.withPlugins {
# plugins = ["github.com/caddy-dns/hetzner@v1.0.0"];
# # hash = "sha256-9ea0CfOHG7JhejB73HjfXQpnonn+ZRBqLNz1fFRkcDQ=";
# # hash = "sha256-9ea0CfOHG7JhejB73HjfXQpnonn+ZRBqLNz1fFRkcDQ="
# hash = "sha256-YUrprDZQL+cX3P8fVLKHouXTMG4rw3sCaQdGqiq37uA=";
# };
package = pkgs.caddyWithCloudflare;
};
};
systemd.services.caddy = {
after = ["sops-install-secrets.service"];
serviceConfig = {
EnvironmentFile = config.sops.templates."HETZNER_API_KEY.env".path;
EnvironmentFile = config.sops.templates."CLOUDFLARE_API_KEY.env".path;
};
};
}

View File

@@ -27,7 +27,7 @@
};
caddy = {
virtualHosts."llama.ryu.darksailor.dev".extraConfig = ''
import hetzner
import cloudflare
reverse_proxy localhost:${builtins.toString config.services.llama-cpp.port}
'';
};

View File

@@ -41,7 +41,7 @@
# };
caddy = {
# virtualHosts."llama.ryu.darksailor.dev".extraConfig = ''
# import hetzner
# import cloudflare
# forward_auth tako:5555 {
# uri /api/authz/forward-auth
# copy_headers Remote-User Remote-Groups Remote-Email Remote-Name
@@ -49,7 +49,7 @@
# reverse_proxy localhost:${builtins.toString config.services.open-webui.port}
# '';
virtualHosts."ollama.ryu.darksailor.dev".extraConfig = ''
import hetzner
import cloudflare
reverse_proxy localhost:${builtins.toString config.services.ollama.port}
'';
};