fix(caddy): make restart and shutdown faster
This commit is contained in:
parent
c72e78e02e
commit
508e20566c
1 changed files with 39 additions and 35 deletions
|
@ -5,27 +5,31 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
caddy = caddy-plugins.packages.${pkgs.system}.default;
|
caddy = caddy-plugins.packages.${pkgs.system}.default;
|
||||||
|
secrets = config.sops.secrets;
|
||||||
in {
|
in {
|
||||||
# FIXME: doesn't close on shutdown
|
|
||||||
imports = [caddy-plugins.nixosModules.default];
|
imports = [caddy-plugins.nixosModules.default];
|
||||||
environment.systemPackages = [caddy];
|
environment.systemPackages = [caddy];
|
||||||
users.users.${config.vars.user}.extraGroups = ["caddy"];
|
users.users.${config.vars.user}.extraGroups = ["caddy"];
|
||||||
|
|
||||||
systemd.services.caddy.serviceConfig.EnvironmentFile =
|
systemd.services.caddy.serviceConfig = {
|
||||||
config.sops.secrets.caddy-cloudflare.path;
|
EnvironmentFile = secrets.caddy-cloudflare.path;
|
||||||
|
|
||||||
|
# For some reason the service
|
||||||
|
# doesn't shutdown normally
|
||||||
|
KillSignal = "SIGKILL";
|
||||||
|
RestartKillSignal = "SIGKILL";
|
||||||
|
};
|
||||||
|
|
||||||
services.caddy = {
|
services.caddy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableReload = false;
|
enableReload = false;
|
||||||
package = caddy;
|
package = caddy;
|
||||||
|
|
||||||
virtualHosts = {
|
virtualHosts = let
|
||||||
"http://pi.hole".reverseProxy = "localhost:8000";
|
dockerIP = "10.0.0.122";
|
||||||
|
|
||||||
"nelim.org" = let
|
|
||||||
mainIP = "10.0.0.122";
|
|
||||||
jellyIP = "10.0.0.123";
|
jellyIP = "10.0.0.123";
|
||||||
in {
|
in {
|
||||||
|
"nelim.org" = {
|
||||||
serverAliases = ["*.nelim.org"];
|
serverAliases = ["*.nelim.org"];
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
tls {
|
tls {
|
||||||
|
@ -36,18 +40,18 @@ in {
|
||||||
|
|
||||||
subDomains = {
|
subDomains = {
|
||||||
# Misc one-liners
|
# Misc one-liners
|
||||||
vault.reverseProxy = "${mainIP}:8781";
|
vault.reverseProxy = "${dockerIP}:8781";
|
||||||
hauk.reverseProxy = "${mainIP}:3003";
|
hauk.reverseProxy = "${dockerIP}:3003";
|
||||||
headscale.reverseProxy = "localhost:8085";
|
headscale.reverseProxy = "localhost:8085";
|
||||||
jelly.reverseProxy = "${jellyIP}:80";
|
jelly.reverseProxy = "${jellyIP}:80";
|
||||||
|
|
||||||
# Resume builder
|
# Resume builder
|
||||||
resume.reverseProxy = "${mainIP}:3060";
|
resume.reverseProxy = "${dockerIP}:3060";
|
||||||
resauth.reverseProxy = "${mainIP}:3100";
|
resauth.reverseProxy = "${dockerIP}:3100";
|
||||||
|
|
||||||
# Nextcloud & Co
|
# Nextcloud & Co
|
||||||
bakail.reverseProxy = "${mainIP}:8077";
|
bakail.reverseProxy = "${dockerIP}:8077";
|
||||||
office.reverseProxy = "http://${mainIP}:8055";
|
office.reverseProxy = "http://${dockerIP}:8055";
|
||||||
nextcloud = {
|
nextcloud = {
|
||||||
subDomainName = "cloud";
|
subDomainName = "cloud";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
|
@ -56,37 +60,37 @@ in {
|
||||||
redir /.well-known/webfinger /index.php/.well-known/webfinger 301
|
redir /.well-known/webfinger /index.php/.well-known/webfinger 301
|
||||||
redir /.well-known/nodeinfo /index.php/.well-known/nodeinfo 301
|
redir /.well-known/nodeinfo /index.php/.well-known/nodeinfo 301
|
||||||
'';
|
'';
|
||||||
reverseProxy = "${mainIP}:8042";
|
reverseProxy = "${dockerIP}:8042";
|
||||||
};
|
};
|
||||||
|
|
||||||
forgejo = {
|
forgejo = {
|
||||||
subDomainName = "git";
|
subDomainName = "git";
|
||||||
reverseProxy = "${mainIP}:3000";
|
reverseProxy = "${dockerIP}:3000";
|
||||||
};
|
};
|
||||||
|
|
||||||
calibre = {
|
calibre = {
|
||||||
subDomainName = "books";
|
subDomainName = "books";
|
||||||
reverseProxy = "${mainIP}:8083";
|
reverseProxy = "${dockerIP}:8083";
|
||||||
};
|
};
|
||||||
|
|
||||||
immich = {
|
immich = {
|
||||||
subDomainName = "photos";
|
subDomainName = "photos";
|
||||||
reverseProxy = "${mainIP}:2283";
|
reverseProxy = "${dockerIP}:2283";
|
||||||
};
|
};
|
||||||
|
|
||||||
# FreshRSS & Co
|
# FreshRSS & Co
|
||||||
drss.reverseProxy = "${mainIP}:3007";
|
drss.reverseProxy = "${dockerIP}:3007";
|
||||||
freshrss = {
|
freshrss = {
|
||||||
subDomainName = "rss";
|
subDomainName = "rss";
|
||||||
reverseProxy = "${mainIP}:2800";
|
reverseProxy = "${dockerIP}:2800";
|
||||||
};
|
};
|
||||||
|
|
||||||
jellyseer = {
|
jellyseer = {
|
||||||
subDomainName = "seerr";
|
subDomainName = "seerr";
|
||||||
reverseProxy = "${mainIP}:5055";
|
reverseProxy = "${dockerIP}:5055";
|
||||||
};
|
};
|
||||||
|
|
||||||
games.reverseProxy = "${mainIP}:8074";
|
games.reverseProxy = "${dockerIP}:8074";
|
||||||
|
|
||||||
# FIXME: what's the IP?
|
# FIXME: what's the IP?
|
||||||
#wgui.extraConfig = ''
|
#wgui.extraConfig = ''
|
||||||
|
@ -94,26 +98,26 @@ in {
|
||||||
#'';
|
#'';
|
||||||
|
|
||||||
lan = {
|
lan = {
|
||||||
reverseProxy = "10.0.0.122:3020";
|
reverseProxy = "${dockerIP}:3020";
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
redir /index.html /
|
redir /index.html /
|
||||||
'';
|
'';
|
||||||
|
|
||||||
subDirectories = {
|
subDirectories = {
|
||||||
bazarr.reverseProxy = "10.0.0.122:6767";
|
bazarr.reverseProxy = "${dockerIP}:6767";
|
||||||
bazarr-french = {
|
bazarr-french = {
|
||||||
subDirName = "bafrr";
|
subDirName = "bafrr";
|
||||||
reverseProxy = "10.0.0.122:6766";
|
reverseProxy = "${dockerIP}:6766";
|
||||||
};
|
};
|
||||||
|
|
||||||
prowlarr.reverseProxy = "10.0.0.122:9696";
|
prowlarr.reverseProxy = "${dockerIP}:9696";
|
||||||
radarr.reverseProxy = "10.0.0.122:7878";
|
radarr.reverseProxy = "${dockerIP}:7878";
|
||||||
sabnzbd.reverseProxy = "10.0.0.122:8382";
|
sabnzbd.reverseProxy = "${dockerIP}:8382";
|
||||||
sonarr.reverseProxy = "10.0.0.122:8989";
|
sonarr.reverseProxy = "${dockerIP}:8989";
|
||||||
|
|
||||||
calibre = {
|
calibre = {
|
||||||
experimental = true;
|
experimental = true;
|
||||||
reverseProxy = "10.0.0.122:8580";
|
reverseProxy = "${dockerIP}:8580";
|
||||||
};
|
};
|
||||||
|
|
||||||
qbittorent = {
|
qbittorent = {
|
||||||
|
@ -125,7 +129,7 @@ in {
|
||||||
vaultwarden = {
|
vaultwarden = {
|
||||||
subDirName = "vault";
|
subDirName = "vault";
|
||||||
experimental = true;
|
experimental = true;
|
||||||
reverseProxy = "10.0.0.122:8780";
|
reverseProxy = "${dockerIP}:8780";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -134,12 +138,12 @@ in {
|
||||||
joal.extraConfig = ''
|
joal.extraConfig = ''
|
||||||
route {
|
route {
|
||||||
rewrite * /joal/ui{uri}
|
rewrite * /joal/ui{uri}
|
||||||
reverse_proxy * ${mainIP}:5656
|
reverse_proxy * ${dockerIP}:5656
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
joalws.extraConfig = ''
|
joalws.extraConfig = ''
|
||||||
route {
|
route {
|
||||||
reverse_proxy ${mainIP}:5656
|
reverse_proxy ${dockerIP}:5656
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue