1 import ../make-test-python.nix ({pkgs, ...}:
4 meta.maintainers = with pkgs.lib.maintainers; [ izorkin ];
11 { address = "192.168.2.10"; prefixLength = 24; }
14 firewall.allowedTCPPorts = [ 5432 31638 ];
17 services.postgresql = {
20 ensureDatabases = [ "peertube_test" ];
23 name = "peertube_test";
24 ensureDBOwnership = true;
28 hostnossl peertube_test peertube_test 192.168.2.11/32 md5
30 initialScript = pkgs.writeText "postgresql_init.sql" ''
31 CREATE ROLE peertube_test LOGIN PASSWORD '0gUN0C1mgST6czvjZ8T9';
35 services.redis.servers.peertube = {
38 requirePass = "turrQfaQwnanGbcsdhxy";
43 server = { pkgs, ... }: {
46 "peertube/password-init-root".text = ''
47 PT_INITIAL_ROOT_PASSWORD=zw4SqYVdcsXUfRX8aaFX
49 "peertube/secrets-peertube".text = ''
50 063d9c60d519597acef26003d5ecc32729083965d09181ef3949200cbe5f09ee
52 "peertube/password-posgressql-db".text = ''
55 "peertube/password-redis-db".text = ''
64 { address = "192.168.2.11"; prefixLength = 24; }
68 192.168.2.11 peertube.local
70 firewall.allowedTCPPorts = [ 9000 ];
75 localDomain = "peertube.local";
76 enableWebHttps = false;
78 serviceEnvironmentFile = "/etc/peertube/password-init-root";
81 secretsFile = "/etc/peertube/secrets-peertube";
85 host = "192.168.2.10";
86 name = "peertube_test";
87 user = "peertube_test";
88 passwordFile = "/etc/peertube/password-posgressql-db";
92 host = "192.168.2.10";
94 passwordFile = "/etc/peertube/password-redis-db";
102 name = "PeerTube Test Server";
109 environment.systemPackages = [ pkgs.jq pkgs.peertube.cli ];
113 { address = "192.168.2.12"; prefixLength = 24; }
117 192.168.2.11 peertube.local
127 database.wait_for_unit("postgresql.service")
128 database.wait_for_unit("redis-peertube.service")
130 database.wait_for_open_port(5432)
131 database.wait_for_open_port(31638)
133 server.wait_for_unit("peertube.service")
134 server.wait_for_open_port(9000)
136 # Check if PeerTube is running
137 client.succeed("curl --fail http://peertube.local:9000/api/v1/config/about | jq -r '.instance.name' | grep 'PeerTube\ Test\ Server'")
139 # Check PeerTube CLI version
140 client.succeed('peertube-cli auth add -u "http://peertube.local:9000" -U "root" --password "zw4SqYVdcsXUfRX8aaFX"')
141 client.succeed('peertube-cli auth list | grep "http://peertube.local:9000"')
142 client.succeed('peertube-cli auth del "http://peertube.local:9000"')
143 client.fail('peertube-cli auth list | grep "http://peertube.local:9000"')