Environment Variables

Environment variables for running CHT Sync

There are three environment variable groups in the .env file. To successfully set up CHT Sync, it is important to understand the difference between them.

  1. POSTGRES_: Used by PostgREST and PostgreSQL to establish the PostgreSQL database to synchronize CouchDB data to. They also define the schema and table names to store the CouchDB data. The main objective is to define the environment where the raw CouchDB data will be copied.
  2. DBT_: Exclusive to the DBT configuration. The main objective is to define the environment where the tables and views for the models defined in CHT_PIPELINE_BRANCH_URL will be created. It is important to separate this environment from the previous group. DBT_POSTGRES_SCHEMA must be different from POSTGRES_SCHEMA. DBT_POSTGRES_HOST has to be the Postgres instance created with the environment variables set in the first group.
  3. COUCHDB_: Used by CouchDB and Logstash to define the CouchDB instance to sync with. With COUCHDB_DBS, we can specify a list of databases to sync.

All the variables in the .env file:

NameDefaultDescription
COMPOSE_PROJECT_NAMEpipeline(Optional) Docker Compose name
POSTGRES_USERpostgresUsername of the PostgreSQL database to copy CouchDB data to
POSTGRES_PASSWORDpostgresPassword of the PostgreSQL database to copy CouchDB data to
POSTGRES_DBdataPostgreSQL database where the CouchDB data is copied
POSTGRES_SCHEMAv1PostgreSQL schema where the CouchDB data is copied
POSTGRES_TABLEmedicPostgreSQL table where the CouchDB data is copied. For DBT use only.
POSTGRES_HOSTlocalhostPostgreSQL instance to copy CouchDB data to. To be set only if the PostgreSQL instance is different than the container provided with CHT Sync.
DBT_POSTGRES_USERpostgresUsername of the PostgreSQL database where DBT creates tables and views from the models in CHT_PIPELINE_BRANCH_URL
DBT_POSTGRES_PASSWORDpostgresPassword of the PostgreSQL database where DBT creates tables and views from the models in CHT_PIPELINE_BRANCH_URL
DBT_POSTGRES_SCHEMAdbtPostgreSQL schema where DBT creates tables and views from the models in CHT_PIPELINE_BRANCH_URL
DBT_POSTGRES_HOSTpostgresPostgreSQL instance IP or endpoint
CHT_PIPELINE_BRANCH_URL"https://github.com/medic/cht-pipeline.git#main"CHT Pipeline branch containing the DBT models
DATAEMON_INTERVAL5Interval (in minutes) for looking for new changes in the CouchDB data
COUCHDB_USERmedicUsername of the CouchDB instance to sync with
COUCHDB_PASSWORDpasswordPassword of the CouchDB instance to sync with
COUCHDB_DBS"medic"Space separated list of databases to sync e.g "medic medic_sentinel"
COUCHDB_HOSTcouchdbHost of the CouchDB instance to sync with
COUCHDB_PORT5984Port of the CouchDB instance to sync with
COUCHDB_SECUREfalseIs connection to CouchDB instance secure?