Deploy Chatwoot using Docker containers for production environments
Before proceeding, make sure you have the latest version of docker
and docker-compose
installed.
As of now [at the time of writing this doc], we recommend a version equal to or higher than the following.
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
.
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.
Your Chatwoot installation is complete. Please note that the containers are not exposed to the internet and they only bind to the localhost. Setup something like Nginx or any other proxy server to proxy the requests to the container.
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’s recommended to revert this change back and use Nginx or some proxy server in the front.
Nginx
web server acting as a reverse proxy for Chatwoot installation. So that you can access Chatwoot from https://chat.yourdomain.com
docker compose run --rm rails bundle exec rails db:chatwoot_prepare
whenever you decide to update the Chatwoot images to handle the migrations.Use the following Nginx config after replacing the yourdomain.com
in server_name
.
Your Chatwoot installation should be accessible from the https://yourdomain.com
now.
We publish our base images to the Docker hub. You should be able to build your Chatwoot web/worker images from these base images.
The app servers will run available on port 3000
. Ensure the images connect to the same database and Redis servers. Provide the configuration for these services via environment variables.
To set up the database for the first time, you must run rails db:chatwoot_prepare
. You may get errors if you try to run rails db:migrate
at this point.
If you’re not using the latest
or latest-ce
tag, you first need to change the desired tag in your docker-compose file.
After that you can pull the new image and start using them:
Finally you may need to update the database:
If you want to run Chatwoot CE edition, replace the docker image tag with equivalent foss version tag. Docker tag for current master
would be latest-ce
. Version specific tags would follow the pattern v*-ce
. For example the docker ce edition tag for Chatwoot v2.3.2
would be v2.3.2-ce
.