2016-02-17 02:12:09 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
# more than just nginx config but not enough to become a module
|
|
|
|
with config.krebs.lib;
|
|
|
|
let
|
|
|
|
hostname = config.krebs.build.host.name;
|
2016-04-08 01:53:34 +00:00
|
|
|
external-ip = config.krebs.build.host.nets.internet.ip4.addr;
|
2016-02-17 02:12:09 +00:00
|
|
|
wsgi-sock = "${config.services.uwsgi.runDir}/uwsgi.sock";
|
|
|
|
in {
|
|
|
|
services.redis.enable = true;
|
|
|
|
services.uwsgi = {
|
|
|
|
enable = true;
|
|
|
|
user = "nginx";
|
|
|
|
plugins = [ "python2" ];
|
|
|
|
instance = {
|
|
|
|
type = "emperor";
|
|
|
|
vassals = {
|
|
|
|
mycube-flask = {
|
|
|
|
type = "normal";
|
2016-02-28 00:53:41 +00:00
|
|
|
pythonPackages = self: with self; [ pkgs.mycube-flask ];
|
2016-02-17 02:12:09 +00:00
|
|
|
socket = wsgi-sock;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
krebs.nginx = {
|
|
|
|
enable = mkDefault true;
|
|
|
|
servers = {
|
|
|
|
mybox-connector-one = {
|
|
|
|
listen = [ "${external-ip}:80" ];
|
|
|
|
server-names = [
|
|
|
|
"mycube.connector.one"
|
|
|
|
"mybox.connector.one"
|
|
|
|
];
|
|
|
|
locations = singleton (nameValuePair "/" ''
|
|
|
|
uwsgi_pass unix://${wsgi-sock};
|
|
|
|
uwsgi_param UWSGI_CHDIR ${pkgs.mycube-flask}/${pkgs.python.sitePackages};
|
|
|
|
uwsgi_param UWSGI_MODULE mycube.websrv;
|
|
|
|
uwsgi_param UWSGI_CALLABLE app;
|
|
|
|
|
|
|
|
include ${pkgs.nginx}/conf/uwsgi_params;
|
|
|
|
'');
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|