Skip to content

Commit

Permalink
Merge pull request #78 from Altonhe/feature/bundle-builder
Browse files Browse the repository at this point in the history
feat: allow build bundle inside `oba_app`
  • Loading branch information
aaronbrethorst authored Apr 24, 2024
2 parents 4130267 + 6e9ee9e commit 18d2714
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ You can find the latest published Docker images on Docker Hub:
* `JDBC_URL` - The JDBC connection URL for your MySQL database.
* `JDBC_USER` - The username for your MySQL database.
* `JDBC_PASSWORD` - The password for your MySQL database.
* GTFS (Optional, required only when using `oba_app` independently)
* `GTFS_URL` - The URL to the GTFS feed you want to use.
* GTFS-RT Support (Optional)
* `ALERTS_URL` - Service Alerts URL for GTFS-RT.
* `TRIP_UPDATES_URL` - Trip Updates URL for GTFS-RT.
Expand All @@ -91,6 +93,8 @@ The `GTFS-RT` and `Google Map` related variables will be handled by the `oba/boo
- JDBC_URL=jdbc:mysql://oba_database:3306/oba_database
- JDBC_USER=oba_user
- JDBC_PASSWORD=oba_password
# change this to your GTFS url
- GTFS_URL=https://unitrans.ucdavis.edu/media/gtfs/Unitrans_GTFS.zip
# skip bootstrap.sh and use user-configured config files
- USER_CONFIGURED=1
```
Expand Down
4 changes: 4 additions & 0 deletions oba/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM tomcat:8.5.98-jdk11-temurin

ENV CATALINA_HOME /usr/local/tomcat
ARG OBA_VERSION=2.4.18-cs
ENV OBA_VERSION=$OBA_VERSION

ARG GID=1000
ARG UID=1000
Expand Down Expand Up @@ -38,6 +39,9 @@ WORKDIR /oba/libs
RUN wget "https://repo.camsys-apps.com/releases/org/onebusaway/onebusaway-api-webapp/${OBA_VERSION}/onebusaway-api-webapp-${OBA_VERSION}.war"
RUN wget "https://repo.camsys-apps.com/releases/org/onebusaway/onebusaway-enterprise-acta-webapp/${OBA_VERSION}/onebusaway-enterprise-acta-webapp-${OBA_VERSION}.war"
RUN wget "https://repo.camsys-apps.com/releases/org/onebusaway/onebusaway-transit-data-federation-webapp/${OBA_VERSION}/onebusaway-transit-data-federation-webapp-${OBA_VERSION}.war"

# Bundle builder
WORKDIR /oba/tools
RUN wget "https://repo.camsys-apps.com/releases/org/onebusaway/onebusaway-transit-data-federation-builder/${OBA_VERSION}/onebusaway-transit-data-federation-builder-${OBA_VERSION}-withAllDependencies.jar"

# Tomcat Configuration
Expand Down
16 changes: 16 additions & 0 deletions oba/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ NAMESPACE_PREFIX="x"
NAMESPACE_URI="http://www.springframework.org/schema/beans"
BEAN_ID="testAPIKey"

# Build bundle inside the container
if [ -n "$GTFS_URL" ]; then
echo "GTFS_URL is set, building bundle..."
echo "OBA Bundle Builder Starting"
echo "GTFS_URL: $GTFS_URL"
echo "OBA Version: $OBA_VERSION"
mkdir -p /bundle
wget -O /bundle/gtfs.zip "$GTFS_URL"
cd /bundle \
&& java -Xss4m -Xmx3g \
-jar /oba/tools/onebusaway-transit-data-federation-builder-${OBA_VERSION}-withAllDependencies.jar \
./gtfs.zip \
.
fi

# For users who want to configure the data-sources.xml file themselves
if [ -n "$USER_CONFIGURED" ]; then
echo "USER_CONFIGURED is set, you should create your own configuration file, Aborting..."
Expand All @@ -29,6 +44,7 @@ else
fi

DATA_FEDERATION_XML_FILE="$CATALINA_HOME/webapps/onebusaway-transit-data-federation-webapp/WEB-INF/classes/data-sources.xml"
DATA_SOURCE_CLASS="org.onebusaway.transit_data_federation.impl.realtime.gtfs_realtime.GtfsRealtimeSource"
BEAN_ID="gtfsRT"
# Check if GTFS-Rt related environment variables are set
if [ -z "$TRIP_UPDATES_URL" ] && [ -z "$VEHICLE_POSITIONS_URL" ] && [ -z "$ALERTS_URL" ]; then
Expand Down

0 comments on commit 18d2714

Please sign in to comment.