Cross cutting contacts service for UNICEF Uganda. Currently used for th UNICEF End User Monitoring Tool
- Install MongoDB
- Run
mongod
in terminal (You likely have to change write permissions on /data/db folder to allow it to generate lock files) - [Optional] Install Node Version Manager
- Install Node.js - this should also make the Node Package Manager (npm) available
- Run the following commands:
npm install
- installs the node package dependenciesnpm test
- runs the tests (as well as ensures mongod is running)npm start
- runs the node server
The api runs on port 8005 by deault or on the port designated when starting the service Accessing the api root on localhost would be http://localhost:8005/api
Viewing all contacts uses the endpoint http://localhost:8005/api/contacts
#Deployment
Note: Use Ubuntu 14.04 Operating System
-
Add your public key to ~/.ssh/authorized_keys on the host server if you have not done this already
-
Install chef version 11.8.2
$ apt-get install chef
-
Run the installation script for contacts
$ ./scripts/staging.sh <PRIVATE_KEY> <USER> <HOST_ADDRESS> # Example $ ./scripts/staging.sh ~/.ssh/id_rsa eums 190.34.56.23
-
Import in initial contacts
-
There is no automated way to do this at the moment. Our suggestion would be to use a CSV file containing the contacts and then use the mongoimport utility to import them into the database.
-
CSV file format:
- First row is the header row with:
firstName, lastName, phone
- The remaining rows would be populated with actual contact data (e.g.
John, Smith, +256777888999
)
- First row is the header row with:
-
Run the following command:
mongoimport -d unicefcontacts -c contacts --type csv --file contacts.csv --headerline
-