krebs 3 bepasty-server: styling

This commit is contained in:
makefu 2015-10-22 16:14:37 +02:00
parent 9bb3069f69
commit be39c6d849

View File

@ -10,7 +10,10 @@ let
out = {
options.krebs.bepasty = api;
config = mkIf cfg.enable (mkMerge [(mkIf cfg.serveNginx nginx-imp) imp ]) ;
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.serveNginx nginx-imp)
imp
]);
};
api = {
@ -25,7 +28,7 @@ let
type = with types; attrsOf unspecified;
description = ''
additional nginx configuration. see krebs.nginx for all options
'' ;
'';
};
secretKey = mkOption {
@ -88,8 +91,7 @@ let
# Configures systemd services for each configured server
# environment.systemPackages = [ bepasty gunicorn gevent ];
systemd.services = mapAttrs' (name: server:
nameValuePair ("bepasty-server-${name}")
({
nameValuePair "bepasty-server-${name}" {
description = "Bepasty Server ${name}";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
@ -98,6 +100,7 @@ let
BEPASTY_CONFIG = "${server.workDir}/bepasty-${name}.conf";
PYTHONPATH= "${bepasty}/lib/${python.libPrefix}/site-packages:${gevent}/lib/${python.libPrefix}/site-packages";
};
serviceConfig = {
Type = "simple";
PrivateTmp = true;
@ -123,7 +126,7 @@ let
-k gevent
'';
};
})
}
) cfg.servers;
users.extraUsers.bepasty = {
@ -137,7 +140,7 @@ let
};
nginx-imp = {
assertions = [ { assertion = config.krebs.nginx.enable;
assertions = [{ assertion = config.krebs.nginx.enable;
message = "krebs.nginx.enable must be true"; }];
krebs.nginx.servers = mapAttrs' (name: server:
@ -147,18 +150,15 @@ let
client_max_body_size 32M;
'';
locations = [
(nameValuePair ("/")
(''
(nameValuePair "/" ''
proxy_set_header Host $http_host;
proxy_pass http://unix:${server.workDir}/gunicorn-${name}.sock;
''))
(nameValuePair ("/static/")
(''
'')
(nameValuePair "/static/" ''
alias ${bepasty}/lib/${python.libPrefix}/site-packages/bepasty/static/;
''))
'')
];
}])
) cfg.servers ;
}])) cfg.servers ;
};
in
out