Skip to content
Deden Bangkit edited this page Dec 15, 2021 · 5 revisions

WAI SDG Portal

Build Status Repo Size Languages Issues Last Commit

Development

1. Environment Setup

Auth Service

This app requires Auth0 to provides Single sign-on (SSO) that allow users to log in with single ID and password such as Gmail or other variety of available providers, and a diverse set of user-friendly tools the developer will really like.

Environment Setup:

export AUTH0_DOMAIN="string_url"
export AUTH0_CLIENT_ID="string"
export AUTH0_SECRET="string"
export AUTH0_AUDIENCE="string"
Storage Service

When running the test, any upload and download activities will not uploaded directly as Storage object (offered by Google Cloud). It stored inside ./backend/tmp/fake-storage

Environment Setup:

export GOOGLE_APPLICATION_CREDENTIALS=path_to_service_account.json
Email Service

Environment Setup:

export MAILJET_SECRET="string"
export MAILJET_APIKEY="string"

2. Start the App

Now you have all the required environment ready, then run the App using:

export INSTANCE_NAME=<project-name>
docker-compose up -d

To stop:

docker-compose down

Reset the app:

docker-compose down -v

The app should be running at: localhost:3000. Any endpoints with prefix

see: setupProxy.js

3. Database Seeder

Before you seed the baseline data, please make sure that you have all the required file in the following structure:

Folder Path: /backend/source/

/backend/source.
└── project-name
    ├── config.js
    ├── config.min.js
    ├── data
    │   └── organisation.csv
    ├── forms
    │   ├── 01-clts.json
    │   ├── 02-health.json
    │   ├── 03-hh.json
    │   ├── 04-school.json
    │   └── 05-wp.json
    └── topojson.js

Note that project-name should be same as INSTANCE_NAME that you exported

Administration Level Seeder

Assuming that you have topojson.js inside ./backend/source/{project_name} folder you will be able to run.

docker-compose exec backend python -m seeder.administration
Organisation Seeder

To seed organisation, you need to have organisation.csv inside ./backend/source/{project_name}/data folder you will be able to run.

docker-compose exec backend python -m seeder.organisation
Add Super Admin

Note you wont be able to use some of the backend API if you haven't confirmed your email address with Auth0 tenant which you will received once your account is registered. You also have to perform Administration and Organisation Seeder first

docker-compose exec backend python -m seeder.admin [email protected] "Your Name" Akvo
Seed Random User
docker-compose exec backend python -m seeder.user <number_of_user> Akvo
Form Seeder

Assuming that you have id-form_name.json inside ./backend/source/{project_name}/forms/ folder you should be able to run.

docker-compose exec backend python -m seeder.form
Datapoint Seeder

Assuming that you have baseline.xlsx inside ./backend/source folder you should be able to run.

docker-compose exec backend python -m seeder.datapoint [email protected]
Run all the seeder in one command

If you wish to run all the necessary seeder, you could also run

docker-compose exec backend ./seed.sh [email protected] "Your Name" Akvo

Running Test

docker-compose exec backend ./test.sh

Production

export CI_COMMIT='local'
./ci/build.sh

This will generate two docker images with prefix eu.gcr.io/akvo-lumen/wai-sdg-portal for backend and frontend

docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d

Then visit: localhost:8080. Any endpoints with prefix

see:

Test Instances

Website Ethiopia Website Uganda Website Nepal Website Bangladesh

Contact

For further information about the file formats please contact [email protected]