refactoring of reverse proxy configuration

This commit is contained in:
Douze Bé 2024-12-26 22:56:44 +01:00
parent f822c72f11
commit a1460d2ca3
5 changed files with 53 additions and 28 deletions

View file

@ -5,6 +5,7 @@
[ [
./hardware-configuration.nix ./hardware-configuration.nix
./network-configuration.nix ./network-configuration.nix
./proxy-configuration.nix
/var/src/modules/nixin-base.nix /var/src/modules/nixin-base.nix
/var/src/modules/users.nix /var/src/modules/users.nix
/var/src/modules/wireguard-client.nix /var/src/modules/wireguard-client.nix

View file

@ -0,0 +1,52 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
# proxy for nixin-web on arachnide
services.traefik.dynamicConfigOptions.http.services."service-nixin-web-lab12" = {
loadBalancer.servers = [
{ url = "http://localhost:8081"; }
];
};
services.traefik.dynamicConfigOptions.http.routers."router-nixin-web-lab12" = {
rule = "Host(`nixin.lab12.fr`)";
service = "service-nixin-web-lab12";
};
# proxy for nixin-web on sanji
services.traefik.dynamicConfigOptions.http.services."service-nixin-web-mrflos" = {
loadBalancer.servers = [
{ url = "http://192.168.12.5:8081"; }
];
};
services.traefik.dynamicConfigOptions.http.routers."router-nixin-web-mrflos" = {
rule = "Host(`nixin.sanji.mrflos.pw`)";
service = "service-nixin-web-mrflos";
};
# proxy for nextcloud on arachnide
services.traefik.dynamicConfigOptions.http.services."service-nextcloud-lab12" = {
loadBalancer.servers = [
{ url = "http://10.10.2.2:80"; }
];
};
services.traefik.dynamicConfigOptions.http.routers."router-nextcloud_lab12" = {
rule = "Host(`nuage.lab12.fr`)";
service = "service-nextcloud_lab12";
};
# proxy for forgejo on arachnide
services.traefik.dynamicConfigOptions.http.services."service-forgejo-lab12" = {
loadBalancer.servers = [
{ url = "http://localhost:8082"; }
];
};
services.traefik.dynamicConfigOptions.http.routers."router-forgejo-lab12" = {
rule = "Host(`forge.lab12.fr`)";
service = "service-forgejo_lab12";
};
}

View file

@ -86,15 +86,5 @@ in
# ${adminCmd} change-password --username ${config.nixin.forgejo.admin-user} --password "${config.nixin.forgejo.admin-pwd}" || true # ${adminCmd} change-password --username ${config.nixin.forgejo.admin-user} --password "${config.nixin.forgejo.admin-pwd}" || true
''; '';
services.traefik.dynamicConfigOptions.http.services."service-forgejo" = {
loadBalancer.servers = [
{ url = "http://localhost:${toString config.nixin.forgejo.http-port}"; }
];
};
services.traefik.dynamicConfigOptions.http.routers."router-forgejo" = {
rule = "Host(`${config.nixin.forgejo.domain}`)";
service = "service-forgejo";
};
}; };
} }

View file

@ -71,14 +71,5 @@ in
iptables -w -t nat -A POSTROUTING -s ${config.containers.nextcloud.localAddress} -j MASQUERADE iptables -w -t nat -A POSTROUTING -s ${config.containers.nextcloud.localAddress} -j MASQUERADE
''; '';
services.traefik.dynamicConfigOptions.http.services."service-nextcloud" = {
loadBalancer.servers = [
{ url = "http://${config.nixin.nextcloud.container-address}:80"; }
];
};
services.traefik.dynamicConfigOptions.http.routers."router-nextcloud" = {
rule = "Host(`${config.nixin.nextcloud.domain}`)";
service = "service-nextcloud";
};
}; };
} }

View file

@ -48,14 +48,5 @@ in
locations."/".index = "index.html"; locations."/".index = "index.html";
}; };
services.traefik.dynamicConfigOptions.http.services."service-nixin-web" = {
loadBalancer.servers = [
{ url = "http://localhost:${toString config.nixin.web.http-port}"; }
];
};
services.traefik.dynamicConfigOptions.http.routers."router-nixin-web" = {
rule = "Host(`${config.nixin.web.domain}`)";
service = "service-nixin-web";
};
}; };
} }