Docker-jitsi-meet: Why is config.js getting downloaded remotely and overriding user's config.js file?

Created on 9 May 2020  路  14Comments  路  Source: jitsi/docker-jitsi-meet

config.js is a customizable file. Why the template is getting downloaded remotely and overwriting user's file ? How does this change benefit the user?

here is the change to web/Docker compose.

https://github.com/jitsi/docker-jitsi-meet/commit/655cf6be4a8a83a5a6053e3cb28853d98fcc1a66#diff-142bdc956123e5b32d1d777e99af6905

Most helpful comment

you just need to copy your config from jitsi-meet-cfg/web/config.js to jitsi-meet-cfg/web/custom-config.js

if there is a custom-config.js it will be applied!

All 14 comments

My install script lets the server run once and the sed-replaces the lines in question in the config files. Works a treat.

are you using the latest version ?

Yes, the latest stable version that is.

Heres my script:

#!/bin/bash

# exit script on command fail
set -e

# backup users, -a to preserve file metadata
echo "** Backing up users **"
cp -ra ~/.jitsi-meet-cfg/prosody/config/data/meet%2ejitsi/accounts \
       ~/jitsi-bak/.jitsi-meet-cfg/prosody/config/data/meet%2ejitsi || true

cd ~/docker-jitsi-meet

# revert changes and update from git
echo "** Updating repository **"
git stash save -a
git pull --rebase origin master

echo "** Adapting config files **"

# copy .env file
cp env.example .env

# change ENV file
sed -i "s/HTTP_PORT=8000/HTTP_PORT=38000/g" .env
sed -i "s/HTTPS_PORT=8443/HTTPS_PORT=38443/g" .env
sed -i "s/TZ=Europe\/Amsterdam/TZ=Europe\/Berlin/g" .env

sed -i "s/#PUBLIC_URL=https:\/\/meet.example.com/PUBLIC_URL=https:\/\/myserver.de/g" .env
sed -i "s/#DOCKER_HOST_ADDRESS=192.168.1.1/DOCKER_HOST_ADDRESS=99.99.99.99/g" .env
sed -i "s/#ENABLE_AUTH=1/ENABLE_AUTH=1/g" .env
sed -i "s/#ENABLE_GUESTS=1/ENABLE_GUESTS=1/g" .env
sed -i "s/#AUTH_TYPE=internal/AUTH_TYPE=internal/g" .env
sed -i "s/#DISABLE_HTTPS=1/DISABLE_HTTPS=1/g" .env
sed -i "s/meet-jit-si-turnrelay.jitsi.net:443/stun.schlund.de:3478/g" .env
sed -i "s/JVB_STUN_SERVERS=/#JVB_STUN_SERVERS=/g" .env
# sed -i "s///g" config.js

# Generate new passwords
./gen-passwords.sh

# show diff of ENV file
echo "*********** ENV DIFF ************"
diff -d --old-group-format=$'\e[0;31m%<\e[0m' \
        --new-group-format=$'\e[0;32m%>\e[0m' \
        --unchanged-group-format=$'' \
        env.example .env || true
#diff env.example .env || true

# EITHER pull new docker images
echo "** Updating images **"
# if switching from own build:
#make clean
docker-compose pull

# OR (re)build images
#echo "** Building docker images **"
#JITSI_RELEASE=unstable make
# if switching from images:
#FORCE_REBUILD=1 JITSI_RELEASE=unstable make

# clear old jitsi
echo "** Clearing old jitsi server **"
systemctl stop jitsi
rm -rf ~/.jitsi-meet-cfg
echo "** Setting up new jitsi server **"
systemctl start jitsi

echo "** Updating generated config files **"

# make backups of generated config files
cd ~/.jitsi-meet-cfg/web
cp config.js config.js.bak
cp interface_config.js interface_config.js.bak

# change config.js
sed -i "s/\/\/ useIPv6: true/useIPv6: true/g" config.js
sed -i "s/enableNoisyMicDetection: true/enableNoisyMicDetection: false/g" config.js
sed -i "s/meet-jit-si-turnrelay.jitsi.net:443/stun.schlund.de:3478/g" config.js

# change interface-config.js
sed -i "s/DISABLE_VIDEO_BACKGROUND: false/DISABLE_VIDEO_BACKGROUND: true/g" interface_config.js
sed -i "s/'Fellow Jitster'/'Teilnehmer'/g" interface_config.js
sed -i "s/'me'/'Ich'/g" interface_config.js
sed -i "s/SHOW_JITSI_WATERMARK: true/SHOW_JITSI_WATERMARK: false/g" interface_config.js
sed -i "s/SHOW_WATERMARK_FOR_GUESTS: true/SHOW_WATERMARK_FOR_GUESTS: false/g" interface_config.js
sed -i "s/ APP_NAME: 'Jitsi Meet'/ APP_NAME: 'My Jitsi'/g" interface_config.js
sed -i "s/INVITATION_POWERED_BY: true/INVITATION_POWERED_BY: false/g" interface_config.js
sed -i "s/DISPLAY_WELCOME_PAGE_CONTENT: true/DISPLAY_WELCOME_PAGE_CONTENT: false/g" interface_config.js

