Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow build bundle inside oba_app #78

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

* `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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a priority right now, but I noticed that the oba_app docker container has perl 5 installed in it. How would you feel about rewriting the bash script in perl to make it more DRY, and easier to manage and extend?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think would be a good idea to avoid overcomplicating our bootstrap.sh script, while I haven't learned Perl, I am willing to learn and apply it to the processes.

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
Loading