MAPNUS aims to provide students with a One Stop Guide around NUS with better visualization and information.
- Convenient & Knowledgable
- Lightweight
- Effective & Efficient
MAPNUS is a lightweight map based application designed specifically for the National University of Singapore that empower students by facilitating a wide range of features to find locations around NUS more effective & efficiently.
0.5
MAPNUS uses a number of open source projects & technologies to work properly:
- Atom - a hackable text editor for the 21st Century
- IntelliJ IDEA - work miracles on Java and beyond
- Twitter Bootstrap - great UI boilerplate for modern web apps
- Leaflet.js - a customized leaflet map plugin
- Scala - mapnus api web service that sits as an interface between web presentation and database
- Ruby - automated script to process data into database
- Redis Database - advanced key-value store
- Apache Tomcat - server pages technologies
- Bitnami - one click application stack for easy deployment anywhere
- Microsoft Windows Azure - awesome cloud hosting platform
- jQuery
- html5
All services are hosted on Microsoft Windows Azure Platform.
Webfront : MAPNUS Web is hosted on 'Microsoft Windows Azure Websites' deployed from GitHub.
Service : MAPNUS API Web Service is the service backbone architecture of the system.
MAPNUS API Web Service is written in Scala
and is hosted on Microsoft Windows Azure - Virtual Machines running on Apache Tomcat
.
Database : MAPNUS stores and retrieves information from Redis DB
and is hosted on Microsoft Windows Azure - Virtual Machines.
Webfront scales up to 4
instances if the CPU metrics meets a certain threshold.
Database is configured with master & slave
configuration on 2
Virtual Machines.
Sharding allows data replication across the database servers. Should any database fail at any one point, there is a secondary database to support the system.
-
Deploying Redis DB on Windows Azure - Virtual Machine
To create a new Virtual Machine, use the 'New' menu at the bottom left of the portal, select
Virtual Machine
>From Gallery
.
-
Choose an Image
Following which, the Virtual Machine Wizard will open, displaying a number of base Operating System options to choose from.
Select
CentOS-Based
>OpenLogic
distribution and click 'next' to continue.
This screen allows us to start configuring our Virtual Machine:
- Virtual Machine Name
- Tier and Size of Computing Power
- New User Name
- Authentication, either SSH Key for authentication or password.
Opting to upload SSH Key for authentication will automatically install the SSH Key onto the user account, providing the ability to connect via SSH configured with the corresponding private key
- Virtual Machine Configuration
The next screen configures the cloud service
- Define your 'Cloud Service DNS Name',
<cloud_service_dns_name>.cloudapp.net
- Region (eg. Southeast Asia)
- Storage Account where the VHD image will be saved to
- Availability Set configures
'N'
Virtual Machines to the set for the following reasons:99.95% SLA
High availability
Load Balancing
- Endpoints configuration to expose Redis DB ports to public
- Define your 'Cloud Service DNS Name',
- Ready, Set, Go! Finally, the last step will validate the settings and start your virtual machine.
The following configurations can be customized for any types of application deployments.
- SSH into Virtual Machine
Login into the Virtual Machine
mapnus:~ localuser$ ssh [email protected]
[email protected]'s password:
Once you have successfully SSH into your Virtual Machine, run the following commands
[azureuser@redisdbsg ~]$ uname -a
Linux redisdbsg 2.6.32-431.17.1.el6.x86_64 #1 SMP Wed May 7 23:32:49 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[azureuser@redisdbsg ~]$ echo "Hello Azure" > /dev/null
[azureuser@redisdbsg ~]$
- Install Development Tools
- First start by installing development tools
sudo yum groupinstall "Development tools"
sudo
command will require you to enter a password. Enter the password you created for the user account- Now, let's download, compile and install Redis
[azureuser@redisdbsg ~]$ sudo yum groupinstall "Development tools"
[azureuser@redisdbsg ~]$ wget http://download.redis.io/releases/redis-2.8.13.tar.gz
[azureuser@redisdbsg ~]$ tar xzf redis-2.8.13.tar.gz
[azureuser@redisdbsg ~]$ cd redis-2.8.13
[azureuser@redisdbsg redis-2.8.13]$ make
[azureuser@redisdbsg redis-2.8.13]$ sudo make install
- Run Redis Database with Configuration file
[azureuser@redisdbsg]$ sudo /usr/local/bin/redis-server redisconf/redisdb.conf
(For Advanced Users)
Apache Tomcat on Windows Azure is a customized stack provided by Bitnami. Using the same procedure, create a new Virtual Machine for hosting Tomcat.
Bitnami stack comes with Apache Tomcat pre-installed into the Virtual Machine. There are lesser installations to be done here.
In this example, we will use bitnami-tomcat
- SSH into Virtual Machine
Login into Virtual Machine
mapnus:~ localuser$ ssh [email protected]
[email protected]'s password:
Once you have logged in, you will see the following screen, let's setup our Tomcat server.
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-32-generic x86_64)
___ _ _ _
| _ |_) |_ _ _ __ _ _ __ (_)
| _ \ | _| ' \/ _` | ' \| |
|___/_|\__|_|_|\__,_|_|_|_|_|
*** Welcome to the Bitnami Tomcat 7.0.55-0 ***
*** Bitnami Wiki: http://wiki.bitnami.com/ ***
*** Bitnami Forums: http://community.bitnami.com/ ***
[azureuser@bitnami-tomcat]$ cd stack/apache-tomcat/conf
azureuser@bitnami-tomcat:~/stack/apache-tomcat/conf$
- Configure the ports that would be mapped to Endpoints to be exposed
- Uncomment the following line to enable Tomcat Server port to be accessible on the web
- Save and quit
nano
- Go to Windows Azure Portal and map the port as the following
azureuser@bitnami-tomcat:~/stack/apache-tomcat/conf$ sudo nano server.xml
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" URIEncoding="UTF-8" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/>
azureuser@bitnami-tomcat:~/stack/apache-tomcat/conf$
- Change the default username & password for security reasons
azureuser@bitnami-tomcat:~/stack/apache-tomcat/conf$ sudo nano tomcat-users.xml
<user username="azureuser" password="my_very_secure_password" roles="manager-gui,admin-gui"/>
</tomcat-users>
azureuser@bitnami-tomcat:~/stack/apache-tomcat/conf$
- Ensure that Tomcat Server is running
sudo ./ctlscript.sh (start|stop|restart|status) apache
sudo ./ctlscript.sh (start|stop|restart|status) mysql
sudo ./ctlscript.sh (start|stop|restart|status) tomcat
- To stop all running services
sudo ./ctlscript.sh stop
azureuser@bitnami-tomcat:~/stack$ sudo ./ctlscript.sh start tomcat
tomcat already running
azureuser@bitnami-tomcat:~/stack$
- Let's deploy our Scala war file.
- Upload WAR file to the Virtual Machine
- Open your web browser to http://bitnami-tomcat.cloudapp.net/manager/html
- Enter your Tomcat Credentials you set earlier
- Select Deploy directory or WAR file located on server
- Configure the following settings and set the path to
root '/'
- Configure the following settings and set the path to
Once it's deployed, you can validate it by accessing it from the public url
Open your web browser to http://bitnami-tomcat.cloudapp.net to test if it's running!
- Package Scala project into WAR file
- Change to your project directory
- WAR file is located in your project directory under
'target/scala-X.XX'
mapnus:~ localuser$ cd TomcatApp
mapnus:TomcatApp localuser$
mapnus:TomcatApp localuser$ sbt clean compile
mapnus:TomcatApp localuser$ sbt package
mapnus:TomcatApp localuser$ cd target/scala-2.10
mapnus:scala-2.10 localuser$
automate_db.rb
: runs text data, crunch the data and push to database- Change to our Ruby DB directory
- Run the following command and output our results to
json.out
file
mapnus:~ localuser$ cd db
mapnus:db localuser$ ruby automated_db.rb > json.out
MIT.
Copyright (c) 2014 Kenneth Ham & Jireh Tan.