feat: make linux script installation non-interactive (#4355)

This PR changes the LetsEncrypt behaviour to be non-interactive. Earlier, the installation flow was waiting for user input at the SSL cert generation stage. With this change, once the user confirms completes the initial selection, the installation can be completed unattended.
This commit is contained in:
Vishnu Narayanan 2022-04-01 00:34:50 +05:30 committed by GitHub
parent c397fe1964
commit 3813b3b372
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@
# Description: Chatwoot installation script # Description: Chatwoot installation script
# OS: Ubuntu 20.04 LTS / Ubuntu 20.10 # OS: Ubuntu 20.04 LTS / Ubuntu 20.10
# Script Version: 0.7 # Script Version: 0.8
# Run this script as root # Run this script as root
read -p 'Would you like to configure a domain and SSL for Chatwoot?(yes or no): ' configure_webserver read -p 'Would you like to configure a domain and SSL for Chatwoot?(yes or no): ' configure_webserver
@ -12,6 +12,7 @@ then
read -p 'Enter your sub-domain to be used for Chatwoot (chatwoot.domain.com for example) : ' domain_name read -p 'Enter your sub-domain to be used for Chatwoot (chatwoot.domain.com for example) : ' domain_name
echo -e "\nThis script will try to generate SSL certificates via LetsEncrypt and serve chatwoot at echo -e "\nThis script will try to generate SSL certificates via LetsEncrypt and serve chatwoot at
"https://$domain_name". Proceed further once you have pointed your DNS to the IP of the instance.\n" "https://$domain_name". Proceed further once you have pointed your DNS to the IP of the instance.\n"
read -p 'Enter the email LetsEncrypt can use to send reminders when your SSL certificate is up for renewal: ' le_email
read -p 'Do you wish to proceed? (yes or no): ' exit_true read -p 'Do you wish to proceed? (yes or no): ' exit_true
if [ $exit_true == "no" ] if [ $exit_true == "no" ]
then then
@ -138,7 +139,7 @@ else
curl https://ssl-config.mozilla.org/ffdhe4096.txt >> /etc/ssl/dhparam curl https://ssl-config.mozilla.org/ffdhe4096.txt >> /etc/ssl/dhparam
wget https://raw.githubusercontent.com/chatwoot/chatwoot/develop/deployment/nginx_chatwoot.conf wget https://raw.githubusercontent.com/chatwoot/chatwoot/develop/deployment/nginx_chatwoot.conf
cp nginx_chatwoot.conf /etc/nginx/sites-available/nginx_chatwoot.conf cp nginx_chatwoot.conf /etc/nginx/sites-available/nginx_chatwoot.conf
certbot certonly --nginx -d $domain_name certbot certonly --non-interactive --agree-tos --nginx -m $le_email -d $domain_name
sed -i "s/chatwoot.domain.com/$domain_name/g" /etc/nginx/sites-available/nginx_chatwoot.conf sed -i "s/chatwoot.domain.com/$domain_name/g" /etc/nginx/sites-available/nginx_chatwoot.conf
ln -s /etc/nginx/sites-available/nginx_chatwoot.conf /etc/nginx/sites-enabled/nginx_chatwoot.conf ln -s /etc/nginx/sites-available/nginx_chatwoot.conf /etc/nginx/sites-enabled/nginx_chatwoot.conf
systemctl restart nginx systemctl restart nginx