10-config 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/with-contenv bash
  2. if [[ -z $JVB_DISABLE_XMPP ]]; then
  3. if [[ -z $JVB_AUTH_PASSWORD ]]; then
  4. echo 'FATAL ERROR: JVB auth password must be set'
  5. exit 1
  6. fi
  7. OLD_JVB_AUTH_PASSWORD=passw0rd
  8. if [[ "$JVB_AUTH_PASSWORD" == "$OLD_JVB_AUTH_PASSWORD" ]]; then
  9. echo 'FATAL ERROR: JVB auth password must be changed, check the README'
  10. exit 1
  11. fi
  12. [ -z "${XMPP_SERVER}" ] && export XMPP_SERVER=xmpp.meet.jitsi
  13. # On environments like Swarm the IP address used by the default gateway need not be
  14. # the one used for inter-container traffic. Use that one for our fallback ID.
  15. XMPP_SERVER_IP=$(dig +short +search ${XMPP_SERVER})
  16. export JVB_WS_SERVER_ID_FALLBACK=$(ip route get ${XMPP_SERVER_IP} | grep -oP '(?<=src ).*' | awk '{ print $1 '})
  17. fi
  18. # Migration from DOCKER_HOST_ADDRESS to JVB_ADVERTISE_IPS
  19. if [[ -z "${JVB_ADVERTISE_IPS}" ]]; then
  20. if [[ ! -z "${DOCKER_HOST_ADDRESS}" ]]; then
  21. echo "WARNING: DOCKER_HOST_ADDRESS is deprecated, migrate to JVB_ADVERTISE_IPS"
  22. export JVB_ADVERTISE_IPS=${DOCKER_HOST_ADDRESS}
  23. fi
  24. fi
  25. # Local IP for the ice4j mapping harvester.
  26. export LOCAL_ADDRESS=$(ip route get 1 | grep -oP '(?<=src ).*' | awk '{ print $1 '})
  27. export SENTRY_RELEASE="${SENTRY_RELEASE:-$(apt-cache policy jitsi-videobridge2 | sed -n '/Installed/p' | sed -e 's/[^:]*: //')}"
  28. if [[ -f /config/custom-sip-communicator.properties ]]; then
  29. cat /config/custom-sip-communicator.properties > /config/sip-communicator.properties
  30. fi
  31. # set random jvb nickname for the instance if is not set
  32. [ -z "${JVB_INSTANCE_ID}" ] && export JVB_INSTANCE_ID="jvb-$(date +%N)"
  33. # check for AUTOSCALER_URL, AUTOSCALER_SIDECAR_KEY_FILE and AUTOSCALER_SIDECAR_KEY_ID as indicator that sidecar should be enabled
  34. if [ -n "$AUTOSCALER_URL" ]; then
  35. if [ -z "$AUTOSCALER_SIDECAR_KEY_FILE" ]; then
  36. export AUTOSCALER_SIDECAR_KEY_FILE="/etc/jitsi/autoscaler-sidecar/asap.pem"
  37. fi
  38. if [ -z "$AUTOSCALER_SIDECAR_KEY_ID" ]; then
  39. # assume key id is equal to the base real path of the key file minus .pem
  40. export AUTOSCALER_SIDECAR_KEY_ID="$(basename "$(realpath "$AUTOSCALER_SIDECAR_KEY_FILE")" | tr -d '.pem')"
  41. fi
  42. if [ -f "$AUTOSCALER_SIDECAR_KEY_FILE" ]; then
  43. echo "AUTOSCALER_URL found, enabling autoscaler sidecar"
  44. export JVB_VERSION="$(dpkg -s jitsi-videobridge2 | grep Version | awk '{print $2}' | sed 's/..$//')"
  45. [ -z "$AUTOSCALER_SIDECAR_PORT" ] && export AUTOSCALER_SIDECAR_PORT="6000"
  46. [ -z "$JIBRI_WEBHOOK_SUBSCRIBERS" ] && export JIBRI_WEBHOOK_SUBSCRIBERS="http://localhost:$AUTOSCALER_SIDECAR_PORT/hook"
  47. [ -z "$AUTOSCALER_SIDECAR_INSTANCE_ID" ] && export AUTOSCALER_SIDECAR_INSTANCE_ID="$JVB_INSTANCE_ID"
  48. [ -z "$AUTOSCALER_SIDECAR_REGION" ] && export AUTOSCALER_SIDECAR_REGION="docker"
  49. [ -z "$AUTOSCALER_SIDECAR_GROUP_NAME" ] && export AUTOSCALER_SIDECAR_GROUP_NAME="docker-jvb"
  50. mkdir -p /etc/jitsi/autoscaler-sidecar
  51. tpl /defaults/autoscaler-sidecar.config > /etc/jitsi/autoscaler-sidecar/config
  52. else
  53. echo "No key file at $AUTOSCALER_SIDECAR_KEY_FILE, leaving autoscaler sidecar disabled"
  54. fi
  55. else
  56. echo "No AUTOSCALER_URL defined, leaving autoscaler sidecar disabled"
  57. fi
  58. tpl /defaults/logging.properties > /config/logging.properties
  59. tpl /defaults/jvb.conf > /config/jvb.conf
  60. chown -R jvb:jitsi /config