Forked from https://github.com/dimagi/commcare-hq
This is the GitHub repository for WDDCP, comprising an installation of CommCare HQ forked from https://github.com/dimagi/commcare-hq.
Branch commcare-wddcp:wddcp is the main branch for WDDCP: Pull Requests should be made into this branch, and releases will be made from here. The branch is protected, so all Pull Requests must be approved by a repository owner.
Branch commcare-wddcp:dimagi will be kept up to date with dimagi:commcare-hq:master by repository owners. It is locked against Pull Requests, as the only route into it should be by merging from upstream. NB: These merges should all be fast-forward: if they're not then something has gone wrong.
We aim to take updates from upstream (dimagi/commcare-hq:master) into commcare-wddcp:wddcp as soon as practical, limited by available development time, and conflicts with our changes. Upstream changes should be checked out into a new branch for testing before being incorporated.
(Branch commcare-wddcp:master has been removed to avoid confusion (ha), as it would otherwise be unclear whether commcare-wddcp:master tracked dimagi:master or was the main branch for the WDDCP.)
Contributors to commcare-wddcp should fork the core WDDCP repo (https://github.com/WDDCP/commcare-wddcp), and should make sure their WIP branches are kept up-to-date with branch commcare-wddcp:wddcp.
Here is a very rough (and probably inaccurate) diagram of what Helen thinks is happening on the platform:
The following is the best guide Helen can come up with.
In project root:
Start Vagrant
vagrant up
- Runs from Vagrantfile and provisions everything
- Also runs
git submodule update --init --recursive
Get into new vagrant box:
vagrant ssh
Be in the correct folder:
cd /vagrant
Build and set up required services:
./scripts/docker runserver --bootstrap
(You might need to ctrl^c and restart if it hangs...)
Inside vagrant machine:
./scripts/docker runserver
Get into vagrant box again and be in the project root:
vagrant ssh
cd /vagrant
Start CLI to appropriate docker image:
./scripts/docker bash
Be in the folder where files are:
cd /mnt/commcare-hq
Update django models:
./manage.py makemigrations
then ./manage.py migrate
If this doesn't work then try turning the server off and on again (the ./scripts/docker runserver
step)
The application should now be available from localhost:8000 (or wherever specified in the Vagrantfile
)
- username: [email protected]
- password: password
- (domain: demo -- I don't know where this is used yet)
Be in FormPlayer root on vagrant box:
cd /vagrant/formplayer
Update submodules:
git submodule update --init --recursive
Create a settings file from the sample:
cp config/application.example.properties config/application.properties
Install Java APK:
sudo apt install --yes openjdk-8-jdk
Install PostgreSQL:
sudo apt-get install postgresql-9.5 postgresql-client-9.5
Create a postgres user:
sudo -u postgres createuser commcarehq -SDRP
Enter password for new role: <commcarehq>
Enter it again: <commcarehq>
Create a formplayer db under the commcarehq user:
sudo -u postgres createdb -E UTF-8 -O commcarehq formplayer
Build with gradlew:
./gradlew
Check the management server and server is actually up and accepting connections before going any further:
curl http://127.0.0.1:8081/
{"timestamp":1506094934105,"status":404,"error":"Not Found","message":"/","path":"/"}
curl http://127.0.0.1:8080
{"error":"Invalid session id"}
From @lamby:
settings.BASE_ADDRESS in commcare must match what you are accessing the site via in the browser. ie. you cannot have a config.vm.network "forwarded_port", guest: 8000, host: X in your Vagrantfile where X does not match the port mentioned in settings.BASE_ADDRESS in your localsettings. This is due to the commcare Javascript sending an Access-Control-Allow-Origin header of settings.BASE_ADDRESS which violates CORS https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS__ restrictions in modern browsers.
Be especially aware that changing the port of BASE_ADDRESS in localsettings.py does not actually work. I've yet to discover why but even after re-running the docker initialisation, whilst adding debugging statements to settings.py will happily print the modified value, if you then query settings.BASE_ADDRESS at runtime at all (eg. just dump some print in an already-existing middleware.) it prints an empty string (whut).
Therefore I currently suggest setting guest: 8000, host: 8000. This avoids having to change commcarehq.host=http://localhost:8000 to, say, commcarehq.host=http://localhost:2345 too.