Cht development environment setup with more than 1 couchdb node

Hi community,
I’m following this guide https://docs.communityhealthtoolkit.org/contribute/code/core/dev-environment/#couchdb-setup-in-cht-4x to setup the couchdb docker installation and the local dev environment and all works as expected, but I’m wonderig

is there another coucdb docker compose yaml file to have more than 1 couchdb nodes to setup the dev local environment with ?

Thank you

Hi @bamatic

We publish a docker-compose file for a 3-node local CouchDb installation: https://staging.dev.medicmobile.org/_couch/builds_4/medic:medic:master/docker-compose/cht-couchdb-clustered.yml

We mainly publish this for testing, because in a real production deployment, to get the most benefit from clustering CouchDb, the nodes should be distributed on multiple machines - and thus would require a different compose file per machine.

You will need to change couchdb-override.yml, because the service that it refers to (couchdb) doesn’t exist. Additionally, in order to be closer to production, you would need to use an haproxy load balancer in front of CouchDb, instead of relying on internal CouchDb networking entirely and only sending requests to one node.

Please let me know if you hit any blockers.

Do you think it would be valuable to have a fully documented guide on how to develop locally against clustered CouchDb? Also, would you mind sharing the the reason for wanting to use clustered in a development environment?

Hi @diana than you for your answer
Really asking for a couchdb cluster installation for the development environment doesn’t make much sense.
In fact, what I needed was an installation of docker with couchdb 2.x in a cluster, like in cht 4, to test a data ingestion script that we used with version 3.x and since for these developments I usually use the same dockerized couchdb installation that I use with the local development environment, I have mixed the two.
Despite this, I think that your answer works for me, I do not need a load balance or a ready to production cluster.

1 Like