Skip to content

Latest commit

 

History

History
167 lines (108 loc) · 5.07 KB

README.md

File metadata and controls

167 lines (108 loc) · 5.07 KB

SIWINS

Build Status Repo Size Coverage Status Languages Issues Last Commit Documentation Status GitHub license

Development

1. Environment Setup

Instance

This app required a static config to seed and retreieve the data. So, first please provide the instance value like below environment setup (the instance name is "test"):

export SIWINS_INSTANCE="test"
Seed & Sync Auth

This app requires Akvo Flow API Authentication to provides correct credentials when seed or sync form and data points from Akvo FLOW.

Environment Setup:

export AUTH0_CLIENT="string"
export AUTH0_USER="string"
export AUTH0_PWD="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

To use the Mailjet Email API, you need to create a Mailjet account, then retrieve your API and Secret keys. They will be used for seed/sync notification purposes.

export MAILJET_SECRET="string"
export MAILJET_APIKEY="string"
export NOTIFICATION_RECIPIENTS="email1,email2"

2. Start the App

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

docker volume create --name=siwins-docker-sync
./dc.sh up -d

To stop:

./dc.sh down -t 1

Reset the app:

./dc.sh 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/
├── administration
│   └── fake-geolocations.csv
├── forms
│   └── forms.json
└── solomon-island-topojson.json
Initial Forms & Data Points seeder

Assuming that you have forms.json inside ./backend/source/ folder and have correct Environment setup you will be able to run.

  • Run form and fake data seeder
docker-compose exec backend ./fake_seed.sh
docker-compose exec backend ./seed.sh
Sync Data Points

To get updated data points from akvo-flow instance, you need to run (require Environment setup):

docker-compose exec backend ./sync.sh
Run Fake Data Points & History seeder

To seed fake data points, run command below:

docker-compose exec backend python -m seeder.fake_datapoint <number_of_data_points>

To seed fake history for data points, run command below:

docker-compose exec backend python -m seeder.fake_history

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/siwins 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:

Contact

For further information about the file formats please contact tech.consultancy@akvo.org