2
0

10-config 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. fi
  65. if [[ ! -f /config/interface_config.js ]]; then
  66. cp /defaults/interface_config.js /config/interface_config.js
  67. # It will remove parameter 'closedcaptions' from TOOLBAR_BUTTONS if ENABLE_TRANSCRIPTIONS is false,
  68. # because it enabled by default, but not supported out of the box.
  69. if [[ $ENABLE_TRANSCRIPTIONS -ne 1 || "$ENABLE_TRANSCRIPTIONS" != "true" ]]; then
  70. sed -i \
  71. -e "s#'closedcaptions', ##" \
  72. /config/interface_config.js
  73. fi
  74. fi
  75. # copy app files
  76. if [[ ! -f /config/apple-app-site-configuration ]]; then
  77. cp /defaults/nginx.conf /config/nginx/nginx.conf
  78. fi