-
Notifications
You must be signed in to change notification settings - Fork 0
Tampere deployment
This chapter outlines Tampere specific requirements, challenges and instructions for the City Navigator.
Tampere public transport real time data is available soon at least in SIRI format. It is still somewhat unclear how this data can be utilized in the City Navigator.
While City of Helsinki has REST API for City of Helsinki Service Map (http://www.hel.fi/palvelukarttaws/rest/index_en.html) and it is utilized in City Navigator there is no currently similar API for Tampere. Part of the data can be added to OpenStreetMap but not all, for example, opening times for museums and shops.
Currently only public transport data from City of Tampere is available but it would be important to have access to data for neighbour municipalities. This will change at least for many of the municipalities in July 2014 when zones are taken into use in Tampere region. For more info of the change see the news article "Vyöhykerajat käyttöön seudun bussiliikenteessä 1.7.2014".
Linux Ubuntu is the recommended development platform although in principle it should be possible to do development on Windows. Assumptions are that you have knowledge on sudo, apt-get, etc. commands. If you are using virtual server on ITS Factory Data Platform, you probably have to use sudo with most of the following commands.
There is data disk /dev/vdc that needs to be mounted and used for storing most of the city-navigator specific data since if virtual server is changed only data on the /dev/vdc/ will be kept.
If /dev/vdc has not been partitioned it can be done with sudo fdisk /dev/vdc/
. Use the whole disk for the primary partition (defaults).
After partitioning run sudo mkfs.ext4 /dev/vdc1
and sudo mount /dev/vdc1 /mnt/data
. To mount
the partition automatically after reboot run sudo emacs /etc/fstab
and add line /dev/vdc1 /mnt/data auto defaults 0 0
to the end of the file.
If you want to get started quickly see https://github.com/codeforeurope/navigator-proto#getting-started. You may also consider Building Node from sources. If you build Node from sources, still follow the getting started instructions after the very first paragraph.
-
Get or create Tampere specific OpenStreetMap (OSM) data
Currently there is a package available for Tampere region at http://dev.hsl.fi/tmp/tampere/tampere.osm.bz2. However, the data should be updated occasionally. Instructions for this are here: OpenStreetMap data
On terminal change to directory where you want different parts (OpenStreetMap data, OpenTripPlanner, GTFS data, etc.) to be stored, then run:
mkdir OpenStreetMap
,cd OpenStreetMap
,wget http://dev.hsl.fi/tmp/tampere/tampere.osm.bz2
, andcd ..
-
Get the Tampere specific GTFS Data
The GTFS data resides in http://files.itsfactory.fi/google_transit.zip. GTFS data should be loaded dynamically in future, but currently you should just download the zip and store it for example to GTFS directory.
-
Get OpenTripPlanner (OTP) from GitHub
Run:
git clone git://github.com/openplans/OpenTripPlanner.git
-
Edit the graph-builder.xml file
You should modify
OpenTripPlanner/opentripplanner-integration/src/defaults/resources/graph-builder.xml
to include Tampere specific OSM and GTFS data.Currently you can replace the default
graph-builder.xml
file with the one from http://dev.hsl.fi/tmp/tampere/graph-builder.xml and edit the two locations where tampere is mentioned to correspond those in your server. -
Edit OpenTripPlanner/opentripplanner-integration/pom.xml -file
If Tomcat has been updated since the OpenTripPlanner.git was updated then you may need to change
<tomcat.version>
in pom.xml. See http://www.apache.org/dist/tomcat/tomcat-6/ for the available version.Also, look for
-Xmx
string in the pom.xml. You may need to increase memory to for example-Xmx2000m
. Change this in all places where-Xmx
string can be found in the pom.xml. -
Get maven and JDK
Run:
sudo apt-get install maven openjdk-6-jdk
You may have to run
sudo apt-get update
before the above installations are successful. -
Build OTP, calculate routing graph and start WWW service
You may do the above by running
mvn install integration-test -DskipTests -P interactive
. You can try to remove -DskipTests parameter but there was an error when this was tried in ITS Factory Data Platform on 13th of May, 2013. More info of using maven with OTP can be found from https://github.com/openplans/OpenTripPlanner/wiki/GettingStartedMaven/.If there is an error while running the
mvn install
or you want the routing graph to be calculated again, you may remove the fileOpenTripPlanner/opentripplanner-integration/target/graph-bundle/Graph.obj
. -
Trying out the OTP installation
If the previous step goes smoothly something similar to following info is printed to terminal:
[INFO] --- cargo-maven2-plugin:1.2.0:start (tomcat-execution) @ opentripplanner-integration --- [INFO] [INFO] --- cargo-maven2-plugin:1.2.0:run (tomcat-execution) @ opentripplanner-integration --- [INFO] Press Ctrl-C to stop the container...
Open the page http://x.y.z:8080/opentripplanner-webapp with you web browser where x.y.z is the name or IP address of your server. You should see:
.
-
Configuring City Navigator to use the OTP installation
Finally, you should modify the config.coffee in navigator-proto/src directory. Change the
otp_base_url
for tampere to matchhttp://x.y.z:8080/opentripplanner-api-webapp/ws/
. Also, at the end of the config.coffee file change area from manchester to tampere.Now, you can run the city navigator locally with
grunt server
and test that installation works by going tohttp://localhost:9001
. Remote testing requires setting up separate web server. For example ningx.
While OTP can be run with Tomcat via maven and city-navigator via grunt server, these are meant for development. Therefore, it is best to install tomcat as a service and include city-navigator under a web server, for example nginx. It is assumed that [Installation instructions](Tampere deployment#installation-instructions) have always been finished before the "Production Installation".
Note: ITS Factory virtual server keeps the tomcat and nginx installations only until shutdown because only data on /dev/vdc (mounted to /mnt/data) is kept at shutdown.
-
Install nginx
Follow instructions at http://wiki.nginx.org/Install#Ubuntu_PPA
-
Install Tomcat and OTP under Tomcat
Run following commands:
sudo apt-get install tomcat7 sudo cp /mnt/data/OpenTripPlanner/opentripplanner-integration/target/tomcat6x/container/webapps/opentripplanner-*.war /var/lib/tomcat7/webapps/ sudo mkdir /var/lib/tomcat7/opentripplanner-integration sudo mkdir /var/lib/tomcat7/opentripplanner-integration/target sudo mkdir /var/lib/tomcat7/opentripplanner-integration/target/graph-bundle sudo cp /mnt/data/OpenTripPlanner/opentripplanner-integration/target/graph-bundle/Graph.obj /var/lib/tomcat7/opentripplanner-integration/target/graph-bundle/
-
Edit nginx configuration
Run:
sudo emacs /etc/nginx/sites-available/default
and add following lines in the file under server:location ~ ^/(opentripplanner-webapp|opentripplanner-api-webapp) { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:8042; add_header Access-Control-Allow-Origin *; }
-
Edit Tomcat configuration
Run
sudo emacs /var/lib/tomcat7/conf/server.xml
and change Connector port to 8042 (Port should be equal to the one defined in the nginx location setting in the previous step). More instructions can be found at: http://www.mkyong.com/tomcat/how-to-change-tomcat-default-port/ -
Test Tomcat and OTP installation
At command line run
sudo /etc/init.d/tomcat7 restart
andsudo /usr/sbin/nginx
.Go to address http://178.217.134.18 with web browser to see that nginx is working. Go to address http://178.217.134.18/opentripplanner-webapp/ and look for a route to see that the OTP is working. If there is a problem you can take a look at the the end of the tomcat log file
/var/lib/tomcat7/logs/catalina.out
. Possible reason for the problems are related to memory (e.g. OutOfMemoryError). In this case runemacs /usr/share/tomcat7/bin/catalina.sh
, add lineCATALINA_OPTS="$CATALINA_OPTS -Xmx2000m"
to near top of the configuration file, and restart the Tomcat. -
Make navigator-proto visible via nginx
Run
sudo emacs /etc/nginx/sites-available/default
and change server root toroot /mnt/data/navigator-proto;
-
Configure city-navigator
Run
sudo emacs /mnt/data/navigator-proto/src/config.coffee
and change tampere otp_base_url tootp_base_url: "http://178.217.134.18/opentripplanner-api-webapp/ws/"
-
Finishing
Restart the nginx
sudo /usr/sbin/nginx -s reload
, go to address http://178.217.134.18 with a web browser and look for a route to see that city-navigator is working properly.
-
Merge changes in the upstream
Run:
cd /mnt/data/navigator-proto
,git fetch upstream
, andgit merge upstream/master
. If there are any conflicts, fix them as usual. -
Finishing
Run
grunt
and go to address http://178.217.134.18 with a web browser to see that city-navigator is working properly.
When schedules of the public transports change, for example, due to seasonal changes the GTFS data may need to be updated.
-
Get the updated GTFS data
Run:
cd /mnt/data/gtfs/static/
. You may want to make a backup of the old GTFS data file before runningwget http://www.tampere.fi/ekstrat/ptdata/tamperefeed.zip
andmv tamperefeed.zip google_transit.zip
. -
Build OTP with the new route graph
Run:
cd /mnt/data/OpenTripPlanner/
,rm /mnt/data/OpenTripPlanner/opentripplanner-integration/target/graph-bundle/Graph.obj
, andmvn install integration-test -DskipTests -P interactive
. -
Update the Tomcat OTP installation
Run:
cp /mnt/data/OpenTripPlanner/opentripplanner-integration/target/tomcat6x/container/webapps/opentripplanner-*.war /var/lib/tomcat7/webapps/
andcp /mnt/data/OpenTripPlanner/opentripplanner-integration/target/graph-bundle/Graph.obj /var/lib/tomcat7/opentripplanner-integration/target/graph-bundle/
. -
Finishing
Restart the Tomcat with
/etc/init.d/tomcat7 restart
and go to the address http://178.217.134.18 with web browser and look for a route to see that city-navigator is working.