Skip to content

Deployment

Irwan Fathurrahman edited this page Jul 21, 2017 · 8 revisions

Docker installation

Install docker

This will install an osm-reporter container and then run the application with the source code from flask_project mounted into the osm-reporter container.

Makes sure to have docker-compose installed

sudo apt-get install python-pip
sudo pip install docker-compose

Get project code

Clone the repo:

git clone git@github.com:hotosm/field-campaigner.git

Preparing data

Clone the data repo:

git clone https://github.com/hotosm/field-campaigner-data.git

Run project

Run the docker container:

cd field-campaigner
cd deployment
make build
make run

when make run, it will ask data folder to be used. Please input path of folder data that we cloned before (see this) and wait the deployment

then you can visit http://0.0.0.0:64000

Field campaigner data post setup

Field campaigner will make commit and push automatically for everytimes campaign is saved. But, we need to do a couple of things.

1. Do `docker exec -it osmreporter_web /bin/bash`
2. `cd ~/.ssh`
3. `cat id_rsa.pub`
4. copy the result
5. Go to https://github.com/hotosm/field-campaigner-data/settings/keys
6. Add key, create title and paste ssh result key
7. Don't forget to check `Allow write access`

and data is ready to go to commit/push automatically

Manual Install For Development

Clone the repo:

git clone git@github.com:hotosm/field-campaigner.git

Clone the data repo:

git clone https://github.com/hotosm/field-campaigner-data.git

Then setup a venv:

cd field-campaigner
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
export DATA_FOLDER=<path folder data repo that we cloned before>

Now run it:

python runserver.py

And then visit http://127.0.0.1:5000/

After Install

You will need to register apps in the http://openstreetmap.org/ to get the secret and consumer key.

Getting Keys

Register a new OAuth application on openstreetmap.org:

Go to your user page
Click 'my settings'
Click 'oauth settings'
At the bottom, 'Register your application'
Fill in the form & submit
Copy & Paste the secret & consumer key

Put the secret and consumer key to secret.py located in field-campaigner/flask_project/secret.py as below:

OAUTH_SECRET = '9f95RUKTXS5n9tDRjmrY8rzCYAztVd6yGjQrnX7S'
OAUTH_CONSUMER_KEY = '8rxeThT7aWhL7bCUH8k33M51V2u9PwSm8hAXxOVa'