10-config 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/usr/bin/with-contenv bash
  2. # make our folders
  3. mkdir -p \
  4. /config/{nginx/site-confs,keys} \
  5. /run \
  6. /var/lib/nginx/tmp/client_body \
  7. /var/tmp/nginx
  8. # generate keys (maybe)
  9. if [[ $DISABLE_HTTPS -ne 1 ]]; then
  10. if [[ $ENABLE_LETSENCRYPT -eq 1 ]]; then
  11. if [[ ! -f /etc/letsencrypt/live/$LETSENCRYPT_DOMAIN/fullchain.pem ]]; then
  12. certbot certonly \
  13. --noninteractive \
  14. --standalone \
  15. --preferred-challenges http \
  16. -d $LETSENCRYPT_DOMAIN \
  17. --agree-tos \
  18. --email $LETSENCRYPT_EMAIL
  19. fi
  20. # remove default certbot renewal
  21. if [[ -f /etc/cron.d/certbot ]]; then
  22. rm /etc/cron.d/certbot
  23. fi
  24. # setup certbot renewal script
  25. if [[ ! -f /etc/cron.daily/letencrypt-renew ]]; then
  26. cp /defaults/letsencrypt-renew /etc/cron.daily/
  27. fi
  28. else
  29. # use self-signed certs
  30. if [[ -f /config/keys/cert.key && -f /config/keys/cert.crt ]]; then
  31. echo "using keys found in /config/keys"
  32. else
  33. echo "generating self-signed keys in /config/keys, you can replace these with your own keys if required"
  34. SUBJECT="/C=US/ST=TX/L=Austin/O=jitsi.org/OU=Jitsi Server/CN=*"
  35. openssl req -new -x509 -days 3650 -nodes -out /config/keys/cert.crt -keyout /config/keys/cert.key -subj "$SUBJECT"
  36. fi
  37. fi
  38. if [[ ! -f /config/nginx/dhparams.pem ]]; then
  39. openssl dhparam -out /config/nginx/dhparams.pem 2048
  40. fi
  41. fi
  42. # copy config files
  43. if [[ ! -f /config/nginx/nginx.conf ]]; then
  44. cp /defaults/nginx.conf /config/nginx/nginx.conf
  45. fi
  46. if [[ ! -f /config/nginx/meet.conf ]]; then
  47. tpl /defaults/meet.conf > /config/nginx/meet.conf
  48. fi
  49. if [[ ! -f /config/nginx/ssl.conf ]]; then
  50. tpl /defaults/ssl.conf > /config/nginx/ssl.conf
  51. fi
  52. if [[ ! -f /config/nginx/site-confs/default ]]; then
  53. tpl /defaults/default > /config/nginx/site-confs/default
  54. fi
  55. if [[ $ENABLE_CDN -eq 1 || x$ENABLE_CDN == xtrue ]]; then
  56. [ -z "$CDN_URL" ] && CDN_URL="https://web-cdn.jitsi.net/"
  57. export BV=$(dpkg -s jitsi-meet-web | grep Version | awk '{print $2}'| cut -d'.' -f3 | cut -d'-' -f1)
  58. echo "<base href=\"${CDN_URL}${BV}/\" />" > /usr/share/jitsi-meet/base.html
  59. fi
  60. if [[ ! -f /config/config.js ]]; then
  61. [ -z "$XMPP_MUC_DOMAIN" ] && export XMPP_MUC_DOMAIN="conference.$XMPP_DOMAIN"
  62. [ -z "$XMPP_RECORDER_DOMAIN" ] && export XMPP_RECORDER_DOMAIN="recorder.$XMPP_DOMAIN"
  63. tpl /defaults/config.js > /config/config.js
  64. if [[ ! -z "${ETHERPAD_URL_BASE}" && -z "$(grep -om1 'etherpad_base:' /config/config.js)" ]]; then
  65. sed -i \
  66. -e "/enableWelcomePage/a\ etherpad_base: '/etherpad/p/'," \
  67. /config/config.js
  68. fi
  69. if [[ $ENABLE_TRANSCRIPTIONS -eq 1 || "$ENABLE_TRANSCRIPTIONS" == "true" ]]; then
  70. sed -i \
  71. -e "s#// transcribingEnabled:.*#transcribingEnabled: true,#" \
  72. /config/config.js
  73. fi
  74. fi
  75. if [[ ! -f /config/interface_config.js ]]; then
  76. cp /defaults/interface_config.js /config/interface_config.js
  77. # It will remove parameter 'closedcaptions' from TOOLBAR_BUTTONS if ENABLE_TRANSCRIPTIONS is false,
  78. # because it enabled by default, but not supported out of the box.
  79. if [[ $ENABLE_TRANSCRIPTIONS -ne 1 || "$ENABLE_TRANSCRIPTIONS" != "true" ]]; then
  80. sed -i \
  81. -e "s#'closedcaptions', ##" \
  82. /config/interface_config.js
  83. fi
  84. fi