How to self-host Chatwoot using Docker

This article explains how to self-host Chatwoot using Docker. Chatwoot is an open-source customer engagement platform that you can deploy on your own server. By following the steps in this guide, you will deploy a Chatwoot instance that uses Docker containers for a simplified installation and management process.

The guide details the required environment, the necessary configuration steps, and the commands you need to execute. As a result, you obtain a fully functioning Chatwoot installation that you can customize to fit your business needs.

Prerequisites

Before proceeding with the installation, verify that you meet the following requirements:

  1. Server with Docker and Docker Compose Installed
    Ensure that your server runs a supported operating system with Docker and Docker Compose installed. If needed, refer to the official Docker documentation for installation instructions.
  2. Git Client
    Install Git to clone the Chatwoot repository from GitHub. Instructions for installing Git are available on the Git website.
  3. Sufficient Server Resources
    Confirm that your server meets the minimum requirements for Chatwoot. Although specific resource needs depend on your usage, a modern server with at least 2 GB of RAM is recommended.
  4. Domain Name and DNS Configuration (Optional)
    Prepare a domain name and update the DNS records if you plan to access Chatwoot via a custom domain.

Deploy Chatwoot Using Docker

Follow the steps below to set up Chatwoot with Docker:

Clone the Chatwoot Repository

Use Git to clone the Chatwoot repository to your server. This step downloads the latest code and Docker configuration files.

Bash
git clone https://github.com/chatwoot/chatwoot.git 

Cloning the repository creates a new directory named chatwoot containing all the necessary files.

Navigate to the Chatwoot Directory

Change to the directory that contains the Chatwoot installation files.

Bash
cd chatwoot 

Navigating into the repository directory prepares the environment for configuring the installation.

Create the Environment File

Copy the sample environment file to create your own configuration file.

Bash
cp .env.example .env 

This command creates a new file named .env based on the example file. You can later update the environment variables as needed.

Configure Environment Variables
Open the .env file in your preferred text editor (for example, using nano) to review and update configuration values such as database credentials and domain settings.

Bash
nano .env 

Modify the settings as required, then save and close the file.

Deploy Chatwoot with Docker Compose
Start the Docker containers by running Docker Compose in detached mode.

Bash
docker-compose up -d

This command downloads the required Docker images, creates containers, and starts the Chatwoot services in the background.

Initialize Chatwoot Setup
Once the containers are running, initialize the Chatwoot application by setting up the database and creating the necessary admin account. Execute the following command:

Bash
docker-compose run --rm api bundle exec rake chatwoot:setup 

This command runs the setup process, which creates the database schema and prompts you to create an admin user account.

Verify the Installation
After completing the setup process, access Chatwoot by opening a web browser and navigating to the server’s IP address or domain name on the configured port (by default, port 3000). For example:

http://your-server-ip:3000

Visiting the URL should display the Chatwoot login screen. Use the admin credentials created during the setup to log in.

Next Steps and References

After successfully deploying Chatwoot using Docker, consider the following next steps:

  • Secure Your Deployment
    Configure SSL/TLS for secure communication by setting up a reverse proxy (for example, using Nginx) in front of Chatwoot.
  • Customize Chatwoot Settings
    Explore Chatwoot’s configuration options by reviewing the .env file and updating the settings to match your operational requirements.
  • Monitor and Maintain Containers
    Regularly check the status of your Docker containers with the command below:
    • docker-compose ps
    • This command lists the status of all containers, ensuring that your Chatwoot instance runs smoothly.

For additional details and troubleshooting tips, review the official Chatwoot documentation. You can also explore related articles on deploying Docker-based applications to expand your knowledge of container management.

Comments

2 responses to “How to self-host Chatwoot using Docker”

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Matias Avatar

    I’m writing to you here since I don’t know why it doesn’t leave me in the YouTube comments.

    Thank you very much for your very good attitude and answering the messages, I really appreciate it a lot, I am now wanting to install it on another server and it gives me an error in the last step when certifying the domain. This is what the console tells me:

    Waiting for verification…
    Challenge failed for domain bot.imetrics.com.ar
    http-01 challenge for bot.imetrics.com.ar

    Certbot failed to authenticate some domains (authenticator: nginx). The Certificate Authority reported these problems:
    Domain: bot.imetrics.com.ar
    Type: unauthorized
    Detail: 2a02:4780:4a:c3f3:45d4:c156:ab45:c5a3: Invalid response from http://bot.imetrics.com.ar/.well-known/acme-challenge/TCWh8YR40s34fIH2hrW63D0rggxnp4N6knqtiohl_U0: 404

    Hint: The Certificate Authority failed to verify the temporary nginx configuration changes made by Certbot. Ensure the listed domains point to this nginx server and that it is accessible from the internet.

    Cleaning up challenges
    Some challenges have failed.
    Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

    When i re-run certbot -v it happen the same error.

    I already tried to do all the steps that you mentioned in the comment that you responded to me but the chatwoot file and some others are not found on the server, I leave the console logs:

    root@bot:~# sudo systemctl status chatwoot
    Unit chatwoot.service could not be found.
    root@bot:~# sudo systemctl restart chatwoot
    Failed to restart chatwoot.service: Unit chatwoot.service not found.
    root@bot:~# sudo systemctl status chatwoot
    Unit chatwoot.service could not be found.
    root@bot:~# sudo journalctl -u chatwoot –no-pager –lines=50
    — No entries —
    root@bot:~# cat /home/chatwoot/chatwoot/log/production.log
    cat: /home/chatwoot/chatwoot/log/production.log: No such file or directory

    root@bot:~# sudo netstat -tulnp | grep 3000
    tcp 0 0 127.0.0.1:3000 0.0.0.0:* LISTEN 16498/docker-proxy
    root@bot:~# sudo ss -tulnp | grep 3000
    tcp LISTEN 0 4096 127.0.0.1:3000 0.0.0.0:* users:((“docker-proxy”,pid=16498,fd=4))

    Also when I try to access the nginx configuration it appears as a new empty file

    root@bot:~# sudo nano /etc/nginx/sites-available/chatwoot
    root@bot:~# sudo nano /etc/nginx/sites-available/chatwoot
    root@bot:~# sudo ufw allow 80/tcp
    Rules updated
    Rules updated (v6)
    root@bot:~# sudo ufw allow 443/tcp
    Rules updated
    Rules updated (v6)
    root@bot:~# sudo ufw reload
    Firewall not enabled (skipping reload)

    root@bot:~# sudo systemctl restart nginx
    root@bot:~# sudo systemctl restart redis-server
    Failed to restart redis-server.service: Unit redis-server.service not found.
    root@bot:~# sudo systemctl restart postgresql
    Failed to restart postgresql.service: Unit postgresql.service not found.

    Thank you very much in advance for your time. I need to resolve this as soon as possible, I am willing to send some money if necessary if the situation becomes very complicated. And I would like us to be in contact through WhatsApp or some social network, if it is of your interest to join projects in the future.

    1. Ole Mai Avatar

      Hey Matias,

      I noticed your message on YouTube mentioning that the error was related to the subdomain you used. It sounds like you’ve already resolved the issue— is that correct?

      Let me know if you still need any assistance.

      Best regards
      Ole

How to self-host Chatwoot using Docker

About the author

Table of Contents