commcareHQ deploy failed: cchq echis deploy

Hi,
I tried to redeploy commcareHQ, but failed with the following error message:

A migration must be performed before this environment can be upgraded to the latest version of CommCareHQ. This migration is run using the management command opulate_application_access

Steps followed:

  1. git merge with the latest commcare-cloud code
  2. apply all the changelogs: changelog
  3. deploy code: cchq echis deploy

our latest deployment was on: 2020-01-11

Hi Demisew,

What happens if you run cchq echis django-manage populate_application_access ?

-Jenny

Hi Jenny, this is the output, running the cmd:

cchq echis django-manage populate_application_access

/home/cchq/www/echis/releases/2020-01-11_07.11/python_env-3.6/lib/python3.6/site-packages/psycopg2/init.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: http://initd.org/psycopg/docs/install.html#binary-install-from-pypi.
""")
Unknown command: 'populate_application_access'
Type 'manage.py help' for usage.
(ansible) ansible@echis0:~/.commcare-cloud/repo$ cchq echis django-manage opulate_application_access

Hi Demisew, it sounds like your commcare-hq code is out of date. Can you pull and merge commcare-hq?

I used the following steps:

1.Go to HQ directory: /home/cchq/www/echis/current

  1. git fetch origin master

  2. git merge origin/master

4.apply cchq echis django-manage populate_application_access



return _bootstrap._gcd_import(name[level:], package, level)

File "/home/cchq/www/echis/releases/2020-01-11_07.11/corehq/apps/app_manager/fixtures/init.py", line 1, in
from corehq.apps.app_manager.fixtures.mobile_ucr import (
File "/home/cchq/www/echis/releases/2020-01-11_07.11/corehq/apps/app_manager/fixtures/mobile_ucr.py", line 34, in
from corehq.apps.userreports.models import get_report_config
File "/home/cchq/www/echis/releases/2020-01-11_07.11/corehq/apps/userreports/models.py", line 74, in
from corehq.apps.userreports.reports.factory import (
File "/home/cchq/www/echis/releases/2020-01-11_07.11/corehq/apps/userreports/reports/factory.py", line 10, in
from corehq.apps.userreports.reports.specs import (
File "/home/cchq/www/echis/releases/2020-01-11_07.11/corehq/apps/userreports/reports/specs.py", line 18, in
from sqlagg.columns import (

from sqlagg.columns import (

ImportError: cannot import name 'ArrayAggColumn'
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds

  1. trying redeployment cchq echis deploy

Deploy Completed

thanks jenny

Hi Demisew,

That error looks like sqlagg, a dependency of commcare-hq, is out of date.

Can you run the command below to update requirements, and then retry the populate_application_access command?

pip install -r requirements/requirements.txt

-Jenny

The timeline here is:

  1. Last successful echis deploy
  2. Migration merged into master
  3. Current attempted (failed) echis deploy

Running cchq echis django-manage populate_application_access will attempt to run the command on the current release directory, which was created in #1 above, though the command isn't available until #2.

While a deploy can't be completed until the command is run, a more recent release directory can be set up, which should allow for this command to be run.

cchq echis fab setup_limited_release:keep_days=1 --set code_branch=origin/master

Then you can ssh to the django manage machine:

cchq echis ssh django_manage

Navigate to the newly created directory, which should be the most recent timestamp in /home/cchq/www/echis/releases/ (the setup_limited_release command will also output the location of this directory)

Then you can enter the python environment and run the command manually:

$ source python_env-3.6/bin/activate
$ ./manage.py populate_application_access

Alternatively, you could deploy a commit from after the command was added and before the migration made it mandatory, run cchq echis django-manage populate_application_access, then deploy the latest code. That's more straightforward to describe, but requires two full deploys, and isn't actually any easier in my opinion. Whichever you're more comfortable with should be fine.