2
0

10-config 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. if ! certbot-auto \
  13. certonly \
  14. --no-self-upgrade \
  15. --noninteractive \
  16. --standalone \
  17. --preferred-challenges http \
  18. -d $LETSENCRYPT_DOMAIN \
  19. --agree-tos \
  20. --email $LETSENCRYPT_EMAIL ; then
  21. echo "Failed to obtain a certificate from the Let's Encrypt CA."
  22. # this tries to get the user's attention and to spare the
  23. # authority's rate limit:
  24. sleep 15
  25. echo "Exiting."
  26. exit 1
  27. fi
  28. fi
  29. # remove default certbot renewal
  30. if [[ -f /etc/cron.d/certbot ]]; then
  31. rm /etc/cron.d/certbot
  32. fi
  33. # setup certbot renewal script
  34. if [[ ! -f /etc/cron.daily/letencrypt-renew ]]; then
  35. cp /defaults/letsencrypt-renew /etc/cron.daily/
  36. fi
  37. else
  38. # use self-signed certs
  39. if [[ -f /config/keys/cert.key && -f /config/keys/cert.crt ]]; then
  40. echo "using keys found in /config/keys"
  41. else
  42. echo "generating self-signed keys in /config/keys, you can replace these with your own keys if required"
  43. SUBJECT="/C=US/ST=TX/L=Austin/O=jitsi.org/OU=Jitsi Server/CN=*"
  44. openssl req -new -x509 -days 3650 -nodes -out /config/keys/cert.crt -keyout /config/keys/cert.key -subj "$SUBJECT"
  45. fi
  46. fi
  47. fi
  48. # copy config files
  49. tpl /defaults/nginx.conf > /config/nginx/nginx.conf
  50. tpl /defaults/meet.conf > /config/nginx/meet.conf
  51. if [[ -f /config/nginx/custom-meet.conf ]]; then
  52. cat /config/nginx/custom-meet.conf >> /config/nginx/meet.conf
  53. fi
  54. tpl /defaults/ssl.conf > /config/nginx/ssl.conf
  55. tpl /defaults/default > /config/nginx/site-confs/default
  56. cp /defaults/config.js /config/config.js
  57. tpl /defaults/system-config.js >> /config/config.js
  58. tpl /defaults/settings-config.js >> /config/config.js
  59. if [[ -f /config/custom-config.js ]]; then
  60. cat /config/custom-config.js >> /config/config.js
  61. fi
  62. if [[ ! -f /config/interface_config.js ]]; then
  63. cp /defaults/interface_config.js /config/interface_config.js
  64. # It will remove parameter 'closedcaptions' from TOOLBAR_BUTTONS if ENABLE_TRANSCRIPTIONS is false,
  65. # because it enabled by default, but not supported out of the box.
  66. if [[ $ENABLE_TRANSCRIPTIONS -ne 1 && "$ENABLE_TRANSCRIPTIONS" != "true" ]]; then
  67. sed -i \
  68. -e "s#'closedcaptions', ##" \
  69. /config/interface_config.js
  70. fi
  71. fi