2
0

10-config 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 2>/dev/null)"
  24. # audio group is not found. Has it been run without jibri.yml?
  25. [ -z "${host_audio_group}" ] \
  26. && ( echo -e "\e[31mERROR: Binding /dev/snd is not found. Please check that you run docker-compose with -f jibri.yml.\e[39m"; kill 1; exit 1 )
  27. # try to create group with this id. If group with the id already exists, just skip
  28. groupadd -g ${host_audio_group} jibri-audio >/dev/null 2>&1
  29. # include user to the group by id
  30. usermod -aG ${host_audio_group} jibri
  31. # script for finalizing must have executing bit.
  32. [ ! -z "${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}" ] \
  33. && [ -f "${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}" ] \
  34. && [ ! -x "${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}" ] \
  35. && chmod +x ${JIBRI_FINALIZE_RECORDING_SCRIPT_PATH}
  36. # set random jibri nickname for the instance if is not set
  37. [ -z "${JIBRI_INSTANCE_ID}" ] && export JIBRI_INSTANCE_ID="jibri-$(date +%N)"
  38. # always recreate configs
  39. tpl /defaults/jibri.conf > /etc/jitsi/jibri/jibri.conf
  40. tpl /defaults/logging.properties > /etc/jitsi/jibri/logging.properties
  41. tpl /defaults/xorg-video-dummy.conf > /etc/jitsi/jibri/xorg-video-dummy.conf
  42. # make recording dir
  43. [ -z "${JIBRI_RECORDING_DIR}" ] && export JIBRI_RECORDING_DIR=/config/recordings
  44. mkdir -p ${JIBRI_RECORDING_DIR}
  45. chown -R jibri ${JIBRI_RECORDING_DIR}
  46. # make logs dir
  47. [ -z "${JIBRI_LOGS_DIR}" ] && export JIBRI_LOGS_DIR=/config/logs
  48. mkdir -p ${JIBRI_LOGS_DIR}
  49. chown -R jibri ${JIBRI_LOGS_DIR}