Skip to content
carabalb edited this page May 14, 2014 · 17 revisions

(This page still in progress)

Prerequisites:

  • git
  • a username on github
  • java JDK
  • maven 3 (maven 2 won't work!)
  • tomcat6
  • postgresql or mysql
  • zeromq libraries

Here are some detailed instructions on Installing Project Dependencies.

Profiles

There are several different deployment styles, as represented in Maven profiles. What you choose is largely based on on the component you are working on. "local-multi-port" works for all components so is the default recommended. If you only plan to work on the Front-end however, stick with the "local-front-end" profile. These have been tested on Ubuntu, but work on OSX as well.

  • local-front-end: run the front-end locally off of the TDF in the dev environment. This profile isn't applicable to other modules. Use this when you are only concerned with the HTML front end. (Essentially you plug your local HTML front end into a live OBA in the development environment)
  • local-single-port: run the front-end/API/TDF on 8080, and optionally hook up the archiver as well. In either case, the modules listen to the dev queue. Use this when you only want to run the Front-end or the Inference engine, but not both. (You run OBA yourself, and subscribe to data from the development environment)
  • local-ie: run the front-end off of a local VTW, all on port 8080. (This is for IE development, and can be used to test bundles locally)
  • local-multi-port: run each module on a separate port and hence separate process. (Preferred method cause it just works)

You can run this directly on the command line using Maven, or use the Maven Build run configurations in Eclipse to run it there, for example if you need to debug.

Run Via Eclipse

Assuming you have Tomcat support in Eclipse, this is the easiest option for new users. These examples assume you have created the databases listed in Installing Project Dependencies

Run the front-end only

Right click on onebusaway-nyc-acta-webapp and go Properties->Maven and add local-front-end,eclipse-only in Active Maven Profile text and click OK.

Update your configuration via Servers/Tomcat v6.0 Server at localhost-config/context.xml

  <WatchedResource>WEB-INF/web.xml</WatchedResource>
       <Resource name="jdbc/appDB"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="10000"
    username="root"
    password="changeme"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/onebusaway_nyc" />

Next Right click on onebusaway-nyc-acta-webapp and go Run As->Run on Server

Go http://localhost:8080/onebusaway-nyc-acta-webapp

Run the front-end and Transit Data Service (TDS)

Update your configuration via Servers/Tomcat v6.0 Server at localhost-config/context.xml

  <WatchedResource>WEB-INF/web.xml</WatchedResource>
       <Resource name="jdbc/appDB"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="10000"
    username="root"
    password="changeme"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/onebusaway_nyc" />

Right-click on onebusaway-nyc-transit-data-federation-webapp, Go Properties->Maven and specify "local-single-port" as the profile

Right-click on onebusaway-nyc-transit-data-federation-webapp, and go Run As->Run on Server

Ensure http://localhost:8080/onebusaway-nyc-transit-data-federation-webapp/ renders "onebusaway-nyc-transit-data-federation-webapp" Don't continue until it does.

Right-click on onebusaway-nyc-api-webapp, Go Properties->Maven and specify "local-single-port" as the profile

Right-click on onebusaway-nyc-api-webapp, and go Run As->Run on Server

Ensure http://localhost:8080/onebusaway-nyc-api-webapp/ renders "onebusaway-nyc-api-webapp" Don't continue until it does.

Right-click on onebusaway-nyc-webapp, Go Properties->Maven and specify "local-single-port" as the profile. Note, do not deploy this webapp, deploy the overlay below

Right-click on onebusaway-nyc-acta-webapp, Go Properties->Maven and specify "local-single-port,eclipse-only" as the profile.

Right-click on onebusaway-nyc-acta-webapp, and go Run As->Run on Server

Go http://localhost:8080/onebusaway-nyc-acta-webapp

Run the front-end and IE

Update your configuration via Servers/Tomcat v6.0 Server at localhost-config/context.xml

  <WatchedResource>WEB-INF/web.xml</WatchedResource>
       <Resource name="jdbc/appDB"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="10000"
    username="root"
    password="changeme"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/onebusaway_nyc" />

Right-click on onebusaway-nyc-vehicle-tracking-webapp, Go Properties->Maven and specify "local-single-port,depots-one" as the profile

Right-click on onebusaway-nyc-vehicle-track-webapp, and go Run As->Run on Server

Right-click on onebusaway-nyc-webapp, Go Properties->Maven and specify "local-single-port" as the profile. Note, do not deploy this webapp, deploy the overlay below

Right-click on onebusaway-nyc-acta-webapp, Go Properties->Maven and specify "local-single-port" as the profile.

Right-click on onebusaway-nyc-acta-webapp, and go Run As->Run on Server

The depots-one profile has selected a single small depot so as to not overwhelm the CPU. As such, only a fraction of routes and buses will be available.

Go http://localhost:8080/onebusaway-nyc-acta-webapp

Run via the Command Line

This example uses the profile local-front-end (For front end only, uses TDF in dev environment). These examples assume you have created the databases listed in Installing Project Dependencies

Novice users will want to skip this step as using Eclipse is much simpler! This step describes running the application using Tomcat.

Run the front-end only

Build the entire onebusaway-nyc project with the profile "local-front-end"

$ cd ~/src/onebusaway-nyc
$ mvn clean && mvn install -Plocal-front-end,skip-integration-tests

Configure the appDB resource reference in tomcat; edit /var/lib/tomcat6/conf/context.xml

            <!-- Default set of monitored resources -->
            <WatchedResource>WEB-INF/web.xml</WatchedResource>

            <Resource name="jdbc/appDB"
                auth="Container"
                type="javax.sql.DataSource"
                maxActive="100"
                maxIdle="30"
                maxWait="10000"
                username="root"
                password=""
                driverClassName="com.mysql.jdbc.Driver"
                url="jdbc:mysql://localhost:3306/onebusaway_nyc" />

Deploy to Tomcat and start

        // note we change the war file name to have it deploy at the root context
        $ sudo /etc/init.d/tomcat6 stop
        $ sudo cp ~/src/onebusaway-nyc/onebusaway-nyc-webapp/target/onebusaway-nyc-webapp.war /var/lib/tomcat6/webapps/ROOT.war
        $ sudo /etc/init.d/tomcat6 start

Point your browser to http://localhost:8080/

Run the Front-end, API webapp, and TDS

Edit /var/lib/tomcat6/conf/context.xml and add:

   <Resource name="jdbc/appDB"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="10000"
    username="root"
    password="changeme"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/onebusaway_nyc" />

Execute the following commands:

user@localhost:src/onebusaway-nyc$ mvn clean install -Plocal-single-port,skip-integration-tests
user@localhost:src/onebusaway-nyc$ mkdir /tmp/bundle /tmp/oba-bundle
user@localhost:src/onebusaway-nyc$ sudo chown -R tomcat6:tomcat6 /tmp/bundle
user@localhost:src/onebusaway-nyc$ sudo chown -R tomcat6:tomcat6 /tmp/oba-bundle
user@localhost:src/onebusaway-nyc$ sudo cp onebusaway-nyc-transit-data-federation-webapp/target/onebusaway-nyc-transit-data-federation-webapp.war /var/lib/tomcat6/webapps/
user@localhost:src/onebusaway-nyc$ sudo cp onebusaway-nyc-api-webapp/target/onebusaway-nyc-api-webapp.war /var/lib/tomcat6/webapps/
user@localhost:src/onebusaway-nyc$ sudo cp onebusaway-nyc-acta-webapp/target/onebusaway-nyc-acta-webapp.war /var/lib/tomcat6/webapps/
user@localhost:src/onebusaway-nyc$ sudo /etc/init.d/tomcat6 start

Go to http://localhost:8080/onebusaway-nyc-acta-webapp

Run the Front-end and IE

Edit /var/lib/tomcat6/conf/context.xml and add:

   <Resource name="jdbc/appDB"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="10000"
    username="root"
    password="changeme"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/onebusaway_nyc" />

Execute the following commands:

user@localhost:src/onebusaway-nyc$ mvn clean install -Plocal-ie,depots-one,skip-integration-tests
user@localhost:src/onebusaway-nyc$ mkdir /tmp/bundle /tmp/oba-bundle
user@localhost:src/onebusaway-nyc$ sudo chown -R tomcat6:tomcat6 /tmp/bundle
user@localhost:src/onebusaway-nyc$ sudo chown -R tomcat6:tomcat6 /tmp/oba-bundle
user@localhost:src/onebusaway-nyc$ sudo cp onebusaway-nyc-vehicle-tracking-webapp/target/onebusaway-nyc-vehicle-tracking-webapp.war /var/lib/tomcat6/webapps/
user@localhost:src/onebusaway-nyc$ sudo cp onebusaway-nyc-acta-webapp/target/onebusaway-nyc-acta-webapp.war /var/lib/tomcat6/webapps/
user@localhost:src/onebusaway-nyc$ sudo /etc/init.d/tomcat6 start

Go to http://localhost:8080/onebusaway-nyc-acta-webapp

Run the Admin Server

Edit /var/lib/tomcat6/conf/context.xml and add:

    <Resource name="jdbc/appDB"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="10000"
    username="root"
    password="changeme"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/onebusaway_nyc" />
       <Resource name="jdbc/archiveDB"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="10000"
    username="root"
    password="changeme"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/onebusaway_nyc_archive" />
  <Parameter name="obanyc.environment" value="dev" override="false" />
  <Parameter name="admin.instanceId" value="localhost" override="false" />

Execute the following commands:

user@localhost:src/onebusaway-nyc$ mvn clean install -Plocal-single-port,skip-integration-tests
user@localhost:src/onebusaway-nyc$ sudo cp onebusaway-nyc-admin-webapp/target/onebusaway-nyc-admin-webapp.war /var/lib/tomcat6/webapps/
user@localhost:src/onebusaway-nyc$ sudo /etc/init.d/tomcat6 start

Run the Archiver

Edit /var/lib/tomcat6/conf/context.xml and add:

    <Resource name="jdbc/archiveDB"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="10000"
    username="root"
    password="changeme"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/onebusaway_nyc_archive" />
    <Resource name="jdbc/slaveDB"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="10000"
    username="root"
    password="changeme"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/onebusaway_nyc_archive" />

Execute the following commands:

user@localhost:src/onebusaway-nyc$ mvn clean install -Plocal-single-port,skip-integration-tests
user@localhost:src/onebusaway-nyc$ sudo mkdir -p /var/lib/obanyc/oba-bundle ; sudo chown tomcat6:tomcat6 /var/lib/obanyc/oba-bundle
user@localhost:src/onebusaway-nyc$ sudo cp onebusaway-nyc-report-archive/target/onebusaway-nyc-report-archive.war /var/lib/tomcat6/webapps/
user@localhost:src/onebusaway-nyc$ sudo /etc/init.d/tomcat6 start

Go http://localhost:8080/onebusaway-nyc-report-archive/api/record/last-known/list

Run the TDM

Edit /var/lib/tomcat6/conf/context.xml and add:

  <WatchedResource>WEB-INF/web.xml</WatchedResource>
       <Resource name="jdbc/appDB"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="10000"
    username="root"
    password="changeme"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/onebusaway_nyc" />
     <Resource name="jdbc/archiveDB"
    auth="Container"
    type="javax.sql.DataSource"
    maxActive="100"
    maxIdle="30"
    maxWait="10000"
    username="root"
    password="changeme"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/onebusaway_nyc_archive" />

Create /var/lib/obanyc/tdm-config/tdm_config.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configurationStore>
    <componentMap>
    </componentMap>
</configurationStore> 

Execute the following commands:

user@localhost:src/onebusaway-nyc$ mvn clean install -Plocal-single-port,skip-integration-tests
user@localhost:src/onebusaway-nyc$ sudo cp onebusaway-nyc-tdm-webapp/target/onebusaway-nyc-tdm-webapp.war /var/lib/tomcat6/webapps/
user@localhost:src/onebusaway-nyc$ sudo chown -R tomcat6:tomcat6 /var/lib/obanyc/tdm-config
user@localhost:src/onebusaway-nyc$ sudo mkdir -p /tmp/oba-bundle-tdm
user@localhost:src/onebusaway-nyc$ sudo chown -R tomcat6:tomcat6 /tmp/oba-bundle-tdm
user@localhost:src/onebusaway-nyc$ sudo mkdir /tmp/oba-bundle
user@localhost:src/onebusaway-nyc$ sudo chown -R tomcat6:tomcat6 /tmp/oba-bundle
user@localhost:src/onebusaway-nyc$ sudo mkdir -p /var/lib/obanyc/tdm-datapath/crew_assign
user@localhost:src/onebusaway-nyc$ sudo mkdir -p /var/lib/obanyc/tdm-datapath/vehicle_pipo
user@localhost:src/onebusaway-nyc$ sudo mkdir -p /var/lib/obanyc/tdm-datapath/depot_assigns
user@localhost:src/onebusaway-nyc$ sudo chown -R tomcat6:tomcat6 /var/lib/obanyc/tdm-datapath
user@localhost:src/onebusaway-nyc$ sudo /etc/init.d/tomcat6 start

If you received error messages about missing tables

Edit /var/lib/tomcat6/webapps/onebusaway-nyc-tdm-webapp/WEB-INF/classes/data-sources.xml and replace validate with update

<prop key="hibernate.hbm2ddl.auto">update</prop>

Go http://localhost:8080/onebusaway-nyc-tdm-webapp/api/bundle/list

Clone this wiki locally