2016-02-17 03:12:09 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
# more than just nginx config but not enough to become a module
|
2016-10-20 20:54:38 +02:00
|
|
|
with import <stockholm/lib>;
|
2016-02-17 03:12:09 +01:00
|
|
|
let
|
|
|
|
hostname = config.krebs.build.host.name;
|
2016-04-08 03:53:34 +02:00
|
|
|
external-ip = config.krebs.build.host.nets.internet.ip4.addr;
|
2016-02-17 03:12:09 +01:00
|
|
|
wsgi-sock = "${config.services.uwsgi.runDir}/uwsgi.sock";
|
|
|
|
in {
|
2016-10-22 15:26:16 +02:00
|
|
|
services.redis = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
systemd.services.redis.serviceConfig.LimitNOFILE=10032;
|
|
|
|
|
2016-02-17 03:12:09 +01:00
|
|
|
services.uwsgi = {
|
|
|
|
enable = true;
|
|
|
|
user = "nginx";
|
|
|
|
plugins = [ "python2" ];
|
|
|
|
instance = {
|
|
|
|
type = "emperor";
|
|
|
|
vassals = {
|
|
|
|
mycube-flask = {
|
|
|
|
type = "normal";
|
2016-02-28 01:53:41 +01:00
|
|
|
pythonPackages = self: with self; [ pkgs.mycube-flask ];
|
2016-02-17 03:12:09 +01:00
|
|
|
socket = wsgi-sock;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-12-24 23:38:01 +01:00
|
|
|
services.nginx = {
|
2016-02-17 03:12:09 +01:00
|
|
|
enable = mkDefault true;
|
2016-12-24 23:38:01 +01:00
|
|
|
virtualHosts."mybox.connector.one" = {
|
|
|
|
locations = {
|
|
|
|
"/".extraConfig = ''
|
2016-02-17 03:12:09 +01:00
|
|
|
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;
|
2016-12-24 23:38:01 +01:00
|
|
|
'';
|
2016-02-17 03:12:09 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|