-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegration-test.nix
71 lines (61 loc) · 1.72 KB
/
integration-test.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
nixpkgs,
cryptpadModule,
}: {pkgs, ...}: let
certs = import "${nixpkgs}/nixos/tests/common/acme/server/snakeoil-certs.nix";
serverDomain = certs.domain;
in {
name = "cryptpad";
meta.maintainers = with pkgs.lib.maintainers; [michaelshmitty];
nodes.server = {
config,
pkgs,
lib,
...
}: {
virtualisation.memorySize = 4096;
imports = [cryptpadModule];
services.cryptpad = {
enable = true;
configureNginx = false;
settings = {
httpUnsafeOrigin = "https://${serverDomain}";
httpSafeOrigin = "https://${serverDomain}";
};
};
services.nginx = {
enable = true;
recommendedTlsSettings = true;
virtualHosts."${serverDomain}" = {
enableACME = false;
forceSSL = true;
sslCertificate = certs."${serverDomain}".cert;
sslCertificateKey = certs."${serverDomain}".key;
locations."/" = {
proxyPass = "http://localhost:3000";
proxyWebsockets = true;
extraConfig = ''
client_max_body_size 150m;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
'';
};
};
};
security.pki.certificateFiles = [certs.ca.cert];
networking.hosts."::1" = ["${serverDomain}"];
networking.firewall.allowedTCPPorts = [80 443];
};
nodes.client = {
pkgs,
nodes,
...
}: {
networking.hosts."${nodes.server.networking.primaryIPAddress}" = ["${serverDomain}"];
security.pki.certificateFiles = [certs.ca.cert];
};
testScript = ''
server.wait_for_unit("cryptpad.service")
client.wait_for_unit("multi-user.target")
client.wait_until_succeeds("curl --fail https://${serverDomain}/")
'';
}