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.

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