Skip to content

unicef/etools-partner-reporting-portal

Repository files navigation

etools-partner-reporting-portal

Container build status

  • Polymer: Codefresh build status

  • PostGIS: Codefresh build status

  • Django API: Codefresh build status

  • Nginx proxy: Codefresh build status

macOS Setup

  1. Install Docker for Mac. Also install Fabric via pip install fabric==1.13.1
  2. Create .env file in repository root with the reference of .env.example or receive .env file from your team member.
  3. Run fab up !
  4. Go to http://127.0.0.1:8081/ to see the frontend / polymer running. The Django app is running under http://127.0.0.1:8082/api/
  5. As a separate terminal tab, run fab fixtures if this is first time running environment - load Site & ReportingEntity objects from fixture json files.
  6. As a separate terminal tab, run fab fake_data to generate fake data like account, core, partner and other modules. There is also fab real_data command as well.
  7. TEMP: Go to http://127.0.0.1:8081/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 to switch between the two interfaces.

Ubuntu 16.04 setup

  1. Install docker and docker-compose
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update -y
apt-cache policy docker-ce
sudo apt-get install -y docker-ce
sudo systemctl status docker
  1. Set ubuntu user to docker group
sudo usermod -aG docker ${USER}

# (Password will be prompt)
su - ${USER}
  1. Install pip and fabric 1.X
sudo apt-get install --assume-yes --reinstall ca-certificates
sudo apt-get install -y --no-install-recommends build-essential vim python-dev python-setuptools

sudo easy_install pip

sudo pip install --upgrade pip --trusted-host pypi.python.org
sudo pip install fabric==1.13.1 --trusted-host pypi.python.org

sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose
  1. Check docker-compose is installed
docker-compose --version
  1. Create .env file in repository root with the reference of .env.example or receive .env file from your team member.
  2. Run fab up !
  3. Go to http://127.0.0.1:8081/ to see the frontend / polymer running. The Django app is running under http://127.0.0.1:8082/api/
  4. As a separate terminal tab, run fab fixtures if this is first time running environment - load Site & ReportingEntity objects from fixture json files.
  5. As a separate terminal tab, run fab fake_data to generate fake data like account, core, partner and other modules. There is also fab real_data command as well.
  6. TEMP: 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 to switch between the two interfaces.

Development

Run migrations:

  • ssh into backend container and run the commands below (using docker exec cmd or Docker Dasboard)
  • python /code/manage.py makemigrations --merge --noinput
  • python /code/manage.py migrate

Here are some docker tips:

  1. display all containers:
$ docker-compose ps
  1. ssh into running django_api container
$ fab ssh:django_api
  1. Stop all containers
$ fab stop
  1. Re-build docker images for containers
$ fab rebuild