-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduces installing coturn as turn server for jitsi-meet #4959
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
080c4eb
Adds package that can configure using turnserver for jitsi-meet.
damencho 60dcfe4
Moves loading of stream after loading stream module (50-..).
damencho 912540a
Leaves DISABLE_TCP_HARVESTER to be handled by jvb.
damencho a29bd19
Fixes comments.
damencho 3bae5a6
Properly detect first time coturn install and configure it.
damencho 6e069d0
Handles upgrading from jetty serving web.
damencho 3b47eb3
Does not create jvb user if already exists.
damencho 417ddf1
Fixes let's encrypt and adds turnserver handling.
damencho a4caeac
Enables use of turn server in config.js if available.
damencho 9919131
Adds a check whether prosody config exists.
damencho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
doc/debian/jitsi-meet-turn/turnserver.conf /usr/share/jitsi-meet-turnserver/ | ||
doc/debian/jitsi-meet/jitsi-meet.conf /usr/share/jitsi-meet-turnserver/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/usr/share/jitsi-meet-turnserver/jitsi-meet.conf /etc/nginx/modules-enabled/60-jitsi-meet.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
#!/bin/bash | ||
# postinst script for jitsi-meet-turnserver | ||
# | ||
# see: dh_installdeb(1) | ||
|
||
set -e | ||
|
||
# summary of how this script can be called: | ||
# * <postinst> `configure' <most-recently-configured-version> | ||
# * <old-postinst> `abort-upgrade' <new version> | ||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package> | ||
# <new-version> | ||
# * <postinst> `abort-remove' | ||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour' | ||
# <failed-install-package> <version> `removing' | ||
# <conflicting-package> <version> | ||
# for details, see http://www.debian.org/doc/debian-policy/ or | ||
# the debian-policy package | ||
|
||
case "$1" in | ||
configure) | ||
# loading debconf | ||
. /usr/share/debconf/confmodule | ||
|
||
# try to get host from jitsi-videobridge | ||
db_get jitsi-videobridge/jvb-hostname | ||
if [ -z "$RET" ] ; then | ||
# server hostname | ||
db_set jitsi-videobridge/jvb-hostname "localhost" | ||
db_input critical jitsi-videobridge/jvb-hostname || true | ||
db_go | ||
fi | ||
JVB_HOSTNAME="$RET" | ||
|
||
TURN_CONFIG="/etc/turnserver.conf" | ||
NGINX_CONFIG="/etc/nginx/sites-available/$JVB_HOSTNAME.conf" | ||
JITSI_MEET_CONFIG="/etc/jitsi/meet/$JVB_HOSTNAME-config.js" | ||
|
||
# detect dpkg-reconfigure, just delete old links | ||
db_get jitsi-meet-turnserver/jvb-hostname | ||
JVB_HOSTNAME_OLD=$RET | ||
if [ -n "$RET" ] && [ ! "$JVB_HOSTNAME_OLD" = "$JVB_HOSTNAME" ] ; then | ||
rm -f $TURN_CONFIG | ||
fi | ||
|
||
# this detect only old installations with no nginx | ||
db_get jitsi-meet/jvb-serve || true | ||
if [ ! -f $NGINX_CONFIG -o "$RET" = "true" ] ; then | ||
# nothing to do | ||
echo "" | ||
echo "turnserver not configured as no nginx found to multiplex traffic" | ||
echo "" | ||
db_stop | ||
exit 0 | ||
fi | ||
|
||
# stores the hostname so we will reuse it later, like in purge | ||
db_set jitsi-meet-turnserver/jvb-hostname "$JVB_HOSTNAME" | ||
|
||
# try to get turnserver password | ||
db_get jitsi-meet-prosody/turn-secret | ||
if [ -z "$RET" ] ; then | ||
db_input critical jitsi-meet-prosody/turn-secret || true | ||
db_go | ||
fi | ||
TURN_SECRET="$RET" | ||
|
||
if [[ -f $TURN_CONFIG ]] && ! grep -q "jitsi-meet coturn config" "$TURN_CONFIG" ; then | ||
PUBLIC_IP=$(dig +short myip.opendns.com @resolver1.opendns.com) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. neat! |
||
cp /usr/share/jitsi-meet-turnserver/turnserver.conf $TURN_CONFIG | ||
sed -i "s/jitsi-meet.example.com/$JVB_HOSTNAME/g" $TURN_CONFIG | ||
sed -i "s/__turnSecret__/$TURN_SECRET/g" $TURN_CONFIG | ||
sed -i "s/__external_ip_address__/$JVB_HOSTNAME/g" $TURN_CONFIG | ||
|
||
# SSL for nginx | ||
db_get jitsi-meet/cert-choice | ||
CERT_CHOICE="$RET" | ||
|
||
if [ "$CERT_CHOICE" = "I want to use my own certificate" ] ; then | ||
saghul marked this conversation as resolved.
Show resolved
Hide resolved
|
||
db_get jitsi-meet/cert-path-key | ||
CERT_KEY="$RET" | ||
db_get jitsi-meet/cert-path-crt | ||
CERT_CRT="$RET" | ||
|
||
# replace self-signed certificate paths with user provided ones | ||
CERT_KEY_ESC=$(echo $CERT_KEY | sed 's/\./\\\./g') | ||
CERT_KEY_ESC=$(echo $CERT_KEY_ESC | sed 's/\//\\\//g') | ||
sed -i "s/pkey=\/etc\/jitsi\/meet\/.*key/pkey=$CERT_KEY_ESC/g" $TURN_CONFIG | ||
CERT_CRT_ESC=$(echo $CERT_CRT | sed 's/\./\\\./g') | ||
CERT_CRT_ESC=$(echo $CERT_CRT_ESC | sed 's/\//\\\//g') | ||
sed -i "s/cert=\/etc\/jitsi\/meet\/.*crt/cert=$CERT_CRT_ESC/g" $TURN_CONFIG | ||
fi | ||
|
||
sed -i "s/#TURNSERVER_ENABLED/TURNSERVER_ENABLED/g" /etc/default/coturn | ||
invoke-rc.d coturn restart || true | ||
|
||
NGINX_STREAM_CONFIG="/etc/nginx/modules-enabled/60-jitsi-meet.conf" | ||
if [ -f $NGINX_STREAM_CONFIG ] && [ -f $NGINX_CONFIG ] ; then | ||
sed -i "s/listen 443 ssl/listen 4444 ssl http2/g" $NGINX_CONFIG | ||
invoke-rc.d nginx reload || true | ||
fi | ||
|
||
# Enable turn server in config.js | ||
if [ -f $JITSI_MEET_CONFIG ] ; then | ||
sed -i "s/\/\/ useStunTurn: true/useStunTurn: true/g" $JITSI_MEET_CONFIG | ||
fi | ||
fi | ||
|
||
# and we're done with debconf | ||
db_stop | ||
;; | ||
|
||
abort-upgrade|abort-remove|abort-deconfigure) | ||
;; | ||
|
||
*) | ||
echo "postinst called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# dh_installdeb will replace this with shell code automatically | ||
# generated by other debhelper scripts. | ||
|
||
#DEBHELPER# | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Template: jitsi-meet-turnserver/jvb-hostname | ||
Type: string | ||
_Description: The hostname of the current installation: | ||
The value for the hostname that is set in Jitsi Videobridge installation. | ||
|
||
Template: jitsi-videobridge/jvb-hostname | ||
Type: string | ||
_Description: The hostname of the current installation: | ||
The value for the hostname that is set in Jitsi Videobridge installation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Coturn configuration for Jitsi Meet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# jitsi-meet coturn config. Do not modify this line | ||
lt-cred-mech | ||
use-auth-secret | ||
keep-address-family | ||
static-auth-secret=__turnSecret__ | ||
realm=jitsi-meet.example.com | ||
cert=/etc/jitsi/meet/jitsi-meet.example.com.crt | ||
pkey=/etc/jitsi/meet/jitsi-meet.example.com.key | ||
|
||
no-tcp | ||
saghul marked this conversation as resolved.
Show resolved
Hide resolved
|
||
listening-port=443 | ||
tls-listening-port=4445 | ||
external-ip=__external_ip_address__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# this is jitsi-meet nginx module configuration | ||
# this forward all http traffic to the nginx virtual host port | ||
# and the rest to the turn server | ||
|
||
stream { | ||
saghul marked this conversation as resolved.
Show resolved
Hide resolved
|
||
upstream web { | ||
server 127.0.0.1:4444; | ||
} | ||
upstream turn { | ||
server 127.0.0.1:4445; | ||
} | ||
# since 1.13.10 | ||
map $ssl_preread_alpn_protocols $upstream { | ||
"h2" web; | ||
"http/1.1" web; | ||
"h2,http/1.1" web; | ||
default turn; | ||
} | ||
|
||
server { | ||
listen 443; | ||
|
||
# since 1.11.5 | ||
ssl_preread on; | ||
proxy_pass $upstream; | ||
|
||
# Increase buffer to serve video | ||
proxy_buffer_size 10m; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want to quote the string "$PROSODY_HOST_CONFIG" in case there's spaces or anything else.