2
0

10-config 1.5 KB

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