Community Health Toolkit

Core Framework: Failed to create initial CouchDB administrative account

Describe the Bug
During CHT installation I am getting Fatal: Failed to create initial CouchDB administrative account error
Moving conversation from Github for the benefit of other Community members:

How To Reproduce The Issue

  1. Clone
  2. Follow instructions to run CHT
  3. Check the CouchDB logs for the error message

Expected Behavior
CouchDB admin user should be created and CHT app should run
root@cf3c91e7cff4:/srv/storage/medic-core# tail -f /srv/storage/medic-core/couchdb/logs/startup.log

[notice] 2020-07-26T10:18:52.333172Z couchdb@ <0.350.0> -------- chttpd_auth_cache changes listener died database_does_not_exist at mem3_shards:load_shards_from_db/6(line:395) <= mem3_shards:load_shards_from_disk/1(line:370) <= mem3_shards:load_shards_from_disk/2(line:399) <= mem3_shards:for_docid/3(line:86) <= fabric_doc_open:go/3(line:39) <= chttpd_auth_cache:ensure_auth_ddoc_exists/2(line:195) <= chttpd_auth_cache:listen_for_changes/1(line:142)
[error] 2020-07-26T10:18:57.335931Z couchdb@ emulator -------- Error in process <0.19943.1> on node ‘couchdb@’ with exit value:


  • OS
    root@osboxes:~# lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 18.04.4 LTS
    Release: 18.04
    Codename: bionic

  • Instance: Local instance

  • Version:
    Docker: Docker version 19.03.6, build 369ce74a3c
    Docker Compose: version 1.26.2, build unknown

Additional Context
The problem started after the upgrade of medic-os docker to: medic-os:cht-3.9.0-rc.1

@munjoma please confirm that you are running docker-compose up as root and also that you exported the couchdb admin password in your shell before running docker-compose up?


You may need to prune your system of past installs because any second install attempt will assume that you have already installed


Yes I am running docker-compose up as root. I am running the script as root.

I did not run that step. With the script how do I do that? Do I just follow instructions in Docker Setup?

Yeah the instructions here detail how you should get the CHT Medic-Os up and running through docker. Make sure you use our later docker image though. The process is a simple 3 step

  1. Install all docker prerequisites
  2. Export the CouchDB admin password.
  3. Run docker-compose up (run in detached mode if you are running it in production mode.)

Hi @nyika

I pruned my system of past installs.

the did run

from /cht-infrastructure/self-hosting/main$

confirm I have to replace <random_pw> with a password of my choice? (which I did)

Still no luck.
Please find the log file here (I can not upload the file, file format not supported)

From what I see in this logfile there’s a hint that CouchDB was not set up properly and you are trying over a failed install. The _users DB is missing. To do a fresh install follow these steps.

  1. Prune your system (assuming you only have the CHT docker images )
    docker system prune -a --volumes

  2. Get the latest docker-compose file here.

  3. In your shell as root Export the CouchDB password. export DOCKER_COUCHDB_ADMIN_PASSWORD=myAwesomePassword

  4. In the same shell install the medic-os and ha-proxy containers in detached mode.
    # docker-compose -f /path/to/docker-compose.yml up -d