Dristhi Developer Machine Setup
Note: This document is work in progress, please update this based on your setup experience
For Mac OS X 10.9.2 and later, make sure that Homebrew is installed, and use brew install [pkg]
. To install a specific version of the [pkg], use brew install [pkg] --version[version]
For Ubuntu/Debian use sudo apt-get install [pkg]
For Red Hat/Fedora/CentOS use sudo yum install [pkg]
Tools and Frameworks Setup
- Apache Maven
- Install Apache Maven 3.0 using an appropriate package manager with package name
homebrew/versions/maven30
. We have had issues with newer versions of maven, so it is advisable to install 3.0 - Create/Update settings.xml file1 at <maven directory> (<user_home_directory>/.m2 on Mac OS X)
- Increase maven permgen size by creating an environment variable called MAVEN_OPTS with value “-XX:MaxPermSize=256m -Xmx512m”. On Mac OS X this can be done by adding
export MAVEN_OPTS="-XX:MaxPermSize=256m -Xmx512m"
to bash_rc or bash_profile
- Install Apache Maven 3.0 using an appropriate package manager with package name
- Android SDK
- Download and install Android SDK. Alternatively you can install it using appropriate package manager with package name
android-sdk
- Launch Android SDK Manager by using android command. Install the below mentioned components
- Tools –> Android SDK Tools
- Tools –> Android SDK Platform Tools
- Android 4.1.2 (API 16) –> SDK Platform
- Android 4.1.2 (API 16) –> ARM EABI v7a System Image
- Create an environment variable ANDROID_HOME pointing to the SDK root path
- Download and install Android SDK. Alternatively you can install it using appropriate package manager with package name
- JDK Setup
- Install JDK 1.6 and 1.7 from Oracle website
- Create an environment variable JAVA_HOME which points to home directory of JDK 1.7. On Mac OS X, this may be located at /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home. But we have found the path to vary across machines, so please find the location for your machine and use that
- Node modules setup. Note: Some of these commands may require sudo permissions.
- Install NodeJS using an appropriate package manager with package name
node
and version0.10.17
- Install npm using an appropriate package manager with package name
npm
and version1.3.8
- Install PhantomJS using
npm install -g phantomjs@1.9.8
- Install Karma using
npm install -g karma@0.12.31
- Install Handlebars using
npm install -g handlebars@1.0.12
- Install Grunt Command Line Tool using
npm install grunt-cli@0.1.9
- Install CORS Proxy using
npm install corsproxy@0.2.14
- Install NodeJS using an appropriate package manager with package name
- Install ActiveMQ using an appropriate package manager with package name
activemq
and version5.7.0
- ActiveMQ needs to be started for Dristhi server to build, so follow the instructions at the end of the installation to start it the way you prefer
- ActiveMQ by default has only 1MB memory limit. This is usually not sufficient. Increase ActiveMQ memory by updating ActiveMQ configuration2. ActiveMQ configuration can be found at <activemq_install_location>/conf/activemq.xml
- Install PostgreSQL using an appropriate package manager with package name
postgresql
and version9.2.1
- PostgreSQL needs to be started for Dristhi server to build, so follow the instructions at the end of the installation to start it the way you prefer
- Create a user called ‘postgres’ by using
createuser -P postgres
. Set the password as ‘password’. This is required for building server - Login to database using
psql -U postgres
. Create a database called ‘drishti’ usingCREATE DATABASE drishti
- Install CouchDB using an appropriate package manager with package name
couchdb
and version1.2.0
- Install Git using an appropriate package manager with package name
git
Dristhi Server Build
- Clone Dristhi Server git repository from https://github.com/SEL-Columbia/dristhi using
git clone https://github.com/SEL-Columbia/dristhi
- Run
mvn clean install
from the root directory of Dristhi Server - To run server locally run
- Run
mvn clean install
from the root directory of Dristhi Server - Navigate to <server_root>/drishti-reporting directory and run
mvn jetty:run
- Navigate to <server_root>/drishti-web directory and run
mvn jetty:run
- This can be simplified by creating an alias,
alias web='(cd <server_root>; cd drishti-reporting && mvn jetty:run &; cd ../drishti-web && mvn jetty:run)'
- Run
Dristhi App Build
Note: Dristhi App build depends on Server build, so please complete that before building app
- Clone Dristhi app git repository from https://github.com/SEL-Columbia/drishti-app using
git clone https://github.com/SEL-Columbia/drishti-app
- Android Emulator
- Default Emulator: Create, for the first time, and start an Android Virtual Device by using
android avd
with API level 16 and screen resolution 1024 X 600 - Genymotion: Alternatively, you can also install Genymotion Android Emulator which is much faster than the default Android emulator.
- Install Genymotion emulator
- Install Virtual Box
- Follow ARM Translation instructions to get Dristhi app working on Genymotion
- Start Genymotion emulator and create a Virtual device with API level 16 and screen resolution 1024 X 600
- Default Emulator: Create, for the first time, and start an Android Virtual Device by using
- Run
mvn clean install
from the root directory of Dristhi app
Dristhi Dashboard Build
- Clone Dristhi Dashboard git repository from https://github.com/SEL-Columbia/drishti-site using
git clone https://github.com/SEL-Columbia/drishti-site
- Run
npm install
- Run
bower install
- Run
grunt
. This will build the code (jshint verification, unit tests, concatenation, minification, etc) and generate runnable web app indist
directory - To run dashboard locally
- Run Dristhi Server locally by following the steps mentioned above
- In <dashboard_root>/app/scripts/app.js comment the section of constants that have prod URLs (https://smartregistries.org) and uncomment the section which has local URLs (http://localhost:9292/localhost:9980)
- Run
corsproxy
- Run
grunt server
from <dashboard_root>
Troubleshooting
The Genymotion virtual device could not obtain an IP address.
Make sure that a host only network is configured on your virtual box with DHCP server enabled. To ensure this, go to the virtual box’s preferences. On the network tab, go to the ‘Host-only networks’ tab and create a host only network if it does not exist. If it does, edit this network and go to the DHCP Server tab and check the “Enable server” checkbox. Provide all the necessary fields here. Now restart the genymotion virtual device.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
1 2 |
|