summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/deployment/photostore.krebsco.de.nix
blob: ecbca9ea3e119907d1410f41ecfdbcbc34340e30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{ config, lib, pkgs, ... }:
# more than just nginx config but not enough to become a module
with import <stockholm/lib>;
let
  wsgi-sock = "${workdir}/uwsgi-photostore.sock";
  workdir = config.services.uwsgi.runDir;
in {

  services.uwsgi = {
    enable = true;
    user = "nginx";
    runDir = "/var/lib/photostore";
    plugins = [ "python3" ];
    instance = {
      type = "emperor";
      vassals = {
        cameraupload-server = {
          type = "normal";
          pythonPackages = self: with self; [ pkgs.cameraupload-server ];
          socket = wsgi-sock;
        };
      };
    };
  };

  services.nginx = {
    enable = mkDefault true;
    virtualHosts."photostore.krebsco.de" = {
      enableACME = true;
      forceSSL = true;
      locations = {
        "/".extraConfig = ''
        uwsgi_pass                  unix://${wsgi-sock};
        uwsgi_param UWSGI_CHDIR     ${workdir};
        uwsgi_param UWSGI_MODULE    cuserver.main;
        uwsgi_param UWSGI_CALLABLE  app;
        include                     ${pkgs.nginx}/conf/uwsgi_params;
      '';
      };
    };
  };
}