CHT Sync Setup with Docker

Setting up CHT Sync with Docker and the CHT

This guide will walk you through setting up a deployment of CHT Sync with the CHT using Docker. This path is recommended if you host the CHT with Docker.

Prerequisites

Setup

In the cht-sync folder, copy the values from the env.template file to a .env file. For more information, see the references on the Environment variables page.

For production CHT Core deployments, the port will most likely need to be set to 443 like this: COUCHDB_PORT=443. This is because CHT Core uses an nginx reverse proxy on port 443, instead of the default 5984 port used in a stand-alone CouchDB instance which the env.template has.

Separate CouchDB instance

This setup involves starting couch2pg, PostgreSQL, pgAdmin and dbt. It assumes you have a CouchDB instance running, and you updated the .env CouchDB variables accordingly.

Run the Docker containers locally and wait for every container to be up and running:

docker compose -f docker-compose.postgres.yml -f docker-compose.yml up -d

You can verify this command worked by running docker ps. It should show 4 containers running including couch2pg, dbt, PostgreSQL, and pgAdmin.

Separate CouchDB and PostgreSQL instances

This local setup involves starting couch2pg and dbt. It assumes that CouchDB and PostgreSQL instances are run separately from the Docker Compose provided with CHT Sync, and the .env variables were updated to match those instances details.

Run the Docker containers locally and wait for every container to be up and running:

docker compose -f docker-compose.yml up -d

You can verify this command worked by running docker ps. It should show 2 containers running: couch2pg and dbt.

Cleanup

When you are done using the services, you can clean everything by running down.

For example, in the scenario of separate couchdb instance, the command should look like:

docker compose -f docker-compose.postgres.yml -f docker-compose.yml down

To remove all the data volumes, add -v at the end of this command.


CHT Core Framework > Overview > CHT Core

The different pieces of a CHT project, how they interact, and what they’re used for

CHT Core Framework > Overview > CHT Sync

Data synchronization tools to enable analytics