bigbluebutton / bbb-install

BASH script to install BigBlueButton in 30 minutes.
GNU Lesser General Public License v3.0
618 stars 539 forks source link

Consequently use local override files for IP/FQDN configuration #597

Open Ithanil opened 1 year ago

Ithanil commented 1 year ago

According to my understanding, only the local override files (as specified in here https://docs.bigbluebutton.org/admin/configuration-files.html#local-overrides-for-configuration-settings ) should be used for user-specific settings. And in my mind, the IP/hostname of the installation host is a user configuration, not a package configuration.

Currently, the installation script inconsequently uses both package and override configuration files to set IP/FQDN values. This is incorrect from a logical point of view, but also makes it difficult to determine all files where the IP/FQDN have been set. Only the override files should be used to set these values.

Ithanil commented 1 year ago

Quote from a email conversation regarding this topic:

Context: Our BBB Servers (VMs) may change their IPs on every startup, so we have a mechanism to replace the IP in every file where it is set (and we do not rely on bbb-conf --setip). The relevant code is as follows:

FQDN=`hostname -f`
new_ip_address=$ADDR
sed -i "s/^\s*server_name.*/ server_name $FQDN;/" /etc/nginx/sites-available/bigbluebutton
#freeswitch
sed -i "s/\(.*local_ip_v4=\).*\(\".*\)/\1$new_ip_address\2/" /opt/freeswitch/etc/freeswitch/vars.xml
sed -i "s/\(.*external_rtp_ip=\).*\(\".*\)/\1$new_ip_address\2/" /opt/freeswitch/etc/freeswitch/vars.xml
sed -i "s/\(.*external_sip_ip=\).*\(\".*\)/\1$new_ip_address\2/" /opt/freeswitch/etc/freeswitch/vars.xml
sed -i "s/\(.*ws-binding\" value=\"\).*\(\".*\)/\1$new_ip_address:5066\2/" /opt/freeswitch/etc/freeswitch/sip_profiles/external.xml
sed -i "s/\(.*wss-binding\" value=\"\).*\(\".*\)/\1$new_ip_address:7443\2/" /opt/freeswitch/etc/freeswitch/sip_profiles/external.xml
sed -i "s/.*proxy_pass.*/ proxy_pass http:\/\/$new_ip_address:5066;/" /usr/share/bigbluebutton/nginx/sip.nginx

yq w -i /usr/local/bigbluebutton/core/scripts/bigbluebutton.yml playback_host $FQDN
yq w -i /usr/local/bigbluebutton/core/scripts/podcast.yml playback_host $ADDR

HTML5_CONFIG=/etc/bigbluebutton/bbb-html5.yml
yq w -i $HTML5_CONFIG public.kurento.wsUrl "wss://$FQDN/bbb-webrtc-sfu"
yq w -i $HTML5_CONFIG public.pads.url "https://$FQDN/pad"
yq w -i $HTML5_CONFIG public.clientLog.external.url "https://$FQDN/html5log"
yq w -i $HTML5_CONFIG public.note.url "https://$FQDN/pad"

WEBRTC_SFU_CONFIG=/etc/bigbluebutton/bbb-webrtc-sfu/production.yml
yq w -i $WEBRTC_SFU_CONFIG kurento[0].ip $new_ip_address
yq w -i $WEBRTC_SFU_CONFIG kurento[0].url ws://127.0.0.1:8888/kurento
yq w -i $WEBRTC_SFU_CONFIG freeswitch.ip $new_ip_address
yq w -i $WEBRTC_SFU_CONFIG freeswitch.sip_ip $new_ip_address
yq w -i $WEBRTC_SFU_CONFIG mediasoup.webrtc.listenIps[0].ip "0.0.0.0"
yq w -i $WEBRTC_SFU_CONFIG mediasoup.webrtc.listenIps[0].announcedIp $new_ip_address
yq w -i $WEBRTC_SFU_CONFIG mediasoup.plainRtp.listenIp.ip "0.0.0.0"
yq w -i $WEBRTC_SFU_CONFIG mediasoup.plainRtp.listenIp.announcedIp $new_ip_address

sed -i 's|bbbWebAPI=.*|bbbWebAPI="[https://'$FQDN'/bigbluebutton/api"|'](https://'$fqdn'/bigbluebutton/api%22|') /etc/bigbluebutton/bbb-apps-akka.conf

sed -i "s/bigbluebutton.web.serverURL=.*/bigbluebutton.web.serverURL=https:\/\/$FQDN/g" /etc/bigbluebutton/bbb-web.properties

TELNUM=$(iptotel $new_ip_address | awk "{ printf \$4 }")
sed -ni -e '/defaultDialAccessNumber=/!p' -e '$adefaultDialAccessNumber='$TELNUM /etc/bigbluebutton/bbb-web.properties

sed -i "s/134\.93\.[0-9]*\.[0-9]*/$ADDR/" /etc/haproxy/haproxy.cfg
sed -i "s/134\.93\.[0-9]*\.[0-9]*/$ADDR/g" /etc/turnserver.conf
sed -i "s/bbb-[0-9]*-[0-9]*\.bbb\.rlp\.net/$FQDN/g" /etc/turnserver.conf
sed -i "s/^set_real_ip_from 134.*/set_real_ip_from $ADDR;/" /etc/nginx/sites-available/bigbluebutton

sed -i 's|turn:.*|turn:'$FQDN':3478"/>|' /etc/bigbluebutton/turn-stun-servers.xml
sed -i 's|turns:.*|turns:'$FQDN':443?transport=tcp"/>|' /etc/bigbluebutton/turn-stun-servers.xml

As you can see, apart from the user-override files we have to edit the IP in a lot of other "package"-type files as well, although I guess this is not easily avoidable in some cases. However, what my Github issue actually points to is that the IP is also set in a lot of package files for which there do exist overrides, for example /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties contains the IP although it should be set in /etc/bigbluebutton/bbb-web.properties by bbb-install. A configuration like the machine IP should consequently be set in override files, not in package files.