2018-03-14 10:23:13 +01:00
|
|
|
|
#!/usr/bin/with-contenv bash
|
|
|
|
|
|
|
|
|
|
# make our folders
|
|
|
|
|
mkdir -p \
|
2018-03-14 11:37:09 +01:00
|
|
|
|
/config/{nginx/site-confs,keys} \
|
|
|
|
|
/run \
|
|
|
|
|
/var/lib/nginx/tmp/client_body \
|
|
|
|
|
/var/tmp/nginx
|
2018-03-14 10:23:13 +01:00
|
|
|
|
|
2018-11-07 10:03:49 +01:00
|
|
|
|
# generate keys (maybe)
|
2018-11-07 14:15:09 +01:00
|
|
|
|
if [[ $DISABLE_HTTPS -ne 1 ]]; then
|
|
|
|
|
if [[ $ENABLE_LETSENCRYPT -eq 1 ]]; then
|
|
|
|
|
if [[ ! -f /etc/letsencrypt/live/$LETSENCRYPT_DOMAIN/fullchain.pem ]]; then
|
2020-04-15 21:37:18 +02:00
|
|
|
|
if ! certbot-auto \
|
|
|
|
|
certonly \
|
|
|
|
|
--no-self-upgrade \
|
2020-03-24 22:45:55 +01:00
|
|
|
|
--noninteractive \
|
|
|
|
|
--standalone \
|
|
|
|
|
--preferred-challenges http \
|
|
|
|
|
-d $LETSENCRYPT_DOMAIN \
|
|
|
|
|
--agree-tos \
|
|
|
|
|
--email $LETSENCRYPT_EMAIL ; then
|
|
|
|
|
|
|
|
|
|
echo "Failed to obtain a certificate from the Let's Encrypt CA."
|
|
|
|
|
# this tries to get the user's attention and to spare the
|
|
|
|
|
# authority's rate limit:
|
|
|
|
|
sleep 15
|
|
|
|
|
echo "Exiting."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2020-01-07 17:00:45 +01:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# remove default certbot renewal
|
|
|
|
|
if [[ -f /etc/cron.d/certbot ]]; then
|
|
|
|
|
rm /etc/cron.d/certbot
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# setup certbot renewal script
|
|
|
|
|
if [[ ! -f /etc/cron.daily/letencrypt-renew ]]; then
|
|
|
|
|
cp /defaults/letsencrypt-renew /etc/cron.daily/
|
2018-11-07 14:15:09 +01:00
|
|
|
|
fi
|
2018-11-07 11:23:08 +01:00
|
|
|
|
else
|
2018-11-07 14:15:09 +01:00
|
|
|
|
# use self-signed certs
|
|
|
|
|
if [[ -f /config/keys/cert.key && -f /config/keys/cert.crt ]]; then
|
|
|
|
|
echo "using keys found in /config/keys"
|
|
|
|
|
else
|
|
|
|
|
echo "generating self-signed keys in /config/keys, you can replace these with your own keys if required"
|
|
|
|
|
SUBJECT="/C=US/ST=TX/L=Austin/O=jitsi.org/OU=Jitsi Server/CN=*"
|
|
|
|
|
openssl req -new -x509 -days 3650 -nodes -out /config/keys/cert.crt -keyout /config/keys/cert.key -subj "$SUBJECT"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2018-11-07 10:03:49 +01:00
|
|
|
|
fi
|
|
|
|
|
|
2018-03-14 10:23:13 +01:00
|
|
|
|
# copy config files
|
|
|
|
|
if [[ ! -f /config/nginx/nginx.conf ]]; then
|
2018-03-14 11:37:09 +01:00
|
|
|
|
cp /defaults/nginx.conf /config/nginx/nginx.conf
|
2018-03-14 10:23:13 +01:00
|
|
|
|
fi
|
|
|
|
|
|
2018-11-07 14:01:41 +01:00
|
|
|
|
if [[ ! -f /config/nginx/meet.conf ]]; then
|
|
|
|
|
tpl /defaults/meet.conf > /config/nginx/meet.conf
|
|
|
|
|
fi
|
|
|
|
|
|
2018-11-07 09:55:59 +01:00
|
|
|
|
if [[ ! -f /config/nginx/ssl.conf ]]; then
|
2018-11-07 11:23:08 +01:00
|
|
|
|
tpl /defaults/ssl.conf > /config/nginx/ssl.conf
|
2018-11-07 09:55:59 +01:00
|
|
|
|
fi
|
|
|
|
|
|
2018-03-14 10:23:13 +01:00
|
|
|
|
if [[ ! -f /config/nginx/site-confs/default ]]; then
|
2018-11-07 14:15:09 +01:00
|
|
|
|
tpl /defaults/default > /config/nginx/site-confs/default
|
2018-03-14 10:23:13 +01:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [[ ! -f /config/config.js ]]; then
|
2018-03-14 11:37:09 +01:00
|
|
|
|
cp /defaults/config.js /config/config.js
|
|
|
|
|
sed -i \
|
|
|
|
|
-e "s#jitsi-meet.example.com#$XMPP_DOMAIN#g" \
|
2020-04-14 11:17:05 +02:00
|
|
|
|
-e "s#bosh:.*#bosh: '/http-bind',#" \
|
2018-04-28 17:42:37 +02:00
|
|
|
|
-e "s#muc:.*#muc: '${XMPP_MUC_DOMAIN}',#" \
|
2018-04-26 08:38:59 +02:00
|
|
|
|
-e "s#// focusUserJid:.*#focusUserJid: '${JICOFO_AUTH_USER}@${XMPP_AUTH_DOMAIN}',#" \
|
2018-03-14 11:37:09 +01:00
|
|
|
|
/config/config.js
|
2018-10-17 23:02:10 +02:00
|
|
|
|
|
2019-08-05 12:10:42 +02:00
|
|
|
|
if [[ $ENABLE_RECORDING -eq 1 || x$ENABLE_RECORDING == xtrue ]]; then
|
|
|
|
|
sed -i \
|
|
|
|
|
-e "/\/\/ Recording.*/a hiddenDomain: '$XMPP_RECORDER_DOMAIN'," \
|
|
|
|
|
-e "s#// fileRecordingsEnabled:.*#fileRecordingsEnabled: true,#" \
|
|
|
|
|
-e "s#// liveStreamingEnabled:.*#liveStreamingEnabled: true,#" \
|
|
|
|
|
/config/config.js
|
|
|
|
|
fi
|
|
|
|
|
|
2018-10-17 23:02:10 +02:00
|
|
|
|
if [[ $ENABLE_AUTH -eq 1 ]]; then
|
|
|
|
|
if [[ $ENABLE_GUESTS -eq 1 ]]; then
|
|
|
|
|
sed -i \
|
|
|
|
|
-e "s#// anonymousdomain:.*#anonymousdomain: '${XMPP_GUEST_DOMAIN}',#" \
|
|
|
|
|
/config/config.js
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
sed -i \
|
|
|
|
|
-e "s#// authdomain:.*#authdomain: '${XMPP_DOMAIN}',#" \
|
|
|
|
|
/config/config.js
|
|
|
|
|
fi
|
2019-06-17 15:22:00 +02:00
|
|
|
|
|
2020-06-27 16:21:31 +02:00
|
|
|
|
if [[ -z "$(grep -om1 'etherpad_base:' /config/config.js)" ]]; then
|
|
|
|
|
if [[ ! -z "${ETHERPAD_PUBLIC_URL}" ]]; then
|
|
|
|
|
sed -i \
|
|
|
|
|
-e "/enableWelcomePage/a\ etherpad_base: '${ETHERPAD_PUBLIC_URL}/p/'," \
|
|
|
|
|
/config/config.js
|
|
|
|
|
elif [[ ! -z "${ETHERPAD_URL_BASE}" ]]; then
|
|
|
|
|
sed -i \
|
|
|
|
|
-e "/enableWelcomePage/a\ etherpad_base: '${PUBLIC_URL}/etherpad/p/'," \
|
|
|
|
|
/config/config.js
|
|
|
|
|
fi
|
2019-06-17 15:22:00 +02:00
|
|
|
|
fi
|
2019-02-07 12:45:36 +01:00
|
|
|
|
|
|
|
|
|
if [[ $ENABLE_TRANSCRIPTIONS -eq 1 || "$ENABLE_TRANSCRIPTIONS" == "true" ]]; then
|
|
|
|
|
sed -i \
|
|
|
|
|
-e "s#// transcribingEnabled:.*#transcribingEnabled: true,#" \
|
|
|
|
|
/config/config.js
|
|
|
|
|
fi
|
2018-03-14 10:23:13 +01:00
|
|
|
|
fi
|
2018-05-04 08:29:46 +02:00
|
|
|
|
|
|
|
|
|
if [[ ! -f /config/interface_config.js ]]; then
|
|
|
|
|
cp /defaults/interface_config.js /config/interface_config.js
|
2019-02-07 12:45:36 +01:00
|
|
|
|
|
|
|
|
|
# It will remove parameter 'closedcaptions' from TOOLBAR_BUTTONS if ENABLE_TRANSCRIPTIONS is false,
|
|
|
|
|
# because it enabled by default, but not supported out of the box.
|
|
|
|
|
if [[ $ENABLE_TRANSCRIPTIONS -ne 1 || "$ENABLE_TRANSCRIPTIONS" != "true" ]]; then
|
|
|
|
|
sed -i \
|
|
|
|
|
-e "s#'closedcaptions', ##" \
|
|
|
|
|
/config/interface_config.js
|
|
|
|
|
fi
|
|
|
|
|
|
2018-05-04 08:29:46 +02:00
|
|
|
|
fi
|