forked from nixcloud/nixcloud-webservices
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom-webservice.nix
47 lines (40 loc) · 1.33 KB
/
custom-webservice.nix
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
43
44
45
46
let
customWebService = let
submodule = { pkgs, ... }: {
config.webserver.variant = "lighttpd";
config.webserver.lighttpd.extraConfig = ''
server.document-root = "${pkgs.runCommand "docroot" {} ''
mkdir "$out"
echo hello world > "$out/index.html"
''}"
'';
meta.license = null;
};
in import ../lib/make-webservice.nix "custom-foobar" submodule;
in {
name = "custom-webservice";
machine = { lib, ... }: {
imports = lib.singleton customWebService;
nixcloud.reverse-proxy.enable = true;
nixcloud.reverse-proxy.extendEtcHosts = true;
nixcloud.webservices.custom-foobar = {
foo.enable = true;
foo.proxyOptions.TLS = "none";
foo.proxyOptions.domain = "example.com";
foo.proxyOptions.http.mode = "on";
foo.proxyOptions.https.mode = "off";
foo.proxyOptions.port = 8080;
bar.enable = true;
bar.proxyOptions.TLS = "none";
bar.proxyOptions.domain = "example.org";
bar.proxyOptions.http.mode = "on";
bar.proxyOptions.https.mode = "off";
bar.proxyOptions.port = 8081;
};
};
testScript = ''
$machine->waitForUnit('multi-user.target');
$machine->succeed('curl http://example.com/ | grep -qF "hello world"');
$machine->succeed('curl http://example.org/ | grep -qF "hello world"');
'';
}