diff --git a/modules/services/anubis.nix b/hosts/vm/reverseproxy/anubis.nix similarity index 100% rename from modules/services/anubis.nix rename to hosts/vm/reverseproxy/anubis.nix diff --git a/hosts/vm/reverseproxy/default.nix b/hosts/vm/reverseproxy/default.nix index 9cba21a..2b557c0 100644 --- a/hosts/vm/reverseproxy/default.nix +++ b/hosts/vm/reverseproxy/default.nix @@ -2,18 +2,35 @@ { imports = [ + ./anubis.nix ./hardware-configuration.nix ./networking.nix ./reverseproxy.nix - ../../../modules - ../../../modules/services/acme.nix - ../../../modules/services/anubis.nix - ../../../modules/services/nginx.nix ]; networking.hostName = "reverseproxy"; boot.loader.grub.devices = [ "/dev/sda" ]; + crans = { + enable = true; + + networking = { + id = "51"; + srvNat.enable = true; + srv = { + enable = true; + interface = "ens20"; + ipv4 = "185.230.79.42"; + }; + }; + + resticClient.when = "03:42"; + + services = { + acme.enable = true; + }; + }; + system.stateVersion = "25.05"; } diff --git a/hosts/vm/reverseproxy/reverseproxy.nix b/hosts/vm/reverseproxy/reverseproxy.nix index 6ce8e31..d0bab65 100644 --- a/hosts/vm/reverseproxy/reverseproxy.nix +++ b/hosts/vm/reverseproxy/reverseproxy.nix @@ -3,95 +3,98 @@ { users.users."nginx".home = "/var/lib/nginx"; - services.nginx.virtualHosts = - let anubisConf = [ - { - addr = "localhost"; - port = 8888; - } - ]; - in { - # redirection install-party - "install-party.crans.fr" = { - enableACME = true; - forceSSL = true; - serverAliases = [ - "i-p.crans.org" - "adopteunmanchot.crans.org" - "adopteunpingouin.crans.org" - "i-p.crans.fr" - "adopteunmanchot.crans.fr" - "adopteunpingouin.crans.fr" - "i-p.crans.eu" - "install-party.crans.eu" - "adopteunmanchot.crans.eu" - "adopteunpingouin.crans.eu" + services.nginx = { + enable = true; + virtualHosts = + let anubisConf = [ + { + addr = "localhost"; + port = 8888; + } ]; - extraConfig = '' - return 301 https://install-party.crans.org$request_uri; - ''; - }; - - # redirection mediawiki - "mediawiki.crans.fr" = { - enableACME = true; - forceSSL = true; - serverAliases = [ - "mediakiwi.crans.org" - "mediakiwi.crans.fr" - "mediakiwi.crans.eu" - "mediawiki.crans.eu" - ]; - extraConfig = '' - return 301 https://mediawiki.crans.org$request_uri; - ''; - }; - - # redirection wiki - "wiki.crans.fr" = { - enableACME = true; - forceSSL = true; - serverAliases = [ - "wikipedia.crans.org" - "wikipedia.crans.fr" - "wikipedia.crans.eu" - "wiki.crans.eu" - ]; - extraConfig = '' - return 301 https://wiki.crans.org$request_uri; - ''; - }; - - # redirection anubis - "anubis" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://${config.services.anubis.instances."muraille".settings.BIND}"; + in { + # redirection install-party + "install-party.crans.fr" = { + enableACME = true; + forceSSL = true; + serverAliases = [ + "i-p.crans.org" + "adopteunmanchot.crans.org" + "adopteunpingouin.crans.org" + "i-p.crans.fr" + "adopteunmanchot.crans.fr" + "adopteunpingouin.crans.fr" + "i-p.crans.eu" + "install-party.crans.eu" + "adopteunmanchot.crans.eu" + "adopteunpingouin.crans.eu" + ]; + extraConfig = '' + return 301 https://install-party.crans.org$request_uri; + ''; }; - serverName = "install-party.crans.org"; - serverAliases = [ - "mediawiki.crans.org" - "wiki.crans.org" - ]; - }; - # install-party - "install-party.crans.org" = { - root = "/var/www/install-party.crans.org"; - listen = anubisConf; - }; + # redirection mediawiki + "mediawiki.crans.fr" = { + enableACME = true; + forceSSL = true; + serverAliases = [ + "mediakiwi.crans.org" + "mediakiwi.crans.fr" + "mediakiwi.crans.eu" + "mediawiki.crans.eu" + ]; + extraConfig = '' + return 301 https://mediawiki.crans.org$request_uri; + ''; + }; - # mediawiki - "mediawiki.crans.org" = { - locations."/".proxyPass = "http://172.16.10.144"; - listen = anubisConf; - }; + # redirection wiki + "wiki.crans.fr" = { + enableACME = true; + forceSSL = true; + serverAliases = [ + "wikipedia.crans.org" + "wikipedia.crans.fr" + "wikipedia.crans.eu" + "wiki.crans.eu" + ]; + extraConfig = '' + return 301 https://wiki.crans.org$request_uri; + ''; + }; - # wiki - "wiki.crans.org" = { - locations."/".proxyPass = "http://172.16.10.161"; - listen = anubisConf; + # redirection anubis + "anubis" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://${config.services.anubis.instances."muraille".settings.BIND}"; + }; + serverName = "install-party.crans.org"; + serverAliases = [ + "mediawiki.crans.org" + "wiki.crans.org" + ]; + }; + + # install-party + "install-party.crans.org" = { + root = "/var/www/install-party.crans.org"; + listen = anubisConf; + }; + + # mediawiki + "mediawiki.crans.org" = { + locations."/".proxyPass = "http://172.16.10.144"; + listen = anubisConf; + }; + + # wiki + "wiki.crans.org" = { + locations."/".proxyPass = "http://172.16.10.161"; + listen = anubisConf; + }; }; }; }