Server: replace traefik with caddy
This commit is contained in:
parent
5001e70c14
commit
863840b2b1
6 changed files with 33 additions and 77 deletions
11
roles/server/caddy.nix
Normal file
11
roles/server/caddy.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{...}: {
|
||||||
|
services.caddy = {
|
||||||
|
enable = true;
|
||||||
|
extraConfig = ''
|
||||||
|
(tailscale) {
|
||||||
|
tls internal
|
||||||
|
bind 100.73.96.48
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
./ddclient.nix
|
./ddclient.nix
|
||||||
./beep.nix
|
./beep.nix
|
||||||
./tailscale.nix
|
./tailscale.nix
|
||||||
./traefik.nix
|
./caddy.nix
|
||||||
./dns.nix
|
./dns.nix
|
||||||
./rust_motd.nix
|
./rust_motd.nix
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -47,20 +47,12 @@ in {
|
||||||
# Add a cname for forgejo
|
# Add a cname for forgejo
|
||||||
services.dnsmasq.settings.cname = ["git.everest.tailscale,everest"];
|
services.dnsmasq.settings.cname = ["git.everest.tailscale,everest"];
|
||||||
|
|
||||||
# Set up traefik as the reverse proxy for Forgejo
|
# Set up caddy as the reverse proxy for Forgejo
|
||||||
services.traefik = {
|
services.caddy.virtualHosts.forgejo = {
|
||||||
dynamicConfigOptions = {
|
hostName = "git.everest.tailscale";
|
||||||
http = {
|
extraConfig = ''
|
||||||
routers = {
|
import tailscale
|
||||||
forgejo-subpath = {
|
reverse_proxy localhost:${toString config.services.forgejo.settings.server.HTTP_PORT}
|
||||||
rule = "Host(`git.everest.tailscale`)";
|
'';
|
||||||
service = "forgejo";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
services.forgejo.loadBalancer.servers = [
|
|
||||||
{url = "http://localhost:${toString config.services.forgejo.settings.server.HTTP_PORT}";}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,20 +36,12 @@
|
||||||
# Add a cname for syncthing
|
# Add a cname for syncthing
|
||||||
services.dnsmasq.settings.cname = ["sync.everest.tailscale,everest"];
|
services.dnsmasq.settings.cname = ["sync.everest.tailscale,everest"];
|
||||||
|
|
||||||
# Set up traefik as the reverse proxy for syncthing
|
# Set up caddy as the reverse proxy for syncthing
|
||||||
services.traefik = {
|
services.caddy.virtualHosts.syncthing = {
|
||||||
dynamicConfigOptions = {
|
hostName = "sync.everest.tailscale";
|
||||||
http = {
|
extraConfig = ''
|
||||||
routers = {
|
import tailscale
|
||||||
syncthing-subdomain = {
|
reverse_proxy localhost:8384
|
||||||
rule = "Host(`sync.everest.tailscale`)";
|
'';
|
||||||
service = "syncthing";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
services.syncthing.loadBalancer.servers = [
|
|
||||||
{url = "http://localhost:8384";}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
{...}: {
|
|
||||||
specialisation.traefikEnableWebUI.configuration.services.traefik = {
|
|
||||||
staticConfigOptions = {
|
|
||||||
api = {
|
|
||||||
# Enable the web ui
|
|
||||||
insecure = true;
|
|
||||||
dashboard = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
services.traefik = {
|
|
||||||
enable = true;
|
|
||||||
staticConfigOptions = {
|
|
||||||
entryPoints = {
|
|
||||||
http = {address = "100.73.96.48:80";};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd = {
|
|
||||||
units.tailscaled.requiredBy = ["traefik.service"];
|
|
||||||
# We have somewhat frequent power outages, and our ISP router takes
|
|
||||||
# ages to boot up. If I don't add a delay, traefik tries to bind to
|
|
||||||
# the tailscale interface before it's ready, making it crash too much
|
|
||||||
# in too little time
|
|
||||||
services.traefik.serviceConfig.RestartSec = 120;
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [80 8080];
|
|
||||||
}
|
|
||||||
|
|
@ -40,20 +40,12 @@ in {
|
||||||
# Add a cname for transmission
|
# Add a cname for transmission
|
||||||
services.dnsmasq.settings.cname = ["transmission.everest.tailscale,everest"];
|
services.dnsmasq.settings.cname = ["transmission.everest.tailscale,everest"];
|
||||||
|
|
||||||
# Set up traefik as the reverse proxy for transmission
|
# Set up caddy as the reverse proxy for transmission
|
||||||
services.traefik = {
|
services.caddy.virtualHosts.transmission = {
|
||||||
dynamicConfigOptions = {
|
hostName = "transmission.everest.tailscale";
|
||||||
http = {
|
extraConfig = ''
|
||||||
routers = {
|
import tailscale
|
||||||
transmission-subdomain = {
|
reverse_proxy localhost:${toString config.services.transmission.settings.rpc-port}
|
||||||
rule = "Host(`transmission.everest.tailscale`)";
|
'';
|
||||||
service = "transmission";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
services.transmission.loadBalancer.servers = [
|
|
||||||
{url = "http://localhost:${toString config.services.transmission.settings.rpc-port}";}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue