ERROR "Sync couch views" - Deploy CommCare HQ services

Hello team

I am trying to do a cluster install with 7 servers, with two servers for "couchdb2" and another server for "couchdb2_proxy"
and I get this error;

if someone can help me please

Hello Mirado,

It looks like you are getting an unexpected error (that the database commcarehq__apps already exists) when the ansible is trying to 'Sync Couch Views'. Could you please let us know which steps you have followed so far or which docs you have followed that led you to this point?

(Also, please consider copying and pasting the error or screenshotting at a higher resolution so that the text is easier to read if you have further logs)


Hello team

thank you very much for your reply
we follow the documentation of the official deployment and we stop on the " " and we customize the configurations in this "" on the environment with 7 servers under KVM

Thanks again for your help

Hi Mirado,

I used the traceback you gave to locate this in the codebase, and I can't find an obvious way that this could happen.

If you make the following curl requests from the command line on the django_manage machine, what do you get?

curl -X HEAD -v
curl -X HEAD -v
curl -X HEAD -v
curl -X HEAD -v

What response codes do you see? The first is querying the couchdb2_proxy and the last three are querying the nodes individually. I would normally expect them all to give the same answer: status code 200 if the database exists and 404 if it doesn't. If they give different answers that may be a good clue.

Hello Danny

server responses to all django_manager curl commands are not 200 but 401, there is a permission issue somewhere,



Hello Mirado,

This is due to there being no username and password supplied.

Could you try adding username and password to the URLs and try again?

curl -X GET http://user:pass@ -v
curl -X GET http://user:pass@ -v
curl -X GET http://user:pass@ -v
curl -X GET http://user:pass@ -v

The username and password would be located in you ansible vault file under COUCH_USERNAME and COUCH_PASSWORD. You may use below commands to get them

commcare-cloud <env> secrets view COUCH_USERNAME
commcare-cloud <env> secrets view COUCH_PASSWORD

Hello team

Ok, thanks very much, I tried these commands and everything is fine

, I also updated commcare-cloud by running "git pull" then "update-code" and now there is no error at all. 'step "sync couch view" but another error occurred in the next step "Migrate DB"


Is the command you're running still the following?

commcare-cloud cluster deploy-stack --skip-check -e 'CCHQ_IS_FRESH_INSTALL=1'

It seems like the important part of that error is

DENIED Redis is running in protected mode...

which is something to look into. I don't know off the top of my head what might have left it in that state.

Hi Mirado,

As Danny mentioned the issue is with Redis now. You could try deploying redis again and then run the above command to see if that resolves the issue

commcare-cloud cluster ansible-playbook deploy_redis.yml

Hello Team

the command didn't work, but I manually disabled "redis protected mode" via "redis-cli", and it worked, I tried putting this config in the "playbook deploy_redis.yml" but was not considered

thank you very much for your help, I have rarely seen such a responsive community, you are awesome

I will try to finalize the installation but I would like to have your opinion on our configuration, do you have any suggestions or best practices to share with us?

Hi @Mirado

Are there specific areas in your configuration you want us to comment on perhaps? If you want, you can compare your config with the config under /environments/production found in the commcare-cloud repo.

As for best practises, everything you need to know should be in the Deployment Docs. I hope this helps.

Hello team,

Thank you very much for your help
Sorry for the late response, our instance is now functional, but I wanted more explanation on the SMTP and SMS gateway settings. if you have the corresponding documents please

@Mirado Unfortunately there's not much documentation on this subject. This is about it. Do you have any specific questions or things you're wondering about?

Thanks @smittieC , for the SMS gateway, no, but for the SMTP configuration yes, I don't see how to "configure authentication with SMTP" so that the instance can make email invitations

And another subject that I also wanted to ask you is the command "make_domain_enterprise_level" to pass to the enterprise subscription, how to use it in production mode (how to put debug mode then return) because I can't find this in the docs

@Mirado Regarding the SMTP configuration, I don't have an answer for you right away, so will need to get back to you on that one (I'm not sure myself).

Regarding the make_domain_enterprise_level management command, I think it will be easier to just run what it runs inside a django shell:

cchq cluster django-manage shell

Then run

from corehq.apps.domain.forms import DimagiOnlyEnterpriseForm
domain = "your-domain"
DimagiOnlyEnterpriseForm(domain, '').process_subscription_management()

Note that this domain will not be billed, so only run this for domains that are you own.

@smittieC thank you, I managed to upgrade to the enterprise version, all that remains is to configure the SMTP authentication and everything is OK, let me know when you have found how to do it please

@smittieC, finally, I found the config for SMTP authentication, I just had to put it among the vault.yml keys, thanks again for your help, I think everything is fine now

@Mirado That's great to hear (or read)!