-
Notifications
You must be signed in to change notification settings - Fork 0
/
jitsi-stack.yml
1061 lines (972 loc) · 44 KB
/
jitsi-stack.yml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
heat_template_version: 2016-10-14
###########
parameters:
image_jitsi:
type: string
constraints:
- custom_constraint: glance.image
default: openSUSE 15.6
flavor_jitsi:
type: string
constraints:
- custom_constraint: nova.flavor
#OTC default: s2.large.4
default: SCS-2V-4
wants_volume:
# we can override this to false if the flavor comes with a local disk
type: boolean
default: true
availability_zone:
type: string
#OTC default: eu-de-03
#default: {get_resource: nova.availability_zone}
# This should be passed via the command line
public:
type: string
constraints:
- custom_constraint: neutron.network
#OTC default: admin_external_net
# This can be passed via command line, so let's not set a default
pubkey:
type: string
# Separate multiple names with whitespace
jitsi_user:
type: string
# dito
jitsi_password:
type: string
jitsi_watermark_link:
type: string
default: https://jitsi.org
jitsi_version:
type: string
default: stable-9584-1
#default: stable
# Default 0 is autodetect (using the MTU from the default route's NIC)
# Any other number (e.g. 1440) overrides this.
docker_mtu:
type: number
default: 0
public_domain:
type: string
public_port:
type: number
default: 8443
xmpp_domain:
type: string
default: ""
timezone:
type: string
default: Europe/Amsterdam
# Set to two-letter country code
ui_language:
type: string
default: en
letsenc_domain:
type: string
default: ""
# Empty will default to public_domain
# If you set this, no cert.crt/key will get copied in
letsenc_mail:
type: string
default: ""
# Set to 80 if you use letsenc and don't redirect from 80
letsenc_http_port:
type: number
default: 8000
public_url:
type: string
default: ""
# By default https://{get_param: public_domain}:{get_param: public_port}/ will be used
tweak_ideal_height:
type: number
default: 720
# If you want to enable FHD, set this to 1080
tweak_max_height:
type: number
default: 0
tweak_aspectRatio:
type: string
default: 16/9
# You can only show last 12 speakers or so if you want
tweak_channelLastN:
type: number
default: -1
# STUN servers
stun_servers:
type: string
default: stun.freeswitch.org:3478,stun.1und1.de:3478,stun.linphone.org:3478,stun.t-online.de:3478,meet-jit-si-turnrelay.jitsi.net:443
#default: stun.l.google.com:19302,stun1.l.google.com:19302,stun2.l.google.com:19302
#default: meet-jit-si-turnrelay.jitsi.net:443,freestun.net:3479
# Use STUN servers also for p2p
use_stun_p2p:
type: number
default: 1
# You may set this to turn password, e.g. free
turn_credentials:
type: string
default: ""
# You can set this to host:port, e.g. freestun.net:3479
turn_server:
type: string
default: ""
# You can set this to host:port, e.g. freestun.net:5350
turns_server:
type: string
default: ""
# Fill these vars if you want to set up a bridge to SIP
jigasi_sip_uri:
type: string
default: ""
jigasi_sip_server:
type: string
default: ""
# will be extracted from sip_uri if empty
jigasi_sip_password:
type: string
default: ""
jigasi_sip_transport:
type: string
default: UDP
jigasi_sip_port:
type: number
default: 5060
jigasi_port_min:
type: number
default: 20000
jigasi_port_max:
type: number
default: 20020
# Upstream default is 20050
# Default room for incoming calls
jigasi_default_room:
type: string
default: ""
# Enable WSS (I have never gotten it to work)
enable_websocket:
type: number
default: 0
# Enable AV1 (numeric here, will be transformed to boolean, enables VP9 as well)
enable_av1:
type: number
default: 0
# Enable VP9 (numeric here, will be transformed to boolean)
enable_vp9:
type: number
default: 0
# tweak AV1 bandwidth in kbps low, std, hi, e.g.: 120, 320, 960
av1_bandwidth:
type: string
default: ""
# tweak VP9 bandwidth in kbps low, std, hi, e.g.: 150, 400, 1200
vp9_bandwidth:
type: string
default: ""
# tweak VP8 bandwidth in kbps low, std, hi, e.g.: 200, 500, 1500
vp8_bandwidth:
type: string
default: ""
# tweak opus rate (in kpbs, default is 20)
tweak_opusMaxAvgRate:
type: number
default: 0
# tweak opus redundancy (bool)
tweak_opusRed:
type: boolean
default: false
# switch on stereo
enable_stereo:
type: number
default: 0
# tweak limit after which participants join with muted audio
# increasing it beyond the no of participants might avoid audio trouble
# https://github.com/jitsi/jitsi-meet/issues/5230
tweak_AudioMuted:
type: number
default: 12
# tweak limit after which participants join with muted video
tweak_VideoMuted:
type: number
default: 12
# tweak MAXMEM for JVB (MiB), use 6144 to double allowed mem for JVB
# Default of 0 leaves this alone
tweak_jvbMaxmem:
type: number
default: 0
# Enable Prejoin Page -- Chrome requires it now
# https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio
enable_prejoin:
type: number
default: 1
# https://community.jitsi.org/t/screensharing-crashing-when-using-vp9/103411/6
disable_screenshare_framerate:
type: number
default: 0
# Avoid disabling harvester
disable_tcp_harvester:
type: boolean
default: true
# Needs public heat EP tweak
workaround_heat_internal_ep_broken:
type: boolean
default: false
# Enable etherpad
enable_etherpad:
type: boolean
default: false
# Enable whiteboard
enable_whiteboard:
type: boolean
default: false
# Enable jibri
enable_jibri:
type: boolean
default: false
description: Heat stack for Jitsi deployment using docker-jitsi-meet
##########
resources:
#########
# Generic
#########
jitsi_key:
type: OS::Nova::KeyPair
properties:
name: {get_param: "OS::stack_name"}
public_key: {get_param: pubkey}
#save_private_key: true
jitsi_wait_handle:
type: OS::Heat::WaitConditionHandle
jitsi_wait_condition:
type: OS::Heat::WaitCondition
properties:
handle: {get_resource: jitsi_wait_handle}
timeout: 1500
jitsi_boot_config:
type: OS::Heat::CloudConfig
properties:
cloud_config:
package_update: true
package_upgrade: true
packages:
- docker
- docker-compose
- make
- pwgen
- curl
- systemd-sysvcompat
write_files:
- content: {get_file: cert.crt}
path: /root/cert.crt
permissions: '0644'
- content: {get_file: cert.key}
path: /root/cert.key
permissions: '0600'
- content: {get_file: jvb-xmpp-domain.diff}
path: /root/jvb-xmpp-domain.diff
permissions: '0644'
- content: {get_file: fixup-welcome.sed}
path: /root/fixup-welcome.sed
permissions: '0644'
- content: {get_file: fixup-transcription.sed}
path: /root/fixup-transcription.sed
permissions: '0644'
- content:
str_replace:
params:
jitsi_version: {get_param: jitsi_version}
letsenc_mail: {get_param: letsenc_mail}
tweak_jvbMaxmem: {get_param: tweak_jvbMaxmem}
template: |
#!/usr/bin/env bash
export USER=root
export USERNAME=$USER
export HOME=/$USER
cd ~
mkdir -p ~/.jitsi-meet-cfg/{web/letsencrypt,web/nginx,transcripts,prosody,jicofo,jvb,jigasi/log}
chown 999:1000 ~/.jitsi-meet-cfg/jigasi/log
# Generate Diffie-Hellmann parameters for SSL
openssl dhparam -out ~/.jitsi-meet-cfg/web/nginx/dhparams.pem 2048 &
systemctl stop SuSEfirewall2
sysctl -w net.ipv4.ip_forward=1
systemctl enable docker
systemctl restart docker
git clone https://github.com/jitsi/docker-jitsi-meet
cd docker-jitsi-meet
git checkout jitsi_version
# XMPP_WEBSOCKET breaks us, disable in .env later
#git revert 465816b4ebf2babf1b9e6daf007301c1fd17552e
# Move jvb into XMPP domain -- no longer used
#patch -p1 < ../jvb-xmpp-domain.diff
# We can safely ignore hanging pipstrap if we are not using letsenc
if test -z "letsenc_mail"; then
sed -i 's/\(certbot\-auto \-\-noninteractive.*$\)/timeout 21 \1 || true/' web/Dockerfile
fi
# FIXME: Pin to stable-5765-1 version for jitsi-meet-web/-config
#sed -i '/apt-get/s/jitsi\-meet\-web\(\-config\|\) /jitsi-meet-web\1=1.0.4900-1 /g' web/Dockerfile
# Inject icon/watermark
if test -r /root/favicon.ico -a $(stat -c %s /root/favicon.ico) -gt 0; then
mkdir -p web/rootfs/usr/share/jitsi-meet/images
cp -p /root/favicon.ico web/rootfs/usr/share/jitsi-meet/images/favicon.ico
cp -p /root/favicon.ico web/rootfs/usr/share/jitsi-meet/favicon.ico
fi
if test -r /root/watermark.svg -a $(stat -c %s /root/watermark.svg) -gt 0; then
mkdir -p web/rootfs/usr/share/jitsi-meet/images
cp -p /root/watermark.svg web/rootfs/usr/share/jitsi-meet/images/watermark.svg
fi
# Copy rootfs after installing packages, so files can be overwritten
#sed -i 's@^COPY rootfs@#COPY rootfs@' web/Dockerfile
#sed -i "s@^\(.*rm \-rf /tmp/pkg.*$\)@\1\n\nCOPY rootfs/ /@" web/Dockerfile
sed -i "/^EXPOSE/a\\\nCOPY rootfs/ /" web/Dockerfile
# Workaround 5765 issues: https://github.com/jitsi/docker-jitsi-meet/issues/1018
# Update the configuration
if ! grep "client\-proxy" jicofo/rootfs/defaults/jicofo.conf >/dev/null; then
sed -i -E '/^\s+disable-certificate-verification = true/a \\tclient-proxy = "focus.{{ .Env.XMPP_DOMAIN }}"' jicofo/rootfs/defaults/jicofo.conf
fi
# Replace tag - by default, it is "stable-XXXX" but we want to use "latest", which is the one built by Makefile
for nm in docker-compose.yml jigasi.yml jibri.yml; do sed -i 's/:\-stable\-[5-9][0-9-]*/:latest/' $nm; done
# End workarounds
# jvbMaxmem tweaks
JVBMM=tweak_jvbMaxmem
JVBMM=${JVBMM%m}
# Avoid crazily low values
if test $JVBMM -ge 1536; then
mkdir -p jvb/rootfs/usr/share/jitsi-videobridge/lib/
echo -e "# Max mem for JVB (64bit Linux Java -Xmx), default 3072m\nVIDEOBRIDGE_MAX_MEMORY=${JVBMM}m\n" > jvb/rootfs/usr/share/jitsi-videobridge/lib/videobridge.rc
echo -e "# Enable this for debugging\n# VIDEOBRIDGE_DEBUG_OPTIONS=\"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000\"" >> jvb/rootfs/usr/share/jitsi-videobridge/lib/videobridge.rc
fi
#make JITSI_RELEASE=stable
# Use buildx build procedure
mkdir -p ~/.docker/cli-plugins
curl -LO https://github.com/docker/buildx/releases/download/v0.11.0/buildx-v0.11.0.linux-amd64
mv buildx-v0.11.0.linux-amd64 ~/.docker/cli-plugins/docker-buildx
chmod +x ~/.docker/cli-plugins/docker-buildx
sed -i -e 's@,linux/arm64@@g' -e 's/ \-\-push//g' Makefile
# Fixup chrome download
sed -i '[email protected]/edgedl/chrome/chrome-for-testing/@/storage.googleapis.com/chrome-for-testing-public/@g' jibri/rootfs/usr/bin/install-chrome.sh
make buildx-all JITSI_BUILD=stable JITSI_RELEASE=latest
path: /root/build-jitsi.sh
permissions: '0700'
- content:
str_replace:
params:
xmpp_domain: {get_param: xmpp_domain}
public_domain: {get_param: public_domain}
public_port: {get_param: public_port}
public_url: {get_param: public_url}
timezone: {get_param: timezone}
letsenc_mail: {get_param: letsenc_mail}
letsenc_domain: {get_param: letsenc_domain}
letsenc_http_port: {get_param: letsenc_http_port}
stun_servers: {get_param: stun_servers}
turn_credentials: {get_param: turn_credentials}
turn_server: {get_param: turn_server}
turns_server: {get_param: turns_server}
jigasi_sip_uri: {get_param: jigasi_sip_uri}
jigasi_sip_server: {get_param: jigasi_sip_server}
jigasi_sip_password: {get_param: jigasi_sip_password}
jigasi_sip_transport: {get_param: jigasi_sip_transport}
jigasi_sip_port: {get_param: jigasi_sip_port}
jigasi_port_min: {get_param: jigasi_port_min}
jigasi_port_max: {get_param: jigasi_port_max}
enable_av1: {get_param: enable_av1}
enable_vp9: {get_param: enable_vp9}
tweak_opusRed: {get_param: tweak_opusRed}
enable_websocket: {get_param: enable_websocket}
enable_prejoin: {get_param: enable_prejoin}
enable_etherpad: {get_param: enable_etherpad}
enable_whiteboard: {get_param: enable_whiteboard}
floating_ip: {get_attr: [jitsi_floating_ip, floating_ip_address]}
disable_tcp_harvester: {get_param: disable_tcp_harvester}
disable_screenshare_framerate: {get_param: disable_screenshare_framerate}
template: |
#!/usr/bin/env bash
export USER=root
export USERNAME=$USER
export HOME=/$USER
cd ~/docker-jitsi-meet
cp -p docker-compose.yml etherpad.yml jigasi.yml jibri.yml whiteboard.yml ~
cp -p env.example ~/.env
cd ..
sed -i 's@etherpad/etherpad:2.0.3@etherpad/etherpad:latest@' etherpad.yml
for nm in *.yml; do sed -i 's@^\( *image: jitsi/[^:]*\):.*$@\1:latest@g' $nm; done
sed -i 's@jitsi/excalidraw-backend:latest@jitsi/excalidraw-backend:21@' whiteboard.yml
chmod 0600 .env
# This is only used internally
#sed -i 's/passw0rd/p@33W0rd/g' .env
cp -p docker-jitsi-meet/gen-passwords.sh .
./gen-passwords.sh
# Set input parameters
if test -n "xmpp_domain"; then sed -i 's/meet\.jitsi/xmpp_domain/g' .env; fi
PUBLIC_URL="public_url"
if test -z "$PUBLIC_URL"; then PUBLIC_URL="https://public_domain:public_port/"; fi
sed -i "s@^#PUBLIC_URL=.*\$@PUBLIC_URL=$PUBLIC_URL@" .env
IP=$(ip addr show eth0 | grep 'inet ' | sed 's@^ *inet \([0-9\.]*\)/\([0-9]*\) .*$@\1@')
sed -i "s@^#DOCKER_HOST_ADDRESS=.*\$@#DOCKER_HOST_ADDRESS=$IP\nDOCKER_HOST_ADDRESS=floating_ip@" .env
sed -i "s@^#JVB_ADVERTISE_IPS=.*\$@#JVB_ADVERTISE_IPS=$IP,floating_ip\nJVB_ADVERTISE_IPS=floating_ip@" .env
if test -n "letsenc_mail"; then
sed -i 's/^#LETSENCRYPT_EMAIL=.*$/LETSENCRYPT_EMAIL=letsenc_mail/' .env
LETSENC_DOM="letsenc_domain"
if test -z "$LETSENC_DOM"; then LETSENC_DOM="public_domain"; fi
sed -i "s@^#LETSENCRYPT_DOMAIN=.*\$@LETSENCRYPT_DOMAIN=$LETSENC_DOM@" .env
sed -i 's@^#ENABLE_LETSENCRYPT=1@ENABLE_LETSENCRYPT=1@' .env
fi
sed -i 's@HTTP_PORT=.*$@HTTP_PORT=letsenc_http_port@' .env
sed -i 's@HTTPS_PORT=.*$@HTTPS_PORT=public_port@' .env
sed -i 's@TZ=.*$@TZ=timezone@' .env
#sed -i 's@^#ETHERPAD_URL_BASE@ETHERPAD_URL_BASE@' .env
sed -i 's@^#ENABLE_AUTH@ENABLE_AUTH@' .env
sed -i 's@^#ENABLE_GUESTS@ENABLE_GUESTS@' .env
sed -i 's@^#*ENABLE_PREJOIN_PAGE=.*@ENABLE_PREJOIN_PAGE=enable_prejoin@' .env
sed -i 's@^#AUTH_TYPE=@AUTH_TYPE=@' .env
#sed -i 's@^JVB_STUN_SERVERS=.*$@JVB_STUN_SERVERS=stun_servers@' .env
echo "JVB_STUN_SERVERS=stun_servers" >> .env
# JIGASI
JIGASI_SIP_URI="jigasi_sip_uri"
if test -n "$JIGASI_SIP_URI"; then
JIGASI_SIP_SERVER="jigasi_sip_server"
if test -z "$JIGASI_SIP_SERVER"; then JIGASI_SIP_SERVER="${JIGASI_SIP_URI##*@}"; fi
sed -i "s/^#JIGASI_SIP_URI=.*\$/JIGASI_SIP_URI=$JIGASI_SIP_URI/" .env
sed -i "s/^#JIGASI_SIP_SERVER=.*\$/JIGASI_SIP_SERVER=$JIGASI_SIP_SERVER/" .env
sed -i 's@^#JIGASI_SIP_PASSWORD=.*$@JIGASI_SIP_PASSWORD=jigasi_sip_password@' .env
sed -i 's@^#JIGASI_SIP_TRANSPORT=.*$@JIGASI_SIP_TRANSPORT=jigasi_sip_transport@' .env
sed -i 's@^#JIGASI_SIP_PORT=.*$@JIGASI_SIP_PORT=jigasi_sip_port@' .env
if grep '^JIGASI_PORT_MIN=' .env >/dev/null; then
sed -i 's@^JIGASI_PORT_MIN=.*$@JIGASI_PORT_MIN=jigasi_port_min@' .env
sed -i 's@^JIGASI_PORT_MAX=.*$@JIGASI_PORT_MAX=jigasi_port_max@' .env
else
echo "JIGASI_PORT_MIN=jigasi_port_min" >> .env
echo "JIGASI_PORT_MAX=jigasi_port_max" >> .env
fi
fi
# En/Disable Websockets
sed -i 's/^ENABLE_XMPP_WEBSOCKET=/#ENABLE_XMPP_WEBSOCKET=/' .env
sed -i 's/^ENABLE_COLIBRI_WEBSOCKET=/#ENABLE_COLIBRI_WEBSOCKET=/' .env
echo "ENABLE_XMPP_WEBSOCKET=enable_websocket" >> .env
echo "ENABLE_COLIBRI_WEBSOCKET=enable_websocket" >> .env
if test "enable_websocket" = "0"; then echo "ENABLE_SCTP=1" >> .env
else echo "ENABLE_SCTP=0" >> .env; fi
if test "enable_av1" != "0"; then echo -e "ENABLE_CODEC_VP9=true\nENABLE_CODEC_AV1=true\nTESTING_AV1_SUPPORT=true" >> .env;
elif test "enable_vp9" != "0"; then echo "ENABLE_CODEC_VP9=true" >> .env; fi
if test "tweak_opusRed" != "False"; then echo "ENABLE_CODEC_OPUS_RED=true" >> .env; fi
DIS_HARV=$(echo disable_tcp_harvester | tr A-Z a-z)
sed -i "s/\(JVB_TCP_HARVESTER_DISABLED=\).*/\1$DIS_HARV/" .env
if test "enable_etherpad" = "True"; then
sed -i 's/^#ETHERPAD_URL_BASE/ETHERPAD_URL_BASE/' .env
sed -i "s@^#ETHERPAD_PUBLIC_URL=.*\$@ETHERPAD_PUBLIC_URL=${PUBLIC_URL}etherpad/p/@" .env
sed -i 's/ETHERPAD_DEFAULT_PAD_TEXT=.*$/ETHERPAD_DEFAULT_PAD_TEXT="Ephemeral(!) Web Chat.\n"/' .env
fi
if test "enable_whiteboard" = "True"; then
sed -i 's/^#WHITEBOARD_COLLAB_SERVER_URL_BASE/WHITEBOARD_COLLAB_SERVER_URL_BASE/' .env
fi
if test -n "turn_credentials"; then
echo "TURN_CREDENTIALS=\"turn_credentials\"" >> .env
fi
if test -n "turn_server"; then
TURN_SRV="turn_server"
echo "TURN_HOST=${TURN_SRV%:*}" >> .env
echo "TURN_PORT=${TURN_SRV##*:}" >> .env
fi
if test -n "turns_server"; then
TURNS_SRV="turns_server"
echo "TURNS_HOST=${TURNS_SRV%:*}" >> .env
echo "TURNS_PORT=${TURNS_SRV##*:}" >> .env
fi
if test "disable_screenshare_framerate" != "0"; then
# https://github.com/jitsi/docker-jitsi-meet/pull/1674
echo "DESKTOP_SHARING_FRAMERATE_AUTO=true" >> .env
else
echo "DESKTOP_SHARING_FRAMERATE_MIN=2" >> .env
echo "DESKTOP_SHARING_FRAMERATE_MAX=10" >> .env
fi
path: /root/config-env.sh
permissions: '0700'
- content:
str_replace:
params:
xmpp_domain: {get_param: xmpp_domain}
wc_notify: {get_attr: ['jitsi_wait_handle', 'curl_cli']}
jitsi_user: {get_param: jitsi_user}
jitsi_password: {get_param: jitsi_password}
jitsi_watermark_link: {get_param: jitsi_watermark_link}
ui_language: {get_param: ui_language}
letsenc_mail: {get_param: letsenc_mail}
tweak_ideal_height: {get_param: tweak_ideal_height}
tweak_max_height: {get_param: tweak_max_height}
tweak_aspectRatio: {get_param: tweak_aspectRatio}
tweak_channelLastN: {get_param: tweak_channelLastN}
tweak_AudioMuted: {get_param: tweak_AudioMuted}
tweak_VideoMuted: {get_param: tweak_VideoMuted}
jigasi_sip_uri: {get_param: jigasi_sip_uri}
jigasi_default_room: {get_param: jigasi_default_room}
stun_servers: {get_param: stun_servers}
use_stun_p2p: {get_param: use_stun_p2p}
turn_credentials: {get_param: turn_credentials}
turn_server: {get_param: turn_server}
turns_server: {get_param: turns_server}
enable_av1: {get_param: enable_av1}
enable_vp9: {get_param: enable_vp9}
av1_bandwidth: {get_param: av1_bandwidth}
vp9_bandwidth: {get_param: vp9_bandwidth}
vp8_bandwidth: {get_param: vp8_bandwidth}
tweak_opusMaxAvgRate: {get_param: tweak_opusMaxAvgRate}
tweak_opusRed: {get_param: tweak_opusRed}
enable_stereo: {get_param: enable_stereo}
enable_etherpad: {get_param: enable_etherpad}
enable_whiteboard: {get_param: enable_whiteboard}
enable_jibri: {get_param: enable_jibri}
template: |
#!/usr/bin/env bash
export USER=root
export USERNAME=$USER
export HOME=/$USER
cd ~
DFILES="-f ~/docker-compose.yml"
if test -n "jigasi_sip_uri"; then
DFILES="$DFILES -f ~/jigasi.yml"
fi
if test "enable_jibri" = "True"; then
DFILES="$DFILES -f ~/jibri.yml"
fi
if test "enable_etherpad" = "True"; then
DFILES="$DFILES -f ~/etherpad.yml"
fi
if test "enable_etherpad" = "True"; then
DFILES="$DFILES -f ~/whiteboard.yml"
fi
eval docker-compose $DFILES up -d
WEBCFG=~/.jitsi-meet-cfg/web/config.js
WEBIFCFG=~/.jitsi-meet-cfg/web/interface_config.js
# Wait up to two mins for web config (due to wait for letsenc certificate)
declare -i ctr=0
while test ! -e $WEBCFG -a $ctr -le 120; do
sleep 1
let ctr+=1
done
# Only if not using LETSENCRYPT
if test -z "letsenc_mail"; then
cp -p cert.crt ~/.jitsi-meet-cfg/web/keys/cert.crt
cp -p cert.key ~/.jitsi-meet-cfg/web/keys/cert.key
else
chmod og-r ~/.jitsi-meet-cfg/web/letsencrypt/$LETSENC_DOM/privkey.pem
cp -p ~/.jitsi-meet-cfg/web/letsencrypt/$LETSENC_DOM/privkey.pem cert.key
cp -p ~/.jitsi-meet-cfg/web/letsencrypt/$LETSENC_DOM/fullchain.pem cert.crt
fi
sleep 1
cp -p $WEBCFG $WEBCFG.orig
# Apply fixes
sed -f fixup-welcome.sed -f fixup-transcription.sed -i $WEBCFG
# Does no longer work in newer templates
ASPECT="16/9"
if test -n "tweak_aspectRatio"; then
#sed -i "s@aspectRatio: [0-9/, ]*\$@aspectRatio: tweak_aspectRatio@" $WEBCFG
ASPECT="tweak_aspectRatio"
fi
if test -n "tweak_ideal_height" -a "tweak_ideal_height" != "0"; then
# New config style
WIDTH=$((tweak_ideal_height*$ASPECT))
sed -i 's@^\(config\.resolution =\).*$@\1 tweak_ideal_height;@' $WEBCFG
sed -i "s@^\(config\.constraints\.video\.height = { ideal:\) [0-9]*,@\1 tweak_ideal_height,@" $WEBCFG
sed -i "s@^\(config\.constraints\.video\.width = { ideal:\) [0-9]*,@\1 $WIDTH,@" $WEBCFG
fi
if test -n "tweak_max_height" -a "tweak_max_height" != "0"; then
#sed -i "s@^\([^/]*max:\)[ 0-9]*,\$@\1 tweak_max_height,@" $WEBCFG
WIDTH=$((tweak_max_height*$ASPECT))
sed -i "s@^\(config\.constraints\.video\.height = { ideal: [0-9]*, max:\) [0-9]*,@\1 tweak_max_height,@" $WEBCFG
sed -i "s@^\(config\.constraints\.video\.width = { ideal: [0-9]*, max:\) [0-9]*,@\1 $WIDTH,@" $WEBCFG
fi
# TODO: Ensure Simulcast is NOT disabled
#sed -i 's@^ */* *disableSimulcast:.*$@ disableSimulcast: false,@' $WEBCFG
# TODO: Add tweak to enableLayerSuspension
sed -i "/config\.disableSimulcast/aconfig.enableLayerSuspension = true;" $WEBCFG
# TODO: Allow SuspendVideo
#sed -i "/config\.enableLayerSuspension/aconfig.disableSuspendVideo = false;" $WEBCFG
echo "// Overrides by run.sh (heat-docker-jitsi-meet)" >> $WEBCFG
if test -n "tweak_channelLastN" -a "tweak_channelLastN" != "-1"; then
echo "config.channelLastN = tweak_channelLastN;" >> $WEBCFG
else
echo "config.lastNLimits = { 5:20, 30:15, 50:10, 70:5, 90:2 };" >> $WEBCFG
fi
#sed -i 's@^ */* *requireDisplayName:.*$@ requireDisplayName: true,@' $WEBCFG
sed -i 's@^config\.requireDisplayName = .*[email protected] = true;@' $WEBCFG
if test "ui_language" != "en"; then
#sed -i "s@^ */* *defaultLanguage:.*\$@ defaultLanguage: 'ui_language',@" $WEBCFG
echo "config.defaultLanguage = 'ui_language';" >> $WEBCFG
fi
if test -n "jitsi_watermark_link"; then
sed -i "s@JITSI_WATERMARK_LINK: '.*'@JITSI_WATERMARK_LINK: 'jitsi_watermark_link'@" $WEBIFCFG
fi
if test "use_stun_p2p" != "0"; then
echo -n "config.p2p.stunServers = [" >> $WEBCFG
echo -n "stun_servers" | sed "s/\([^,]*\)/ { urls: 'stun:\1' }/g" >> $WEBCFG
if test -n "turn_credentials"; then
TURNCRED=", username: 'turn_credentials', credential: 'turn_credentials'"
fi
if test -n "turns_server"; then
echo -n "turns_server" | sed "s/\([^,]*\)/, { urls: 'turns:\1'$TURNCRED }/g" >> $WEBCFG
fi
if test -n "turn_server"; then
echo -n "turn_server" | sed "s/\([^,]*\)/, { urls: 'turn:\1'$TURNCRED}/g" >> $WEBCFG
fi
echo " ];" >> $WEBCFG
if test -n "turn_server" -o -n "turns_server"; then
echo "config.p2p.useStunTurn = true;" >> $WEBCFG
fi
fi
if test -n "turn_server" -o -n "turns_server"; then
echo "config.useStunTurn = true;" >> $WEBCFG
fi
if test "enable_av1" != "0"; then
echo "config.videoQuality.preferredCodec = 'AV1';" >> $WEBCFG
echo "config.p2p.preferredCodec = 'AV1';" >> $WEBCFG
elif test "enable_vp9" != "0"; then
#sed -i "s@^\( *\)\/\/ \( *preferredCodec: \).*\$@\1\2'VP9',@" $WEBCFG
echo "config.videoQuality.preferredCodec = 'VP9';" >> $WEBCFG
echo "config.p2p.preferredCodec = 'VP9';" >> $WEBCFG
fi
if test "tweak_opusMaxAvgRate" != 0 -o "tweak_opusRed" != "False" -o "enable_stereo" != 0 -o "enable_av1" != 0; then
echo "//config.testing = {};" >> $WEBCFG
echo "config.testing.audioQuality = {};" >> $WEBCFG
fi
if test "enable_av1" != "0"; then
echo "config.p2p.codecPreferenceOrder = ['AV1', 'VP9', 'VP8', 'H264'];" >> $WEBCFG
echo "config.videoQuality.codecPreferenceOrder = ['AV1', 'VP9', 'VP8', 'H264'];" >> $WEBCFG
echo "config.testing.enableAv1 = true;" >> $WEBCFG
fi
if test -n "av1_bandwidth" -o -n "vp9_bandwidth" -o -n "vp8_bandwidth"; then
echo "config.videoQuality.maxBitratesVideo = {};" >> $WEBCFG
fi
if test -n "av1_bandwidth"; then
echo "av1_bandwidth" | sed 's@^\([0-9]*\), *\([0-9]*\), *\([0-9]*\) *[email protected] = { low: \1000, standard: \2000, high: \3000 };@' >> $WEBCFG
fi
if test -n "vp9_bandwidth"; then
echo "vp9_bandwidth" | sed 's@^\([0-9]*\), *\([0-9]*\), *\([0-9]*\) *[email protected] = { low: \1000, standard: \2000, high: \3000 };@' >> $WEBCFG
fi
if test -n "vp8_bandwidth"; then
echo "vp8_bandwidth" | sed 's@^\([0-9]*\), *\([0-9]*\), *\([0-9]*\) *[email protected] = { low: \1000, standard: \2000, high: \3000 };@' >> $WEBCFG
fi
if test "tweak_AudioMuted" != 0; then
sed -i 's@^[/ ]*config\.startAudioMuted = .*[email protected] = tweak_AudioMuted;@' $WEBCFG
fi
if test "tweak_VideoMuted" != 0; then
sed -i 's@^[/ ]*config\.startVideoMuted = .*[email protected] = tweak_VideoMuted;@' $WEBCFG
fi
if test "tweak_opusMaxAvgRate" != 0; then
echo "config.testing.audioQuality.opusMaxAverageBitrate = tweak_opusMaxAvgRate000;" >> $WEBCFG
fi
if test "tweak_opusRed" != "False"; then
echo "config.testing.audioQuality.enableOpusRed = $(echo 'tweak_opusRed' | tr A-Z a-z);" >> $WEBCFG
fi
if test "enable_stereo" != 0; then
echo "config.testing.audioQuality.stereo = true;" >> $WEBCFG
fi
#echo "config.desktopSharingFrameRate = { min: 2, max: 10 };" >> $WEBCFG
sleep 1
# Deploy users
if test -n "xmpp_domain"; then XMPP_DOMAIN=xmpp_domain; else XMPP_DOMAIN=meet.jitsi; fi
USERS=(jitsi_user); PASSW=(jitsi_password)
for idx in $(seq 0 $((${#USERS[*]}-1))); do
docker exec root-prosody-1 prosodyctl --config /config/prosody.cfg.lua register ${USERS[$idx]} $XMPP_DOMAIN ${PASSW[$idx]}
done
# Restart nginx in web container to make SSL/height changes effective
#docker restart root-web-1
NGINX=$(ps -x | grep "nginx: master" | grep -v grep | awk '{ print $1; }')
kill $NGINX
# Dial-In
if test -n "jigasi_sip_uri"; then
# Tweak jigasi default room
PROP=~/.jitsi-meet-cfg/jigasi/sip-communicator.properties
cp -p $PROP $PROP.orig
echo "## Options added by run.sh script from heat-docker-jitsi-meet" >> $PROP
if test -n "jigasi_default_room"; then
echo "org.jitsi.jigasi.DEFAULT_JVB_ROOM_NAME=jigasi_default_room@muc.$XMPP_DOMAIN" >> $PROP
fi
# enable GSM, Speex, SILK (better compat)
sed -i '[email protected]/8000=0@net.java.sip.communicator.impl.protocol.sip.acc1.Encodings.GSM/8000=690@' $PROP
# Do not enable this
#sed -i '/net.java.sip.communicator.impl.protocol.sip.acc1.Encodings.opus\/48000=1000/a net.java.sip.communicator.impl.protocol.sip.acc1.Encodings.opus/24000=900' $PROP
sed -i 's@net.java.sip.communicator.impl.protocol.sip.acc1.Encodings.speex/32000=0@net.java.sip.communicator.impl.protocol.sip.acc1.Encodings.speex/32000=25@' $PROP
sed -i 's@net.java.sip.communicator.impl.protocol.sip.acc1.Encodings.speex/16000=0@net.java.sip.communicator.impl.protocol.sip.acc1.Encodings.speex/16000=20@' $PROP
#sed -i 's@net.java.sip.communicator.impl.protocol.sip.acc1.Encodings.SILK/16000=0@net.java.sip.communicator.impl.protocol.sip.acc1.Encodings.SILK/16000=15@' $PROP
# avoid immediate call back
echo "net.java.sip.communicator.impl.protocol.sip.SKIP_REINVITE_ON_FOCUS_CHANGE_PROP=true" >> $PROP
# This is needed for sipgate, no more according to my testing
echo "org.jitsi.impl.neomedia.transform.csrc.CsrcTransformEngine.DISCARD_CONTRIBUTING_SOURCES=true" >> $PROP
# Wait 7mins for room opening
echo "org.jitsi.jigasi.JVB_INVITE_TIMEOUT=420000" >> $PROP
# And restart jigasi container
docker restart root-jigasi-1
fi
# Favor UDP video/audio path to preempt other processes
renice -n -5 $(ps axl | grep jvb | grep java | awk '{print $3;}')
renice -n -5 $(ps axlw | grep docker-proxy | grep 10000 | awk '{print $3;}')
# Signal completion
# Note: Optionally replace internal with public endpoint (heat-public-ep.sh)
wc_notify --data-binary '{"status": "SUCCESS"}'
path: /root/run.sh
permissions: '0700'
- content:
str_replace:
params:
jigasi_sip_uri: {get_param: jigasi_sip_uri}
enable_etherpad: {get_param: enable_etherpad}
enable_whiteboard: {get_param: enable_whiteboard}
template: |
#!/bin/bash
export USER=root
export USERNAME=$USER
export HOME=/$USER
cd ~
DFILES="-f ~/docker-compose.yml"
if test -n "jigasi_sip_uri"; then
DFILES="$DFILES -f ~/jigasi.yml"
fi
if test "enable_etherpad" = "True"; then
DFILES="$DFILES -f ~/etherpad.yml"
fi
if test "enable_whiteboard" = "True"; then
DFILES="$DFILES -f ~/whiteboard.yml"
fi
eval docker-compose $DFILES down
path: /root/down.sh
permissions: '0750'
- content: |
#!/bin/bash
if test "$1" = "status"; then
docker ps
elif test "$1" = "start"; then
/root/run.sh
elif test "$1" = "stop"; then
/root/down.sh
elif test "$1" = "restart"; then
/root/down.sh
/root/up.sh
else
echo "Unknown command \"$1\""
exit 3
fi
path: /etc/init.d/boot.local
permissions: '0755'
- content:
str_replace:
params:
docker_mtu: {get_param: docker_mtu}
template: |
{
"mtu": docker_mtu
}
path: /tmp/daemon.json
permissions: '0644'
- encoding: gz+b64
content: {get_file: watermark.svg.gz}
path: /root/watermark.svg
permissions: '0644'
- encoding: gz+b64
content: {get_file: favicon.ico.gz}
path: /root/favicon.ico
permissions: '0644'
- content: |
#!/bin/bash
DEV=$(ip route show default | head -n1 | sed 's/^.*dev \([^ ]*\).*$/\1/')
MTU=$(ip link show $DEV | head -n1 | sed 's/^.*mtu \([0-9]*\) .*$/\1/')
if grep '"mtu": 0' /tmp/daemon.json >/dev/null; then
sed -i "s/: 0/: $MTU/" /tmp/daemon.json
fi
path: /root/set_mtu.sh
permissions: '0755'
- content: |
#!/bin/bash
declare -i ctr=0
echo -n "Waiting for DNS to work: "
while test $ctr -le 360; do
if getent hosts download.opensuse.org >/dev/null 2>&1; then break; fi
echo -n "."
sleep 10
let ctr+=1
done
if test $ctr -gt 360; then echo "FAIL ($((10*$ctr))s)"; exit 1; else echo "SUCCESS ($((10*$ctr))s)"; fi
path: /root/wait-dns.sh
permissions: '0755'
- content: {get_file: heat-public-ep.sh}
path: /root/heat-public-ep.sh
permissions: '0750'
- content:
str_replace:
params:
workaround_heat_internal_ep_broken: {get_param: workaround_heat_internal_ep_broken}
template: |
#!/bin/bash
if test "workaround_heat_internal_ep_broken" = "True"; then /root/heat-public-ep.sh; fi
permissions: '0755'
path: /root/heat-adjust.sh
- content: {get_file: adjust-docker-compose-version.sh}
path: /root/adjust-docker-compose-version.sh
permissions: '0755'
runcmd:
- "/root/set_mtu.sh"
- "mv /tmp/daemon.json /etc/docker/daemon.json"
- "systemctl enable docker"
- "/root/wait-dns.sh"
- "/root/build-jitsi.sh"
- "/root/config-env.sh"
- "sed -i \"/After=/iAfter=docker.service\" /usr/lib/systemd/system/rc-local.service"
- "/root/heat-adjust.sh"
- "/root/adjust-docker-compose-version.sh"
- "/root/run.sh"
final_message: "The system is finally up, after $UPTIME seconds"
#################
# Security groups
#################
security_group_jitsi:
type: OS::Neutron::SecurityGroup
properties:
name: {get_param: "OS::stack_name"}
rules:
# admin access
- remote_ip_prefix: 0.0.0.0/0
protocol: tcp
port_range_min: 22
port_range_max: 22
# Port 8000/80 (letsenc_http_port) needed for letsenc acme challenge
- remote_ip_prefix: 0.0.0.0/0
protocol: tcp
port_range_min: {get_param: letsenc_http_port}
port_range_max: {get_param: letsenc_http_port}
- remote_ip_prefix: 0.0.0.0/0
protocol: icmp
# Harvester
- remote_ip_prefix: 0.0.0.0/0
protocol: tcp
port_range_min: 4443
port_range_max: 4443
# The Web frontend
- remote_ip_prefix: 0.0.0.0/0
protocol: tcp
port_range_min: {get_param: public_port}
port_range_max: {get_param: public_port}
# Jitsi Video Bridge
- remote_ip_prefix: 0.0.0.0/0
protocol: udp
port_range_min: 10000
port_range_max: 10010
# SIP
- remote_ip_prefix: 0.0.0.0/0
protocol: udp
port_range_min: {get_param: jigasi_port_min}
port_range_max: {get_param: jigasi_port_max}
############
# Networks #
############
net_jitsi:
type: OS::Neutron::Net
properties:
name: {get_param: "OS::stack_name"}
# Comment these out if your cloud does not support them
#value_specs:
# availability_zone_hints:
# - {get_param: availability_zone}
subnet_jitsi:
type: OS::Neutron::Subnet
properties:
name: {get_param: "OS::stack_name"}
network: {get_resource: net_jitsi}
cidr: 192.168.10.0/24
# OTC
#dns_nameservers: [ 100.125.4.25, 9.9.9.9 ]
#dns_nameservers: [ 86.107.242.101, 8.8.8.8 ]
dns_nameservers: [ 5.1.66.255, 185.150.99.255 ]
allocation_pools:
-
start: 192.168.10.100
end: 192.168.10.120
##########################
# Network infrastructure #
##########################
router:
type: OS::Neutron::Router
properties:
name: {get_param: "OS::stack_name"}
external_gateway_info:
network: {get_param: public}
# OTC
# enable_snat: true
# Comment these out if your cloud does not support them
#value_specs:
# availability_zone_hints:
# - {get_param: availability_zone}
router_interface:
type: OS::Neutron::RouterInterface
properties:
router: {get_resource: router}
subnet: {get_resource: subnet_jitsi}
###########
# Manager #
###########
jitsi_port:
type: OS::Neutron::Port
properties:
name: {get_param: "OS::stack_name"}
network_id: {get_resource: net_jitsi}
fixed_ips:
- ip_address: 192.168.10.99
security_groups:
- {get_resource: security_group_jitsi}
jitsi_floating_ip:
type: OS::Neutron::FloatingIP
depends_on: router_interface
properties:
floating_network_id: {get_param: public}
port_id: {get_resource: jitsi_port}
jitsi_server: