ma 2 mycube: standalone version based on uwsgi
what a motherf*ckn pain
This commit is contained in:
parent
32e5fc81aa
commit
e8e8c8ee7b
46
2configs/deployment/mycube.connector.one.nix
Normal file
46
2configs/deployment/mycube.connector.one.nix
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
{ 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;
|
||||||
|
external-ip = head config.krebs.build.host.nets.internet.addrs4;
|
||||||
|
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";
|
||||||
|
python2Packages = self: with self; [ pkgs.mycube-flask self.flask self.redis self.werkzeug self.jinja2 self.markupsafe itsdangerous ];
|
||||||
|
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;
|
||||||
|
'');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,28 +0,0 @@
|
||||||
{ config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
with config.krebs.lib;
|
|
||||||
let
|
|
||||||
hostname = config.krebs.build.host.name;
|
|
||||||
external-ip = head config.krebs.build.host.nets.internet.addrs4;
|
|
||||||
in {
|
|
||||||
services.redis.enable = true;
|
|
||||||
|
|
||||||
krebs.nginx = {
|
|
||||||
enable = mkDefault true;
|
|
||||||
servers = {
|
|
||||||
mybox-connector-one = {
|
|
||||||
listen = [ "${external-ip}:80" ];
|
|
||||||
server-names = [
|
|
||||||
"mycube.connector.one"
|
|
||||||
"mybox.connector.one"
|
|
||||||
];
|
|
||||||
locations = singleton (nameValuePair "/" ''
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_pass http://localhost:8001/;
|
|
||||||
'');
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Reference in a new issue