10-config 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/with-contenv bash
  2. if [[ -z $JIBRI_RECORDER_PASSWORD || -z $JIBRI_XMPP_PASSWORD ]]; then
  3. echo 'FATAL ERROR: Jibri recorder password and auth password must be set'
  4. exit 1
  5. fi
  6. OLD_JIBRI_RECORDER_PASSWORD=passw0rd
  7. if [[ "$JIBRI_RECORDER_PASSWORD" == "$OLD_JIBRI_RECORDER_PASSWORD" ]]; then
  8. echo 'FATAL ERROR: Jibri recorder password must be changed, check the README'
  9. exit 1
  10. fi
  11. OLD_JIBRI_XMPP_PASSWORD=passw0rd
  12. if [[ "$JIBRI_XMPP_PASSWORD" == "$OLD_JIBRI_XMPP_PASSWORD" ]]; then
  13. echo 'FATAL ERROR: Jibri auth password must be changed, check the README'
  14. exit 1
  15. fi
  16. # DISPLAY is necessary for start
  17. [ -z "${DISPLAY}" ] \
  18. && ( echo -e "\e[31mERROR: Please set DISPLAY variable.\e[39m"; kill 1; exit 1 )
  19. # check loaded snd_aloop module and exit if is not loaded on the host
  20. [ -z "$(lsmod | grep -om1 snd_aloop)" ] \
  21. && ( echo -e "\e[31mERROR: Please load snd-aloop module on the docker host.\e[39m"; kill 1; exit 1 )
  22. # get host's audio group id
  23. host_audio_group="$(stat -c %g /dev/snd/pcmC0D0p)"
  24. # try to create group with this id. If group with the id already exists, just skip
  25. groupadd -g ${host_audio_group} jibri-audio >/dev/null 2>&1
  26. # include user to the group by id
  27. usermod -aG ${host_audio_group} jibri
  28. # script for finalizing must have executing bit.
  29. [ ! -z "${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}" ] \
  30. && [ ! -x "${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}" ] \
  31. && chmod +x ${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}
  32. # set rundom jibri nickname for the instance if is not set
  33. [ -z "${JIBRI_INSTANCE_ID}" ] && export JIBRI_INSTANCE_ID=$(date +%N)
  34. # always recreate configs
  35. tpl /defaults/config.json > /etc/jitsi/jibri/config.json
  36. tpl /defaults/logging.properties > /etc/jitsi/jibri/logging.properties
  37. # make recording dir
  38. [ -z "${JIBRI_RECORDING_DIR}" ] && export JIBRI_RECORDING_DIR=/config/recordings
  39. mkdir -p ${JIBRI_RECORDING_DIR}
  40. chown -R jibri ${JIBRI_RECORDING_DIR}
  41. # make logs dir
  42. [ -z "${JIBRI_LOGS_DIR}" ] && export JIBRI_LOGS_DIR=/config/logs
  43. mkdir -p ${JIBRI_LOGS_DIR}
  44. chown -R jibri ${JIBRI_LOGS_DIR}