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 = {
21 hostnossl peertube_local peertube_test 192.168.2.11/32 md5
23 initialScript = pkgs.writeText "postgresql_init.sql" ''
24 CREATE ROLE peertube_test LOGIN PASSWORD '0gUN0C1mgST6czvjZ8T9';
25 CREATE DATABASE peertube_local TEMPLATE template0 ENCODING UTF8;
26 GRANT ALL PRIVILEGES ON DATABASE peertube_local TO peertube_test;
27 \connect peertube_local
28 CREATE EXTENSION IF NOT EXISTS pg_trgm;
29 CREATE EXTENSION IF NOT EXISTS unaccent;
33 services.redis.servers.peertube = {
36 requirePass = "turrQfaQwnanGbcsdhxy";
41 server = { pkgs, ... }: {
44 "peertube/password-posgressql-db".text = ''
47 "peertube/password-redis-db".text = ''
56 { address = "192.168.2.11"; prefixLength = 24; }
60 192.168.2.11 peertube.local
62 firewall.allowedTCPPorts = [ 9000 ];
67 localDomain = "peertube.local";
68 enableWebHttps = false;
71 host = "192.168.2.10";
72 name = "peertube_local";
73 user = "peertube_test";
74 passwordFile = "/etc/peertube/password-posgressql-db";
78 host = "192.168.2.10";
80 passwordFile = "/etc/peertube/password-redis-db";
88 name = "PeerTube Test Server";
95 environment.systemPackages = [ pkgs.jq ];
99 { address = "192.168.2.12"; prefixLength = 24; }
103 192.168.2.11 peertube.local
113 database.wait_for_unit("postgresql.service")
114 database.wait_for_unit("redis-peertube.service")
116 database.wait_for_open_port(5432)
117 database.wait_for_open_port(31638)
119 server.wait_for_unit("peertube.service")
120 server.wait_for_open_port(9000)
122 # Check if PeerTube is running
123 client.succeed("curl --fail http://peertube.local:9000/api/v1/config/about | jq -r '.instance.name' | grep 'PeerTube\ Test\ Server'")
125 # Check PeerTube CLI version
126 assert "${pkgs.peertube.version}" in server.succeed('su - peertube -s /bin/sh -c "peertube --version"')