summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/deployment
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2016-02-17 03:12:09 +0100
committermakefu <github@syntax-fehler.de>2016-02-17 03:12:09 +0100
commitdaaf21193a0104659bb5e17f41331fb7b1fe629c (patch)
treeece0b8f8d9430c7df37cdd4e4379d21946e59c2b /makefu/2configs/deployment
parent513b33e7a207412c30cfbcd00c7df8aaafe2dee7 (diff)
ma 2 mycube: standalone version based on uwsgi
what a motherf*ckn pain
Diffstat (limited to 'makefu/2configs/deployment')
-rw-r--r--makefu/2configs/deployment/mycube.connector.one.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/makefu/2configs/deployment/mycube.connector.one.nix b/makefu/2configs/deployment/mycube.connector.one.nix
new file mode 100644
index 00000000..6a32656b
--- /dev/null
+++ b/makefu/2configs/deployment/mycube.connector.one.nix
@@ -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;
+ '');
+ };
+ };
+ };
+}