Use “Let’s Encrypt SSL” to install Chatwoot on Ubuntu 20.04

You can download this article in PDF format via the link below to support us.
Download the guide in PDF formatturn off

Chatwoot is a customer support tool for real-time messaging channels. This can help companies provide customers with good customer support through social media channels.

This means that you can integrate social media chats (e.g. Facebook, Twitter, email, WhatsApp, etc.) into one central location. This will effectively help you focus on all platforms and respond to customer requirements in real time.

Chatwoot is a business software solution (for example, Walkie talkie, Zendesk and many more

Chatwoot function

  • Live chat -It provides a simple chat software for your business, you can embed widgets into your website for real-time chat.
  • Integration method – Chatwoot provides the flexibility to integrate with collaboration tools such as Slack. You can pass all Chatwoot conversations to the idle state, so you can reply to emails without leaving the idle workspace.
  • Shared inbox – You can provide a shared inbox for the team to collaborate. This makes it easy to handle multi-channel tickets.

The shared inbox enables you to:

  1. Use private notes to collaborate with your team
  2. Use slash commands to answer common questions.
  3. Automatically assign tickets to teammates to speed up response.

Install Chatwoot on Ubuntu 20.04

We will introduce how to install the self-hosted Chatwoot real-time chat server on Ubuntu 20.04 using Let’s Encrypt.

Before proceeding with the installation, please note the following requirements:

  1. Ubuntu 20.04 LTS server with all packages upgraded.
  2. Nginx server installation
  3. Let’s Encrypt Certbot
  4. FQDN-fully qualified domain name

Use the following steps to install a fully functional Chatwoot server on the Ubuntu 20.04 host.

Step 1-Download the installation script

In your terminal, run the following command to download the script that will be used to install chatwot.

wget https://raw.githubusercontent.com/chatwoot/chatwoot/develop/deployment/setup_20.04.sh -O setup.sh

Step 2-Install Chatwoot on Ubuntu 20.04

Make the downloaded script executable and run it as sudo.

chmod 755 setup.sh
sudo ./setup.sh

The installer will download and install the packages required by Chatwoot.

After successful installation, you will see the following output:

....
Woot! Woot!! Chatwoot server installation is complete
The server will be accessible at http://<server-ip>:3000
To configure a domain and SSL certificate, follow the guide at https://www.chatwoot.com/docs/deployment/deploy-chatwoot-in-linux-vm

The service can be accessed directly at:

http://<server-ip>:3000

Step 3-Install Nginx web server

It can be accessed via Chatwoot http://<server-ip>:3000. You should configure the firewall to allow port 3000.

In this setup, we need to install Nginx and use it as a reverse proxy for Chatwoot.

We will also set up “Let’s Encrypt” on the nginx virtual host.

Install Nginx on Ubuntu:

sudo apt update
sudo apt install nginx

Configure nginx.

Unlink the default nginx configuration:

sudo unlink /etc/nginx/sites-enabled/default

Create virtual host

cd /etc/nginx/sites-available
sudo nano chatwoot.conf

Add the following configuration in the conf file:

server {
  server_name <yourdomain.com>;

  # Point upstream to Chatwoot App Server
  set $upstream 127.0.0.1:3000;

  # Nginx strips out underscore in headers by default
  # Chatwoot relies on underscore in headers for API
  # Make sure that the config is turned on.
  underscores_in_headers on;
  location /.well-known {
    alias /var/www/ssl-proof/chatwoot/.well-known;
  }

  location / {
    proxy_pass_header Authorization;
    proxy_pass http://$upstream;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Ssl on; # Optional

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_http_version 1.1;
    proxy_set_header Connection “”;
    proxy_buffering off;

    client_max_body_size 0;
    proxy_read_timeout 36000s;
    proxy_redirect off;
  }
  listen 80;
}

Link the configuration file to /etc/nginx/sites-enabled:

sudo ln -s /etc/nginx/sites-available/chatwoot.conf /etc/nginx/sites-enabled/chatwoot.conf

Verify that your Nginx configuration is normal, and then restart the Nginx service.

$ sudo nginx -t
$ sudo systemctl reload nginx

Step 4-Configure “Let’s Encrypt SSL for Chatwoot”

Add the certbot repository.

sudo add-apt-repository ppa:certbot/certbot

Install certbot for Nginx

sudo apt update
sudo apt install python-certbot-nginx

Run encryption

sudo mkdir -p /var/www/ssl-proof/chatwoot/.well-known
sudo certbot --webroot -w /var/www/ssl-proof/chatwoot/ -d yourdomain.com -i nginx

You can now access the Chatwoot real-time server from the following locations https://yourdomain.com.Use "Let's Encrypt SSL" to install Chatwoot on Ubuntu 20.04

Configure Chatwoot environment

You need to configure the chatwot environment to have a functioning system.

  1. Log in as a Chatwoot user
# Login as chatwoot user

sudo -i -u chatwoot
cd chatwoot

2. Configure Facebook channel

You need to create a Facebook app among its developers Web portals.

Then, you need to fill in the following details in the .env file

##edit the .env file
nano .env

FB_VERIFY_TOKEN=
FB_APP_SECRET=
FB_APP_ID=

3. Configure email

In the .env file, add SMTP details in the following fields:

MAILER_SENDER_EMAIL=
SMTP_ADDRESS=
SMTP_USERNAME=
SMTP_PASSWORD=

4. Configure storage

You can configure Chatwoot to use cloud storage (such as Amazon s3) instead of the default local storage.It can be changed in the following fields of the .env file

ACTIVE_STORAGE_SERVICE='local'

After any updates/changes in the .env file, restart the chatwot service

sudo systemctl restart chatwoot.target

How to upgrade Chatwoot

Use the following steps to upgrade to a newer version of Chatwoot

# Login as Chatwoot user
sudo -i -u chatwoot

# Navigate to the Chatwoot directory
cd chatwoot

# Pull the latest version of the master branch
git checkout master && git pull

# Update dependencies
bundle
yarn

# Recompile the assets
rake assets:precompile RAILS_ENV=production

# Migrate the database schema
RAILS_ENV=production bundle exec rake db:migrate

# Restart the chatwoot server
systemctl restart chatwoot.target

in conclusion

We have installed and configured Chatwoot real-time chat server on our self-hosted Ubuntu 20.04 host.

Real-time chat is very convenient in the service industry because it can improve the efficiency of customer response.

Install Openfire XMPP chat server on Ubuntu

How to install Rocket.Chat server on Debian/Ubuntu

Install Zulip Chat Server on Ubuntu/Debian

You can download this article in PDF format via the link below to support us.
Download the guide in PDF formatturn off

Sidebar