Skip to content
sheldonabrown edited this page Mar 6, 2013 · 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.

Running locally

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 either the front-end/API/TDF or the inference engine 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)
  • 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 - Eclipse users

Assuming you have Tomcat support in Eclipse, this is the easiest option for new users.

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

Running via the Command Line

This example uses the profile local-front-end (For front end only, uses TDF in dev environment)

Build the onebusaway-nyc module with the profile "local-single-port"

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

Run - Command Line

Novice users will want to skip this step as the above is much simpler! This step describes running the application using two possible application servers. You only need one of the two application servers depending on the environment. Jetty server should be used for dev environment whereas production should use Tomcat.

via Jetty

    //create jetty-env.xml to set datasource
    $ mv onebusaway-nyc-webapp/src/main/webapp/WEB-INF/jetty-env.xml.mysql onebusaway-nyc-webapp/src/main/webapp/WEB-INF/jetty-env.xml
execute
        $ xterm -l -hold -T "app" -e "cd ~/src/onebusaway-nyc/onebusaway-nyc-webapp && mvn jetty:run -Plocal-front-end"

via Tomcat

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/

Clone this wiki locally