Important Tips:
1. Make sure do not use 'localhost' but real ip address instead. Refer to 'Configuring remote access for couchdb' to enable open access to CouchDB
Step One: Set-up CouchDB
========================================================
1. Visit http://couchdb.apache.org/ and download CouchDB
2. Install CouchDB and choose CouchDB as a service
Note that:
---------------------------------------
a. To start CouchDB in a "console" environment, execute couchdb.bat in the 'bin' directory. A shortcut to this batch file should have been installed. Don't try and start couchdb this way if the service is running - it will fail.
b. The installer offers to install CouchDB as a Windows Service. If you select this option, the service will run as the "LocalSystem" user and be configured to start automatically. You can configure the service properties via the Windows 'Services' applet.
---------------------------------------
3. Visit http://'ip':5984/_utils/ and we will see the CouchDB console, where we can add/drop databases, insert/remove/update documents, and check CouchDB documentations.
4. Create databases and insert data: unzip CouchDB_Database.zip, and copy the files into %Program%\Apache Software Foundation\CouchDB\var\lib\couchdb\ . First stop and then start CouchDB service may be needed.
5. Refer to 'Configuring remote access for CouchDB' to enable open access to CouchDB
========================================================
Step Two: Set-up Tomcat HTTP server
========================================================
1. Visit http://tomcat.apache.org/ and download a proper version of Tomcat
2. Configure Java environment for Tomcat
Note that
------------------------------------
a. Tomcat does not need a JDK to run, it will work just fine with a JRE, as long as it knows it's a JRE.
b. Download and install a JRE if necessary
c1. Open command prompt, type in
set JAVA_HOME = C:\Program Files\Java\jdk1.7.0_75[Location of your JDK Installation Directory]
or
c2. Right click on the My Computer icon on your desktop and select properties
Click the Advanced Tab
Click the Environment Variables button
Under System Variable, click New
Enter the variable name as JAVA_HOME
Enter the variable value as the install path "C:\Program Files\Java\jdk1.6.0_06"
Click OK
Click Apply Changes
Restart the computer to make sure the changes are reflected.
d. Input
echo %JAVA_HOME%
to check if the environment variable has been set successfully
------------------------------------
3. Run
%\apache-tomcat-7.0.57\bin>startup.bat
to start Tomcat server
4. Visit http://'ip':8080/ to check if Tomcat has run successfully
5. Update file $TOMCAT_HOME/conf/tomcat-users.xml
-------------------------------------
-------------------------------------
to add an administrator (admin/admin) to manage deployed services
========================================================
Step Three: Compile server code and deploy FuelPriceShareServer
========================================================
1. Open FuelPriceShareServer project with Eclipse_j2ee (download one if necessary)
2. Right click project -> Export -> Web . WAR file and then next
3. Choose a proper version of Tomcat runtime
4. Visit http://'ip':8080/manager/html (with the previously added role: admin/amdin)
5. Use "WAR file to deploy", and select the exported WAR file and Deploy
6. Run a testing query to check everything is in order
http://'ip':8080/FuelPriceShareServer/RangeQueryServlet?lat=-37.842716&lng=144.883618&r_dist=10
========================================================
Step Four: Compile mobile code and deploy FuelPriceShareServer
========================================================
1. Open the Android project with Android Studio
2. Use SDK manager to update necessary SDK packages
3. Check the build.gradle file, and change it properly to successfully build the project
4. If use an emulator, choose the proper API levels, and make sure that 'Target' is chosen to be Google APIs (Google Inc.) with proper API levels, otherwise Google Play Services will not be enabled
5. Run the app
========================================================