Standalone CommcareHQ installation

(Ed Robinson) #1

I’m setting up a standalone CommcareHQ instance based on the instructions here:

Is there a more up to date set of instructions for installing CommcareHQ standalone?
Among other things, it references the bootstrap script which is deprecated by the looks.

One particular issue I’m having is
django.db.utils.OperationalError: fe_sendauth: no password supplied

When running:
env CCHQ_IS_FRESH_INSTALL=1 /home/commcarehq/bin/python manage.py migrate --noinput
I can access the DB while logged in as commcarehq (no password required).

EDIT if I assign a password to the commcarehq psql user the script runs to a point but then halts on this error:

 Applying userreports.0009_rename_ucr_tables...Traceback (most recent call last):

File “manage.py”, line 207, in
execute_from_command_line(sys.argv)
File “/home/commcarehq/local/lib/python2.7/site-packages/django/core/management/init.py”, line 364, in execute_from_command_line
utility.execute()
File “/home/commcarehq/local/lib/python2.7/site-packages/django/core/management/init.py”, line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/home/commcarehq/local/lib/python2.7/site-packages/django/core/management/base.py”, line 283, in run_from_argv
self.execute(*args, **cmd_options)
File “/home/commcarehq/local/lib/python2.7/site-packages/django/core/management/base.py”, line 330, in execute
output = self.handle(*args, **options)
File “/home/commcarehq/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py”, line 204, in handle
fake_initial=fake_initial,
File “/home/commcarehq/local/lib/python2.7/site-packages/django/db/migrations/executor.py”, line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File “/home/commcarehq/local/lib/python2.7/site-packages/django/db/migrations/executor.py”, line 145, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File “/home/commcarehq/local/lib/python2.7/site-packages/django/db/migrations/executor.py”, line 244, in apply_migration
state = migration.apply(state, schema_editor)
File “/home/commcarehq/local/lib/python2.7/site-packages/django/db/migrations/migration.py”, line 129, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File “/home/commcarehq/local/lib/python2.7/site-packages/django/db/migrations/operations/special.py”, line 193, in database_forwards
self.code(from_state.apps, schema_editor)
File “/home/commcarehq/commcare-hq/corehq/apps/userreports/migrations/0009_rename_ucr_tables.py”, line 65, in _assert_migrated
for engine_id, data_sources in _data_sources_by_engine_id().items():
File “/home/commcarehq/commcare-hq/corehq/apps/userreports/migrations/0009_rename_ucr_tables.py”, line 50, in _data_sources_by_engine_id
for ds in StaticDataSourceConfiguration.all():
File “/home/commcarehq/commcare-hq/corehq/apps/userreports/models.py”, line 838, in all
for wrapped in cls._all():
File “/home/commcarehq/commcare-hq/corehq/apps/userreports/models.py”, line 1271, in _filter_by_server_env
for wrapped in configs:
File “/home/commcarehq/commcare-hq/corehq/apps/userreports/models.py”, line 830, in __get_all
for wrapped, path in provider_fn():
File “/home/commcarehq/commcare-hq/corehq/apps/callcenter/data_source.py”, line 28, in call_center_data_source_configuration_provider
domains = [domain for domain in get_call_center_domains() if domain.use_fixtures]
File “/home/commcarehq/commcare-hq/corehq/apps/callcenter/utils.py”, line 76, in get_call_center_domains
‘call_center_config.use_fixtures’])
File “/home/commcarehq/commcare-hq/corehq/apps/es/es_query.py”, line 226, in run
es_instance_alias=self.es_instance_alias,
File “/home/commcarehq/commcare-hq/corehq/elastic.py”, line 258, in run_query
raise ESError(e)
corehq.elastic.ESError: TransportError(406, u’Content-Type header [] is not supported’)

Any help would be appreciated!

(Cory Zue) #2

Hey,

Yes, apologies those instructions are out of date I think. The current recommended path to setting up your own CommCare HQ instance is via commcare-cloud: https://dimagi.github.io/commcare-cloud/

Am not sure about the specific errors you’ve encountered, but I’d recommend following those other instructions and see whether that unblocks you.

Cory

1 Like
(Ed Robinson) #3

Thanks for the feedback Cory. I find that documentation a little scant on detail but I’m going to give it a go and let you know if I run into any brick walls. Let me first lay out my assumptions and you can tell me if I’m on the right track or not:

Commcare cloud is a cerntral management engine for deployment and update of the various components that make up CommcareHQ and / or multiple CommcareHQ deployments. The system is designed for easier management of a distributed ecosystem.

For deployment of a standalone CommcareHQ server, I assume it makes sense to separate it from the Commcare cloud box and perform the installation from the Commcare cloud server - thinking from a security standpoint and storage of ssh keys on the box.

If I were to set up a test environment with both on the same box, I assume I just point to the loopback address in the Commcare cloud environment configs.

What I’m not 100% sure of yet is if the process is to first setup the component services (CouchDB, PostgreSQL, Kafka, etc.), configure the environment settings and then run the cchq deploy commands for those services, or if the installation of these components is included in the cchq deploy scripts?

Thanks!

(Cory Zue) #4

Hi Ed,

Yeah, apologies for the somewhat opaque guidance. We have been undertaking to make this all clear/easier for third-party hosting of CommCare HQ, but as you can tell it’s a work in progress. Any feedback or contributions you can make on the code or documentation side from your experience would be very welcome!

At a high level your understanding is correct. I don’t believe there are any issues with running commcare-cloud and commcare-hq-as-a-monolith on the same server though am not sure anyone has tried that exact combination. You can also run commcare-cloud on a developer/local box (all it needs is ssh access to the environment).

Commcare cloud should take care of installation of all component services for you.

This is an example of an inventory file for a single-server install that may be helpful: https://github.com/dimagi/commcare-cloud/blob/master/environments/swiss/inventory.ini

Cory

1 Like
(Ed Robinson) #5

Great, thanks for that link Cory, I’ll take a look. I think I’ll run Commcare Cloud on a VM that’s easy to backup and keep offline / fire up when needed for maintenance. I assume Commcare Cloud is not required for the daily operation of the CommcareHQ environment or is that an incorrect assumption?
Cheers!

(Ed Robinson) #6

One other question, I see this document:


says “The system and all our tools have been well-tested on Ubuntu 14.04 Trusty Tahr and aren’t expected or guaranteed to work on any other OS or Ubuntu version.”

I assume that changed, given that 14.04 LTS is has reached EOL in April 2019?
Thanks!

(Ethan Soergel) #7

Ed,

Thanks for highlighting. That documentation page is indeed out-of-date, I will update it. We are now using 18.04 Bionic Beaver as the primary release target.

To your other question, CommCare Cloud is not required for operation, though it is the best way to deploy regular updates. It also contains a changelog detailing occasional updates which require a manual step.


Ethan

1 Like
(Ed Robinson) #8

Awesome, thanks for that feedback Ethan!
Cheers,
Ed