Skip to content

Commit

Permalink
update OBA 2.x Build and Run Guide
Browse files Browse the repository at this point in the history
Signed-off-by: aryan lamba <[email protected]>
  • Loading branch information
lambaaryan011 committed Jan 25, 2025
1 parent ec68af0 commit d41703b
Showing 1 changed file with 98 additions and 62 deletions.
160 changes: 98 additions & 62 deletions src/guides/wiki/oba-2x-build-run-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ layout: page

<div class='bg-blue-50 border-blue-500 dark:bg-slate-800 p-4 rounded-md'>
<div><strong>Original location</strong>: <a href='https://github.com/OneBusAway/onebusaway-application-modules/wiki'>https://github.com/OneBusAway/onebusaway-application-modules/wiki</a></div>
<div><strong>Last updated</strong>: April 2022</div>
<div><strong>Last updated</strong>: January 2025</div>
</div>

Welcome to OneBusAway!
Expand All @@ -16,12 +16,12 @@ OneBusAway Application modules are a suite of modules that assist in providing C

v2.1 is intended for java11 on a Unix/Linux or mac platform. As preconditions these instruction assume you have installed:
* a recent git version
* mvn 3.5.4
* java 1.11.x
* mysql 5.7
* Maven 3.9.x
* Java 11 (1.11.x) or later
* MySQL 8.0 or compatible alternative (e.g., PostgreSQL)


In a bash terminal:
Steps to Build
```bash
mkdir ~/src
cd ~/src
Expand All @@ -30,113 +30,149 @@ cd onebusaway-applicaton-modules
mvn clean install
```

Verify the tests succeed before proceeding.
Ensure all tests pass before proceeding. If tests fail, verify Maven and Java configurations.

## Running OneBusAway Application Modules

There are many possible configurations of these modules. Here we will detail one popular configuration.
This guide outlines the setup for a common configuration, using the following.

### Modules:
* onebusaway-admin-webapp: used to build the GTFS into the onebusaway-federated-transit-data-bundle and service via /api/bundle/list
* onebusaway-admin-webapp: Builds the GTFS bundle and provides services via /api/bundle/list
* onebusaway-transit-data-webapp: used to load the bundle and provide a data tier layer
* onebusaway-api-webapp: provide the developer API for native apps
* onebusaway-acta-webapp: an example branded UI for providing desktop web and mobile web interfaces

### Database setup using mysql
In a bash terminal:
### Setting Up MySQL Database
Run the following commands in a bash terminal:
```
mysql -u root -P
mysql> create database onebusaway;
mysql -u root -p
mysql> CREATE DATABASE onebusaway;
mysql> \q
```

### Admin Console setup:
Here we dedicate a Tomcat Server instance to the onebusaway-admin-webapp to provide bundle services.
### Configuring the Admin Console

Tomcat Setup