# sed -i "s///g" config.js

# show diff of config files
echo "*********** config.js DIFF ************"
diff -d --old-group-format=$'\e[0;31m%<\e[0m' \
        --new-group-format=$'\e[0;32m%>\e[0m' \
        --unchanged-group-format=$'' \
        config.js.bak config.js || true
#diff config.js.bak config.js || true
echo "*********** interface_config.js DIFF ************"
diff -d --old-group-format=$'\e[0;31m%<\e[0m' \
        --new-group-format=$'\e[0;32m%>\e[0m' \
        --unchanged-group-format=$'' \
    interface_config.js.bak interface_config.js || true
#diff interface_config.js interface_config.js || true

# copy backed up users (needs -a to preserve file metadata)
echo "** Restoring users **"
cp -ra ~/jitsi-bak/.jitsi-meet-cfg ~/ || true

# restart jitsi again
echo "** Restarting jitsi server with new config **"
systemctl restart jitsi

I run that in the checked out (or downloaded) docker folder. Note for me the systemctl restart jitsi tears down and sets up the jitsi containers:

[Unit]
Description=Jitsi Docker Service
After=docker.service

[Service]
Type=oneshot
User=jitsi
RemainAfterExit=yes
StandardError=null
StandardOutput=null
WorkingDirectory=~/docker-jitsi-meet
ExecStart=/usr/local/bin/docker-compose -f ~/docker-jitsi-meet/docker-compose.yml up -d
ExecStop=/usr/local/bin/docker-compose -f ~/docker-jitsi-meet/docker-compose.yml down

[Install]
WantedBy=multi-user.target

Would you mind explaining how do you configure custom settings on your config.js ? Maybe its not a bug and i am doing something wrong.

web/rootfs/etc/cont-init.d/10-config... if config.js doesnt exist, then do the following. but config.js always exist in the folder.

if [[ ! -f /config/config.js ]]; then
    cp /defaults/config.js /config/config.js
    sed -i \
        -e "s#jitsi-meet.example.com#$XMPP_DOMAIN#g" \
        -e "s#bosh:.*#bosh: '/http-bind',#" \
        -e "s#muc:.*#muc: '${XMPP_MUC_DOMAIN}',#" \
        -e "s#// focusUserJid:.*#focusUserJid: '${JICOFO_AUTH_USER}@${XMPP_AUTH_DOMAIN}',#" \
        /config/config.js

ah, so you are running a separate script.
thank you .

Thats my "update jitsi to latest version" script, yes. Outside of the docker container.

So this confirms that 1 of 2 options.
option 1: config in web/rootfs/etc/cont-init.d/10-config is correct, but the Dockerfile has a bug
option 2: Dockerfile has no bug and config in web/rootfs/etc/cont-init.d/10-config is obsolete since config.js always exist.

I read nothing in the README about web/rootfs/etc/cont-init.d/10-config and much about the fact that the config files are recreated. Maybe you deemed your own hack a feature?

the code is there though.

if [[ ! -f /config/config.js ]]; then
    cp /defaults/config.js /config/config.js

With the changes in the config files and new defaults and options in new versions I found this to be a much better solution either way.

@creativeguitar I think you are confusing /defaults/config.js and /config.config.js. The former is the default one from the Jitsi installation. The latter is the generated one, which is generated only once, on first container boot. After that it won't be updated any further. I understand this is a limitation, but that's a different story.

you just need to copy your config from jitsi-meet-cfg/web/config.js to jitsi-meet-cfg/web/custom-config.js

if there is a custom-config.js it will be applied!

After restarting / rebuilding the docker container the config.js will be overwritten.
cp jitsi-meet-cfg/web/config.js jitsi-meet-cfg/web/custom-config.js and applying the personal changes to the custom-config.js does the trick for me, thanks to @valueerrorx .
You don't have to add the custom-config.js anywhere. It will be applied automatically!

Overwriting the config.js sound pretty confusing for me. Perhaps changing the name to config.default.js or something similar will be much more user friendly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TeGuy picture TeGuy  路  4Comments

mrWodoo picture mrWodoo  路  5Comments

CosmoMyzrailGorynych picture CosmoMyzrailGorynych  路  5Comments

0187773933 picture 0187773933  路  7Comments

serban-mihai picture serban-mihai  路  4Comments