X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FConfig%2FNix.git;a=blobdiff_plain;f=modules%2Fprivate%2Fwebsites%2Fdenise%2Foms.nix;fp=modules%2Fprivate%2Fwebsites%2Fdenise%2Foms.nix;h=18773ae8cedfb36878bc05914a9f752182089eb1;hp=2c5e90e3b33e88fa6d86394942ae2a081c7260c0;hb=485354e5289157cea4de521b5ff13aae9f85a02d;hpb=68ff82c61628212208bc339b9f91fd1dba6ade50 diff --git a/modules/private/websites/denise/oms.nix b/modules/private/websites/denise/oms.nix index 2c5e90e..18773ae 100644 --- a/modules/private/websites/denise/oms.nix +++ b/modules/private/websites/denise/oms.nix @@ -2,7 +2,9 @@ let cfg = config.myServices.websites.denise.oms; varDir = "/var/lib/buildbot/outputs/denise/oms"; + varDirBeta = "/var/lib/buildbot/outputs/denise/oms_beta"; socket = "/run/denise_oms/socket.sock"; + socket_beta = "/run/denise_oms_beta/socket.sock"; in { options.myServices.websites.denise.oms.enable = lib.mkEnableOption "enable Denise's OMS website"; @@ -45,5 +47,44 @@ in { StandardError = "inherit"; }; }; + + services.websites.env.integration.vhostConfs.denise_oms_beta = { + certName = "denise"; + addToCerts = true; + hosts = [ "beta.oms.syanni.eu" ]; + root = null; + extraConfig = [ + '' + ProxyPreserveHost on + ProxyVia On + ProxyRequests Off + ProxyPassMatch ^/.well-known/acme-challenge ! + ProxyPass / unix://${socket_beta}|http://beta.oms.syanni.eu/ + ProxyPassReverse / unix://${socket_beta}|http://beta.oms.syanni.eu/ + '' + ]; + }; + + systemd.services.denise-oms-beta = { + description = "Denise OMS beta website"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + + serviceConfig = { + Type = "simple"; + WorkingDirectory = varDirBeta; + ExecStart = let + python = pkgs.python3.withPackages (p: [ p.gunicorn p.flask p.matplotlib p.unidecode ]); + in + "${python}/bin/gunicorn -w4 -p /run/denise_oms_beta/gunicorn.pid --bind unix:${socket_beta} app:app"; + User = "buildbot"; + Restart = "always"; + RestartSec = "5s"; + PIDFile = "/run/denise_oms_beta/gunicorn.pid"; + RuntimeDirectory = "denise_oms_beta"; + StandardOutput = "journal"; + StandardError = "inherit"; + }; + }; }; }