OneBusAway / onebusaway-docker

Docker configuration for the OneBusAway Application Modules (https://github.com/OneBusAway/onebusaway-application-modules)
Apache License 2.0
18 stars 32 forks source link

feat: add support to GTFS-RT #58

Closed Altonhe closed 7 months ago

Altonhe commented 7 months ago

As #44 mentioned, this PR add GTFS-RT support to docker, The user can use docker-compose to quickly set up an instance, you can start with follow docker-compose.yml

...
  oba_app:
    container_name: oba_app
    depends_on:
      - oba_database
    build:
      context: ./oba
      # For test only, remove in production
      args:
        - TEST_API_KEY=test
        - VEHICLE_POSITIONS_URL=http://gtfs.ltconline.ca/Vehicle/VehiclePositions.pb
        - TRIP_UPDATES_URL=http://gtfs.ltconline.ca/TripUpdate/TripUpdates.pb
        - ALERTS_URL=http://gtfs.ltconline.ca/Alert/Alerts.pb
        - REFRESH_INTERVAL=30
        - AGENCY_ID=ltc
    environment:
      - JDBC_URL=jdbc:mysql://oba_database:3306/oba_database
      - JDBC_USER=oba_user
      - JDBC_PASSWORD=oba_password
    volumes:
      # Share the host's `bundle` directory
      # with the filesystem of the OBA service.
      - ./bundle:/bundle
    ports:
      # Access the webapp on your host machine at a path like
      # http://localhost:8080/onebusaway-api-webapp/api/where/agency/${YOUR_AGENCY}.json?key=TEST
      - "8080:8080"
    # restart: always
...

Results: In docker oba_app:

  $ cat /usr/local/tomcat/webapps/onebusaway-transit-data-federation-webapp/WEB-INF/classes/data-sources.xml
...
  <!--    GTFS-RT related beans, automatically generated by the `bootstrap.sh`-->
  <bean id="gtfsRT" class="org.onebusaway.transit_data_federation.impl.realtime.gtfs_realtime.GtfsRealtimeSource">
    <property name="tripUpdatesUrl" value="http://gtfs.ltconline.ca/TripUpdate/TripUpdates.pb"/>
    <property name="vehiclePositionsUrl" value="http://gtfs.ltconline.ca/Vehicle/VehiclePositions.pb"/>
    <property name="alertsUrl" value="http://gtfs.ltconline.ca/Alert/Alerts.pb"/>
    <property name="refreshInterval" value="30"/>
    <property name="agencyId" value="ltc"/>
  </bean>
  <bean id="bundleManagementService" class="org.onebusaway.transit_data_federation.impl.bundle.BundleManagementServiceImpl">
    <property name="bundleStoreRoot" value="/bundle"/>
    <property name="standaloneMode" value="true"/>
  </bean>
...

image