Development Setup
Local Setup
Install Docker for your OS. Also install Fabric via
pip install fabricCreate .env file with the reference of
.env.exampleor receive .env file from your team member.Run
fab upGo to http://127.0.0.1:8082/ to see the frontend / polymer running. The Django app is running under http://127.0.0.1:8082/api/. ID management will be running at http://127.0.0.1:8082/id-management/.
Run
fab fixturesIt loads fake data like account, core, partner and other modules!
Once fixtures are loaded, the Celery Periodic Tasks will be shown at Django Admin -> djcelery -> Periodic Tasks. Once the tasks are enabled, they will be scheduled to run automatically.
If you'd like to get PMP data going now, run
fab ssh:django_apiand run./manage.py shell_plus. Then import some celery task functions.from core.tasks import *from partner.tasks import *process_workspaces()process_partners()We would import programme documents later on.
Go to Django Admin -> Core -> Carto db tables. Add new record for each CartoDB dataset to import. Start from admin level 0 to N and import site one by one per country. Please see CartoDB location sync section for more info.
Once the locations are imported, now you can run Programme Document sync from PMP. Run
fab ssh:django_apiand run./manage.py shell_plus. Then import some celery task functions.from unicef.tasks import *process_programme_documents(True, <BUSINESS_AREA_CODE>)
Run
fab ssh:django_apiand run./manage.py shell_plusto create some superusers. Make sure you use.set_password()method to set the password and save the user.Make sure you create a User with username
default_unicef_userfor PMP integration.
After creating some users, go to Django Admin -> Core -> Prp roles. Create new Prp role per user to give ID management access on IP reporting and cluster reporting.
Go to http://127.0.0.1:8082/api/admin/ login with admin/Passw0rd! and can now go to
http://127.0.0.1:8082/app/ to see the frontend interface. Replace 'ip-reporting' or 'cluster-reporting' in the URL's or use UI switcher to switch between the two interfaces.
K8s remote environment setup
Make sure all K8s deployment and services are running. Ingress controller should be set up to handle L7 routes to Django backend, Polymer, and React deployment.
Polymer and React deployment should be using bundle command and serve it with express http server.
Make sure Ingress controller is running HTTPS annotation.
Configure Frontend and backend deployments with environment variables for API credentials, connection info, and etc.
Make sure Ingress Controller to handle routing for
/,/api, and/id-managementcorrectly. Especially for/id-management, Ingress controller needs to make sure that the routing forid-managementis taken byid-managementdeployment.Go to Django backend pod's SSH shell. Run to load fixtures.
./manage.py loaddata sites./manage.py loaddata reporting_entities./manage.py loaddata periodic_tasksIt loads fake data like account, core, partner and other modules!
Once fixtures are loaded, the Celery Periodic Tasks will be shown at Django Admin -> djcelery -> Periodic Tasks. Once the tasks are enabled, they will be scheduled to run automatically.
If you'd like to get PMP data going now, go to Django backend pod's SSH shell. Run
./manage.py shell_plus. Then import some celery task functions.from core.tasks import *from partner.tasks import *process_workspaces()process_partners()We would import programme documents later on.
Go to Django Admin -> Core -> Carto db tables. Add new record for each CartoDB dataset to import. Start from admin level 0 to N and import site one by one per country. Please see CartoDB location sync section for more info.
Once the locations are imported, now you can run Programme Document sync from PMP. Go to Django backend pod's SSH shell. Run
./manage.py shell_plus. Then import some celery task functions.from unicef.tasks import *process_programme_documents(True, <BUSINESS_AREA_CODE>)
Go to Django backend pod's SSH shell. Run
./manage.py shell_plusto create some superusers. Make sure you use.set_password()method to set the password and save the user.Make sure you create a User with username
default_unicef_userfor PMP integration.
After creating some users, go to Django Admin -> Core -> Prp roles. Create new Prp role per user to give ID management access on IP reporting and cluster reporting.
Helpful Commands
Here are some docker tips:
display all containers:
$ docker-compose psssh into running django_api container
$ fab ssh:django_apiRestart just one container
$ fab restart:django_apiStop all containers by kill signal
$ fab killRe-build docker images for containers
$ fab rebuildLast updated