1{ pkgs, ... }:
2{
3 name = "jibri";
4 meta = with pkgs.lib; {
5 maintainers = teams.jitsi.members;
6 };
7
8 nodes.machine =
9 { config, pkgs, ... }:
10 {
11 virtualisation.memorySize = 5120;
12
13 services.jitsi-meet = {
14 enable = true;
15 hostName = "machine";
16 jibri.enable = true;
17 };
18 services.jibri.ignoreCert = true;
19 services.jitsi-videobridge.openFirewall = true;
20
21 networking.firewall.allowedTCPPorts = [
22 80
23 443
24 ];
25
26 services.nginx.virtualHosts.machine = {
27 enableACME = true;
28 forceSSL = true;
29 };
30
31 security.acme.defaults.email = "me@example.org";
32 security.acme.acceptTerms = true;
33 security.acme.defaults.server = "https://example.com"; # self-signed only
34 };
35
36 testScript = ''
37 machine.wait_for_unit("jitsi-videobridge2.service")
38 machine.wait_for_unit("jicofo.service")
39 machine.wait_for_unit("nginx.service")
40 machine.wait_for_unit("prosody.service")
41 machine.wait_for_unit("jibri.service")
42
43 machine.wait_until_succeeds(
44 "journalctl -b -u prosody -o cat | grep -q 'Authenticated as focus@auth.machine'", timeout=31
45 )
46 machine.wait_until_succeeds(
47 "journalctl -b -u prosody -o cat | grep -q 'Authenticated as jvb@auth.machine'", timeout=32
48 )
49 machine.wait_until_succeeds(
50 "journalctl -b -u prosody -o cat | grep -q 'Authenticated as jibri@auth.machine'", timeout=33
51 )
52 machine.wait_until_succeeds(
53 "cat /var/log/jitsi/jibri/log.0.txt | grep -q 'Joined MUC: jibribrewery@internal.auth.machine'", timeout=34
54 )
55
56 assert '"busyStatus":"IDLE","health":{"healthStatus":"HEALTHY"' in machine.succeed(
57 "curl -X GET http://machine:2222/jibri/api/v1.0/health"
58 )
59 machine.succeed(
60 """curl -H "Content-Type: application/json" -X POST http://localhost:2222/jibri/api/v1.0/startService -d '{"sessionId": "RecordTest","callParams":{"callUrlInfo":{"baseUrl": "https://machine","callName": "TestCall"}},"callLoginParams":{"domain": "recorder.machine", "username": "recorder", "password": "'"$(cat /var/lib/jitsi-meet/jibri-recorder-secret)"'" },"sinkType": "file"}'"""
61 )
62 machine.wait_until_succeeds(
63 "cat /var/log/jitsi/jibri/log.0.txt | grep -q 'File recording service transitioning from state Starting up to Running'", timeout=35
64 )
65 machine.succeed(
66 """sleep 15 && curl -H "Content-Type: application/json" -X POST http://localhost:2222/jibri/api/v1.0/stopService -d '{"sessionId": "RecordTest","callParams":{"callUrlInfo":{"baseUrl": "https://machine","callName": "TestCall"}},"callLoginParams":{"domain": "recorder.machine", "username": "recorder", "password": "'"$(cat /var/lib/jitsi-meet/jibri-recorder-secret)"'" },"sinkType": "file"}'"""
67 )
68 machine.wait_until_succeeds(
69 "cat /var/log/jitsi/jibri/log.0.txt | grep -q 'Finalize script finished with exit value 0'", timeout=36
70 )
71 '';
72}