blob: 2c5e90e3b33e88fa6d86394942ae2a081c7260c0 (
plain) (
tree)
|
|
{ lib, config, pkgs, ... }:
let
cfg = config.myServices.websites.denise.oms;
varDir = "/var/lib/buildbot/outputs/denise/oms";
socket = "/run/denise_oms/socket.sock";
in {
options.myServices.websites.denise.oms.enable = lib.mkEnableOption "enable Denise's OMS website";
config = lib.mkIf cfg.enable {
services.websites.env.production.vhostConfs.denise_oms = {
certName = "denise";
addToCerts = true;
hosts = [ "oms.syanni.eu" ];
root = null;
extraConfig = [
''
ProxyPreserveHost on
ProxyVia On
ProxyRequests Off
ProxyPassMatch ^/.well-known/acme-challenge !
ProxyPass / unix://${socket}|http://oms.syanni.eu/
ProxyPassReverse / unix://${socket}|http://oms.syanni.eu/
''
];
};
systemd.services.denise-oms = {
description = "Denise OMS website";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
WorkingDirectory = varDir;
ExecStart = let
python = pkgs.python3.withPackages (p: [ p.gunicorn p.flask p.matplotlib p.unidecode ]);
in
"${python}/bin/gunicorn -w4 -p /run/denise_oms/gunicorn.pid --bind unix:${socket} app:app";
User = "buildbot";
Restart = "always";
RestartSec = "5s";
PIDFile = "/run/denise_oms/gunicorn.pid";
RuntimeDirectory = "denise_oms";
StandardOutput = "journal";
StandardError = "inherit";
};
};
};
}
|