summaryrefslogtreecommitdiff
path: root/flora/services/daemoniones.nix
blob: ae9d3cb748b599a52d279c27645004e20ee3e09c (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
{ config, pkgs, ...}:

{
  systemd.services = 
    let simpledaemon = name: command: {
      enable = true;
      description = name;
      wantedBy = [ "multi-user.target" ];
      serviceConfig.Type = "simple";
      script = command;
    };
  in {
    choclo = simpledaemon "choclo signalling server" "/root/simple-signalling/target/release/chaski -b 127.0.0.1:5000";
    wasi = simpledaemon "wasi backend" "/root/wasi-minimal/target/release/wasi";
#    picarones = simpledaemon "picarones backend" "/root/picarones-server/target/release/picarones -b 127.0.0.1:6000";
  };

  services.nginx = {
    virtualHosts = 
      let websocketproxy = addr: {
        locations."/".proxyPass = addr;
        forceSSL = true;
        enableACME = true;
        locations."/".proxyWebsockets = true;
      };
    in {
      "wasi.stuebinm.eu" = websocketproxy "http://127.0.0.1:9000";
      "choclo.stuebinm.eu" = websocketproxy "http://127.0.0.1:5000";
#      "picarones.stuebinm.eu" = websocketproxy "http://127.0.0.1:6000";
    };
  };


}