10-config 3.2 KB

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