1. Download and extract the latest version of Tomcat 10.x from [Apache Tomcat](https://downloads.apache.org/tomcat/).


Go to https://downloads.apache.org/tomcat/tomcat-8/ and find the latest version of Tomcat 8.5. For this example its 8.5.75
In a bash terminal:

```
mkdir ~/tomcat
cd ~/tomcat
wget https://www.apache.org/dist/tomcat/tomcat-8/v8.5.75/bin/apache-tomcat-8.5.75.zip
wget https://downloads.apache.org/tomcat/tomcat-10/v10.1.0/bin/apache-tomcat-10.1.0.zip
mkdir admin
cd admin
unzip ../apache-tomcat-8.5.75.zip
cd apache-tomcat-8.5.75/webapps
unzip ../apache-tomcat-10.1.0.zip
```

2. Deploy the onebusaway-admin-webapp:

In a bash terminal:
```
cd apache-tomcat-10.1.0/webapps
cp ~/src/onebusaway-application-modules/onebusaway-admin-webapp/target/onebusaway-admin-webapp.war ROOT.war
cd ../conf
# change port from 8080 to 9999 for admin server
# this may be mac specific
sed -i '' 's!port="8080"!port="9999"!g;s!port="8005"!port="8115"' server.xml
sed -i '' 's!</Context>!<Parameter name="file.bundle.bucketName" value="/var/lib/oba/bundles/builder" override="false" /><Parameter name="admin.instanceId" value="localhost" override="false" /><Parameter name="admin.port" value="9999" override="false" /><Parameter name="admin.context" value="api" override="false" /></Context>!' context.xml
# linux
sed -i server.xml -e 's!port="8080"!port="9999"!g;s!port="8005"!port="8115"!g'
sed -i context.xml -e 's!</Context>!<Parameter name="file.bundle.bucketName" value="/var/lib/oba/bundles/builder" override="false" /><Parameter name="admin.instanceId" value="localhost" override="false" /><Parameter name="admin.port" value="9999" override="false" /><Parameter name="admin.context" value="api" override="false" /></Context>!'
# add mail support
```
3. Update server.xml and context.xml to configure ports an:

* Change the port from 8080 to 9999.
* Add parameters for the admin console:

```
sed -i 's!port="8080"!port="9999"!g;s!port="8005"!port="8115"!g' ../conf/server.xml
sed -i 's!</Context>!<Parameter name="file.bundle.bucketName" value="/var/lib/oba/bundles/builder" override="false" />\
<Parameter name="admin.instanceId" value="localhost" override="false" />\
<Parameter name="admin.port" value="9999" override="false" />\
<Parameter name="admin.context" value="api" override="false" /></Context>!' ../conf/context.xml
```
3. Add mail support:

In a bash terminal:
```
cd ../lib
wget https://repo1.maven.org/maven2/javax/mail/mail/1.4/mail-1.4.jar
# setup config.json
# copy contents of https://github.com/OneBusAway/onebusaway-application-modules/wiki/config.json.example to /var/lib/oba/config.json
```
5. Copy the example configuration:

* Download config.json.example from the [GitHub wiki](https://github.com/OneBusAway/onebusaway-application-modules/wiki).
* Save it to /var/lib/oba/config.json.

6. Start the server:

In a bash terminal:

```
cd ../bin
chmod 755 catalina.sh
./catalina.sh run
```
Build and Deploy the GTFS Bundle

1. Access the admin console at http://localhost:9999/.

* Username: admin
* Password: admin

Now load and build the GTFS into a transit-data-bundle via the admin console. We use Tampa Bay's HART as an example below.
In a web browser go http://localhost:9999/
user: admin
password: admin
2. Follow these steps:

Then execute the following steps:
* Click "Manage Agency Metadata"
* Click "Create new agency metadata"
* Agency Name: 1
* Agency Short Name: 1
* GTFS Feed Url: http://www.gohart.org/google/google_transit.zip
* GTFS Id: 1
* Legacy Id: 1
* Navigate to "Manage Agency Metadata" > "Create new agency metadata."
* Fill in the fields:
* Agency Name: 1
* Agency Short Name: 1
* GTFS Feed URL: http://www.gohart.org/google/google_transit.zip
* GTFS ID: 1
* Legacy ID: 1

* Click "Transit Data Bundle Utility"
* in "What do you want to name your dataset?" enter "20220114-hart" then click "Save and Continue"
* In Build Tab click "Upload"
* Switch to the Build tab
* Build Name: 20220114-hart-1
* Start Date: today
* End Date: 3 months from now
* Click "Build"
* Upon a successful Build go to "Stage" tab
* Click "Stage Bundle"
* Go to "Deploy" tab
* Click "Deploy Bundle(s)"
3. Build the bundle:

* Go to "Transit Data Bundle Utility."
* Enter a dataset name (e.g., 20230114-hart).
* In the "Build" tab, upload and configure:
* Build Name: 20230114-hart-1
* Start Date: Today
* End Date: 3 months from today
* Click "Build," then "Stage Bundle" and "Deploy Bundle(s)."


## UI tier

Here we dedicate another tomcat instance to the UI tier.
## Configuring the UI Tier

1. Set up another Tomcat instance for the UI modules:

In a new bash terminal:
```
cd ~/tomcat
mkdir app
cd app
unzip ../apache-tomcat-8.5.75.zip
cd apache-tomcat-8.5.75/webapps
unzip ../apache-tomcat-10.1.0.zip
```
2. Deploy the UI modules:

```
cd apache-tomcat-10.1.0/webapps
cp ~/src/onebusaway-application-modules/onebusaway-transit-data-federation-webapp/target/onebusaway-transit-data-federation-webapp.war ./
cp ~/src/onebusaway-application-modules/onebusaway-api-webapp/target/onebusaway-api-webapp.war ./
cp ~/src/onebusaway-application-modules/onebusaway-enterprise-acta-webapp/target/onebusaway-enterprise-acta-webapp.war ROOT.war
```
3. Start the server:

```
cd ../bin
chmod 755 catalina.sh
./catalina.sh run
```
4. Verify deployment:

* API: http://localhost:8080/onebusaway-api-webapp/api/where/config.json?key=OBA
* Web UI: http://localhost:8080/routes/index

Validate the api deployed correctly:
```
wget -O - http://localhost:8080/onebusaway-api-webapp/api/where/config.json?key=OBA
```

Ensure the branded webapp loaded in a web browser load http://localhost:8080/routes/index

Expand Down

0 comments on commit d41703b

Please sign in to comment.