CHT Core Framework > Overview > CHT Core
The different pieces of a CHT project, how they interact, and what they’re used for
This guide will walk you through setting up a deployment of CHT Sync with the CHT using Kubernetes. This path is recommended if you already have a Kubernetes cluster hosting the CHT.
git clone https://github.com/medic/cht-sync
).In the cht-sync
folder, copy the values in deploy/cht_sync/values.yaml.template
file to a new file named deploy/cht_sync/values.yaml
.
If you require a Postgres database to be set up in the cluster, you can use the postgres.enabled
flag in the values.yaml
file. If you already have a Postgres database outside the cluster, you can set the postgres.enabled
flag to false
. Also, if Postgres is outside the cluster, specify host
and port
in this section.
In either case, specify user
, password
, db
, schema
, and table
.
schema
can be used to separate CHT models from any other data that may already be in the database.table
is the name of the table that couch2pg will write couch documents to, and the source table for dbt models. It is recommended to leave this as couchdb
.postgres:
enabled: true
user: "postgres"
password: ""
db: ""
schema: "v1"
table: "couchdb"
host: "postgres" # if postgres is outside the cluster
port: 5432 # if postgres is outside the cluster
Set CouchDB shared values in the values.yaml
file.
couchdb:
user: "your_couchdb_user"
dbs: "medic"
port: "443"
secure: "true"
Configure the CouchDB instance to be replicated in the values.yaml
file. For the host, use the CouchDB host URL used to publicly access the instance and for the password, use the password associated with the user set above.
couchdbs:
- host: "host1.cht-core.test"
password: "password1"
If you have multiple CouchDB instances to replicate, you can add them to the couchdbs
list.
couchdbs:
- host: "host1.cht-core.test"
password: "password1"
- host: "host2.cht-core.test"
password: "password2"
If an instance has a different port, user or different CouchDB databases to be synced, you can specify it in the couchdbs
list.
- host: "host1" # required for all couchdb instances
password: "" # required for all couchdb instances
- host: "host2.cht-core.test"
password: "new_password"
user: "separate_user"
dbs: "medic medic_sentinel"
port: "5984"
secure: "false"
- host: "host3.cht-core.test"
password: "password3"
Set the cht-pipeline branch URL in the values.yaml
file.
cht_pipeline_branch_url: "https://github.com/medic/cht-pipeline.git#main"
(Optional) You can also configure a Metrics Exporter. If enabled, this will create a sql exporter that queries the database for couch2pg status, number of changes pending, and current sequence and exposes these metrics in Prometheus format at a service with name metrics
at port 9399, for use with CHT Watchdog or any other monitoring service.
An HTTP ingress needs to be created to allow access from outside the cluster.
metrics_exporter:
enabled: true
Run the command below to deploy the cht-sync helm chart. The chart is at deploy/cht_sync
; if values.yaml
is in a different directory, specify the path.
cd deploy/cht_sync
helm install cht-sync . --values values.yaml
Run the following command to get the status of the deployment.
kubectl get pods
Run the following command to get the logs of a pod.
kubectl logs -f cht-sync-<pod-id>
The different pieces of a CHT project, how they interact, and what they’re used for
Data synchronization tools to enable analytics
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.