OpenMapKit Server is a NodeJS service, so you'll need NodeJS version 4.x.
Install dependencies:
sudo apt-get install default-jre-headless
sudo apt-get install build-essential python-pip git
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install nodejs
The ODK pyxform component requires python dependencies that are installed via pip. The best way to install pip on a Mac is through Homebrew:
brew install python
Make sure you have installed Java. pyxform
has a Java dependency (JavaRosa). Full instructions on Stack Overflow.
brew cask install java
Also make sure you have installed NodeJS and git.
Install project dependencies.
git submodule init
git submodule update
sudo pip install -r requirements.txt
npm install
npm start
If npm start
is failing, run npm start --verbose
to see detailed log execution.
You might encounter Error: Could not locate the bindings file
. Run npm install libxmljs
to fix this.
By default the authentication is enabled in OpenMapKitServer. You can disable it,
by setting the environment variable DISABLE_AUTH
as 1
or as true
.
export DISABLE_AUTH=1
To start the server in the development mode, use npm startdev
, it will make the React App restart each time the frontend code is updated.
The frontend builds are ignored by the master
branch git and available on the dist
branch. To make a new build and push it to the dist
branch, use npm pushbuild
If you want to enable AWS S3 sync, in a way to have a backup of forms and submissions files in a S3 bucket, set the following environment variables:
export ENABLES3SYNC=1
export AWSKEYID=<your AWS access key ID>
export AWSSECRETKEY=<your AWS secret access key>
export AWSBUCKETNAME=<a S3 bucket name>
export AWSBUCKETPREFIX=<(optional, bucket root is the default prefix) subdirectory where the files should be stored in the S3 bucket>
This will make the data be syncronized to your S3 bucket after each API request that modifies the data. The first variable enables/disables the S3 sync and need to receive the value 1 or 0.
If you need to get the data stored in a S3 Bucket to put it in your server,
execute: npm get_from_s3
.
To assure that the files were synced to AWS before turning off a server, execute
npm send_to_s3
We are using node version 4.*. If you are having problems with another version, use node version manager.
nvm install
nvm use