Docker Chatwoot Production deployment guide
Link: https://www.developers.chatwoot.com/docs/self-hosted/deployment/docker/docker
Docker Chatwoot Production deployment guide
Deploy Chatwoot using Docker containers for production environments
Pre-requisites
Before proceeding, make sure you have the latest version of docker and docker-compose installed.
As of now[now [at the time of writing this doc], we recommend a version equal to or higher than the following.
$ docker --version
Docker version 20.10.10, build b485636
$ docker compose version
Docker Compose version v2.14.1
Note Container name uses dashes instead of underscores by default with new docker/compose versions. If you are using an older version of docker/compose, replace - with _. Also, use docker-compose instead of docker compose.
Steps to deploy Chatwoot using docker-compose
1. Install Docker on your VM
# example in ubuntu
apt-get update
apt-get upgrade
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
apt install docker-compose-plugin
2. Download the required files
# Download the env file template
wget -O .env https://raw.githubusercontent.com/chatwoot/chatwoot/develop/.env.example
# Download the Docker compose template
wget -O docker-compose.yaml https://raw.githubusercontent.com/chatwoot/chatwoot/develop/docker-compose.production.yaml
# example in ubuntu
apt-get update
apt-get upgrade
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
apt install docker-compose-plugin
3. Configure Downloadenvironment thevariables
required files
Tweak the .env and docker-compose.yaml according to your preferences. Refer to the available environment variables. You could also remove the dependant services like Postgres, Redis etc., in favor of managed services configured via environment variables.
# update redis and postgres passwords
nano .env
# update docker-compose.yaml same postgres pass
nano docker-compose.yaml
4. Prepare the database
Prepare the database by running the migrations.
docker compose run --rm rails bundle exec rails db:chatwoot_prepare
5. Start the services
Get the service up and running.
# example in ubuntu
apt-get update
apt-get upgrade
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
apt install docker-compose-plugin
# Download the env file template
wget -O .env https://raw.githubusercontent.com/chatwoot/chatwoot/develop/.env.example
# Download the Docker compose template
wget -O docker-compose.yaml https://raw.githubusercontent.com/chatwoot/chatwoot/develop/docker-compose.production.yaml
# example in ubuntu
apt-get update
apt-get upgrade
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
apt install docker-compose-plugin
3. Configure Downloadenvironment thevariables
Tweak the
.envanddocker-compose.yamlaccording to your preferences. Refer to the available environment variables. You could also remove the dependant services likePostgres,Redisetc., in favor of managed services configured via environment variables.
# update redis and postgres passwords
nano .env
# update docker-compose.yaml same postgres pass
nano docker-compose.yaml
4. Prepare the database
Prepare the database by running the migrations.
docker compose run --rm rails bundle exec rails db:chatwoot_prepare
Get the service up and running.
docker compose up -d
If you want to verify whether the installation is working, try curl -I localhost:3000/api to see if it returns 200. Also, you could temporarily drop the 127.0.0.1:3000:3000 for rails to 3000:3000 in the compose file to access your instance at http://<your-external-ip>:3000. It'It’s recommended to revert this change back and use Nginx or some proxy server in the front.
Additional Steps
- Have an
Nginxweb server acting as a reverse proxy for Chatwoot installation. So that you can access Chatwoot fromhttps://chat.yourdomain.com - Run
docker compose run --rm rails bundle exec rails db:chatwoot_preparewhenever you decide to update the Chatwoot images to handle the migrations.