Issues setting up a new CommCareHQ environment on a single machine

Hi

I have been trying to do my 1st install of commcare on a new vm Ubuntu 18.04.6 LTS.

I found several issue while running "commcare-cloud monolith deploy-stack --first-time -e 'CCHQ_IS_FRESH_INSTALL=1'"

1st issue was installing 'erlang-mode=1:19.3.6.13-1' this failed due to that version being unavailable, i managed to get round this by commenting out 'erlang-mode=1:19.3.6.13-1'

2nd issue was installing 'simpleeval==0.9.10' again commenting this out allowed the setup to continue

3rd issue was

TASK [commcarehq : Pull source repo (GitHub - dimagi/commcare-hq: CommCareHQ is the server backend for CommCare, the world's largest platform for designing, managing, and deploying robust, offline-first, mobile applications to frontline workers worldwide)] ************************************************************************************************

fatal: [192.168.2.195]: FAILED! => {"before": "5432e0d9fcc078bad2840c5337b3d936b2ff66af", "changed": false, "msg": "Local modifications exist in repository (force=no)."}

PLAY RECAP **********************************************************************************************************************************************************************

192.168.2.195: ok=381changed=21 unreachable=0failed=1skipped=306rescued=0ignored=3

✗ Apply failed with status code 2

this i fixed by running

'cchq monolith ap deploy_commcarehq.yml'

4th issue was

TASK [add "DigiCert SHA2 Secure Server CA" certificate to certifi] **************************************************************************************************************

fatal: [192.168.2.195]: FAILED! => {"changed": false, "msg": "Path /home/cchq/www/monolith/current/python_env-3.6/lib/python3.6/site-packages/certifi/cacert.pem does not exist !", "rc": 257}

PLAY RECAP **********************************************************************************************************************************************************************

192.168.2.195: ok=397changed=21 unreachable=0failed=1skipped=312rescued=0ignored=3

✗ Apply failed with status code 2

this i fixed by manualy creating the folders certifi and adding in the certificate which didn't exist and reruning'cchq monolith ap deploy_commcarehq.yml'

last issue was

TASK [Migrate DB] ***************************************************************************************************************************************************************

fatal: [192.168.2.195]: FAILED! => {"changed": false, "cmd": "./manage.py migrate_multi --noinput", "msg": "\n:stderr: Traceback (most recent call last):\nFile "./manage.py", line 5, in \nimport attr\nModuleNotFoundError: No module named 'attr'\n", "path": "/home/cchq/www/monolith/current/python_env-3.6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin", "syspath": ["/tmp/ansible_django_manage_payload_eg8nx5in/ansible_django_manage_payload.zip", "", "/usr/lib/python36.zip", "/usr/lib/python3.6", "/usr/lib/python3.6/lib-dynload", "/usr/local/lib/python3.6/dist-packages", "/usr/lib/python3/dist-packages"]}

PLAY RECAP **********************************************************************************************************************************************************************

192.168.2.195: ok=583changed=65 unreachable=0failed=1skipped=418rescued=0ignored=3

✗ Apply failed with status code 2

i managed to get round this by commenting out 'migrate_on_fresh_install.yml'in deploy_stack.yml

i can now rerun "commcare-cloud monolith deploy-stack --skip-check -e 'CCHQ_IS_FRESH_INSTALL=1' and it will complete successfully.

i am now at the point of deploying CommCare HQ and this is where i can't continue due to the following error

commcare-cloud monolith django-manage create_kafka_topics

ssh phil@192.168.2.195 -t -o UserKnownHostsFile=/home/phil/environments/monolith/known_hosts 'sudo -iu cchq bash -c '"'"'cd /home/cchq/www/monolith/current; python_env-3.6/bin/python manage.py create_kafka_topics'"'"''

Ubuntu 18.04.6 LTS

Enter passphrase for key '/home/phil/.ssh/id_rsa':

Traceback (most recent call last):

File "manage.py", line 5, in

import attr

ModuleNotFoundError: No module named 'attr'

Connection to 192.168.2.195 closed.

and no matter what i try to run any command that refrences manage.py, which seems to most commands, fails with the same error.

I have tried manually adding attr module using PIP but the command still fails

if anyone has any idea's how to resolve the manage.py issue that would be great

thanks

Hi @prckmc

Sorry that you are running into this issue! The erlang package that is throwing that first error has recently been removed from the apt repository we use.

In your /environments/{env_name}/public.yml file, could you add the variable:

couchdb_version: '3.1.1'

You should then be able to run the installation playbooks again and it will install the correct dependencies.
We will be pushing a fix for this soon, as well as updating our default couchdb version in the near future so this won't happen again.

Thanks!

For the second issue ('simpleeval==0.9.10') you can follow the steps detailed here: Deploy failing - log included - #5 by Simon_Kelly

I am also getting this erlang package error tried to do the update in the public.yml but its not working any other suggestions.

Thank you.

Hi @fchiyenda

You can find which versions of Erlang are available with the following command:

$ apt-cache show esl-erlang | grep Version

I went with "1:23.0.2-2" because it's the same version that Dimagi uses in production.

Add an available version to your environment's public.yml. e.g.

erlang: 1:23.0.2-2

and try deploy-stack again.

I hope that helps.

Hello @Norman

I tried doing updating as advised but I get the same error I have attached the screenshot for your reference and assistance.

Thank you

Hi @fchiyenda

It appears from the screenshot you posted of

$ apt-cache show esl-erlang | grep Version

that only version 1:25.0.1-1 is available.

But the error message in the screenshot includes, "Version '1:20.3.8.26-1' for 'esl-erlang' was not found". -- It's not trying to install the version that's available.

Are you sure you set

erlang: 1:25.0.1-1

in your ~/environments/monolith/public.yml file? If you did, are there maybe multiple lines in public.yml that start with "erlang:", so the good value is being overwritten with a bad value?

I have a more general concern, based on that version number. Dimagi is currently using Ubuntu 18.04 LTS in their cloud environments, and that is the version of Ubuntu that commcare-cloud is written for and tested against. I am guessing, from the version of esl-erlang you posted, that you are using a more recent version of Ubuntu. That might be OK ... but it might not be. I am worried that you could encounter problems that Dimagi and other customers do not encounter, and they might have more difficulty helping you with those problems.

I would recommend that you keep your operating system version in line with what Dimagi is using in production, for the sake of your environment's stability and support.

I experienced a similar issue attempting to deploy a new instance last week. It appears the Ubunutu 18.04 repository only has 1:25.01-1 available. Is it safe to assume we can still append this to the public.yml file as instructed?

Hi @fchiyenda and @nikotelhe

I'm sorry, my mistake. esl-erlang version 1:25.0.1-1 is available for Ubuntu 18.04.

However, when I specify that version in public.yml, then I encounter problems later on.

I'm looking into this. I hope to get back shortly with an update.

1 Like

Dimagi engineers have implemented a workaround for the problem with installing Erlang at the moment. You can find more details here: Error installing Erlang (resolved)