Skip to content

Commit 4c71a63

Browse files
Merge pull request #106 from OneBusAway/rm-web
Remove oba-enterprise-acta-webapp from docker image
2 parents 7f07cb2 + 45067e1 commit 4c71a63

11 files changed

+35
-240
lines changed

.github/workflows/test.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ jobs:
7070
services_standalone:
7171
name: Services standalone
7272
runs-on: ubuntu-latest
73+
permissions:
74+
id-token: write
75+
contents: read
7376
steps:
7477
- name: Checkout code
7578
uses: actions/checkout@v4
@@ -90,6 +93,13 @@ jobs:
9093
chmod +x ./bin/validate.sh
9194
./bin/validate.sh
9295
96+
# - name: Breakpoint if tests failed
97+
# if: failure()
98+
# uses: namespacelabs/breakpoint-action@v0
99+
# with:
100+
# duration: 30m
101+
# authorized-users: aaronbrethorst
102+
93103
- name: Docker Compose down
94104
if: always()
95105
run: docker compose down

README.md

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ To build bundles and run the webapp server with your own GTFS feed, use the [Doc
2929
The app server and bundle builder use Maven artifacts from GitHub's Maven package registry, which unfortunately requires authentication. This is provided in the form of a pair of environment variables that must be supplied when building the app server image:
3030

3131
```bash
32-
PAT_USERNAME_FOR_GH=GITHUB_USERNAME \ PAT_TOKEN_FOR_GH=GITHUB_PERSONAL_ACCESS_TOKEN \
32+
PAT_USERNAME_FOR_GH=GITHUB_USERNAME \
33+
PAT_TOKEN_FOR_GH=GITHUB_PERSONAL_ACCESS_TOKEN \
3334
docker compose build oba_app
3435
```
3536

@@ -41,7 +42,8 @@ To build a bundle, use the `oba_bundler` service:
4142

4243
```bash
4344
GTFS_URL=https://www.soundtransit.org/GTFS-rail/40_gtfs.zip \
44-
PAT_USERNAME_FOR_GH=GITHUB_USERNAME \ PAT_TOKEN_FOR_GH=GITHUB_PERSONAL_ACCESS_TOKEN \
45+
PAT_USERNAME_FOR_GH=GITHUB_USERNAME \
46+
PAT_TOKEN_FOR_GH=GITHUB_PERSONAL_ACCESS_TOKEN \
4547
docker compose up oba_bundler
4648
```
4749

@@ -61,11 +63,10 @@ Once you have built an OBA bundle inside `./bundle`, you can run the OBA server
6163
docker compose up oba_app
6264
```
6365

64-
You will then have three web apps available:
66+
You will then have two web apps available:
6567

6668
* onebusaway-api-webapp, hosted at http://localhost:8080/onebusaway-api-webapp
6769
* Example API call: http://localhost:8080/onebusaway-api-webapp/api/where/agencies-with-coverage.json?key=TEST
68-
* onebusaway-enterprise-acta-webapp, a user-facing web app: http://localhost:8080
6970
* onebusaway-transit-data-federation-webapp, which does the heavy lifting of exposing the transit data bundle to other services: http://localhost:8080/onebusaway-transit-data-federation-webapp
7071

7172
When done using this web server, you can use the shell-standard `^C` to exit out and turn it off. If issues persist across runs, you can try using `docker compose down -v` and then `docker compose up oba_app` to refresh the Docker containers and services.
@@ -112,7 +113,7 @@ You can find the latest published Docker images on Docker Hub:
112113

113114

114115

115-
The `GTFS-RT` and `Google Map` related variables will be handled by the `oba/bootstrap.sh` script, which will set the config files for the OBA API webapp. If you want to use your own config files, you could set `USER_CONFIGURED=1` in the `oba_app` service in `docker-compose.yml` to skip `bootstrap.sh` and write your config file in the container.
116+
The `GTFS-RT` related variables will be handled by the `oba/bootstrap.sh` script, which will set the config files for the OBA API webapp. If you want to use your own config files, you could set `USER_CONFIGURED=1` in the `oba_app` service in `docker-compose.yml` to skip `bootstrap.sh` and write your config file in the container.
116117
```yaml
117118
oba_app:
118119
container_name: oba_app
@@ -130,41 +131,3 @@ The `GTFS-RT` and `Google Map` related variables will be handled by the `oba/boo
130131
# skip bootstrap.sh and use user-configured config files
131132
- USER_CONFIGURED=1
132133
```
133-
134-
### Using Google Maps
135-
136-
#### Prerequisites
137-
138-
- Have a valid Google Cloud Platform (GCP) account.
139-
- Create a project on GCP and enable the Maps JavaScript API for it.
140-
- Create an API key for your project. [See how to create an API key](https://cloud.google.com/docs/authentication/api-keys).
141-
- If there is a rate limit error while using the test API key, it means you have reached the maximum usage limit for that key, you need to generate a new API key.
142-
143-
#### Configuring Google Maps
144-
145-
You'll need to set the following environment variables:
146-
147-
- `GOOGLE_MAPS_API_KEY`: Your Google Maps API key.
148-
- `GOOGLE_MAPS_CLIENT_ID`: (Optional) Required if you are using the Google Maps Premium Plan.
149-
- `GOOGLE_MAPS_CHANNEL_ID`: (Optional) A channel ID that helps identify the source of API requests for analytics and reporting purposes.
150-
151-
#### Docker Configuration
152-
153-
If using Docker Compose:
154-
155-
1.Modify the 'docker-compose.yml' file like this:
156-
157-
```yaml
158-
services:
159-
oba-app:
160-
environment:
161-
- GOOGLE_MAPS_API_KEY=<YOUR_KEY_HERE>
162-
- GOOGLE_MAPS_CHANNEL_ID=<YOUR_CHANNEL_ID_HERE>
163-
- GOOGLE_MAPS_CLIENT_ID=<YOUR_CLIENT_ID_HERE>
164-
```
165-
166-
2.Use the following command to start the oba-app service:
167-
168-
```bash
169-
docker compose up -d oba-app
170-
```

bin/validate.sh

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
output=$(curl -s "http://localhost:8080/onebusaway-api-webapp/api/where/current-time.json?key=test" | jq '.data.entry.time')
3+
output=$(curl -s "http://localhost:8080/api/where/current-time.json?key=test" | jq '.data.entry.time')
44

55
if [[ ! -z "$output" && "$output" =~ ^[0-9]+$ ]]; then
66
echo "current-time.json endpoint works."
@@ -9,7 +9,7 @@ else
99
exit 1
1010
fi
1111

12-
output=$(curl -s "http://localhost:8080/onebusaway-api-webapp/api/where/agencies-with-coverage.json?key=test" | jq '.data.list[0].agencyId')
12+
output=$(curl -s "http://localhost:8080/api/where/agencies-with-coverage.json?key=test" | jq '.data.list[0].agencyId')
1313

1414
if [[ ! -z "$output" && "$output" == "\"unitrans\"" ]]; then
1515
echo "agencies-with-coverage.json endpoint works."
@@ -18,47 +18,38 @@ else
1818
exit 1
1919
fi
2020

21-
output=$(curl -s "http://localhost:8080/onebusaway-api-webapp/api/where/routes-for-agency/unitrans.json?key=test" | jq '.data.list | length')
21+
output=$(curl -s "http://localhost:8080/api/where/routes-for-agency/unitrans.json?key=test" | jq '.data.list | length')
2222
if [[ $output -gt 10 ]]; then
2323
echo "routes-for-agency/unitrans.json endpoint works."
2424
else
2525
echo "Error: routes-for-agency/unitrans.json is not working: $output"
2626
exit 1
2727
fi
2828

29-
output=$(curl -s "http://localhost:8080/onebusaway-api-webapp/api/where/stops-for-route/unitrans_C.json?key=test" | jq '.data.entry.routeId')
29+
output=$(curl -s "http://localhost:8080/api/where/stops-for-route/unitrans_C.json?key=test" | jq '.data.entry.routeId')
3030
if [[ ! -z "$output" && "$output" == "\"unitrans_C\"" ]]; then
3131
echo "stops-for-route/unitrans_C.json endpoint works."
3232
else
3333
echo "Error: stops-for-route/unitrans_C.json endpoint is not working: $output"
3434
exit 1
3535
fi
3636

37-
output=$(curl -s "http://localhost:8080/onebusaway-api-webapp/api/where/stop/unitrans_22182.json?key=test" | jq '.data.entry.code')
37+
output=$(curl -s "http://localhost:8080/api/where/stop/unitrans_22182.json?key=test" | jq '.data.entry.code')
3838
if [[ ! -z "$output" && "$output" == "\"22182\"" ]]; then
3939
echo "stop/unitrans_22182.json endpoint works."
4040
else
4141
echo "Error: stop/unitrans_22182.json endpoint is not working: $output"
4242
exit 1
4343
fi
4444

45-
output=$(curl -s "http://localhost:8080/onebusaway-api-webapp/api/where/stops-for-location.json?lat=38.555308&lon=-121.735991&key=test" | jq '.data.outOfRange')
45+
output=$(curl -s "http://localhost:8080/api/where/stops-for-location.json?lat=38.555308&lon=-121.735991&key=test" | jq '.data.outOfRange')
4646
if [[ ! -z "$output" && "$output" == "false" ]]; then
4747
echo "stops-for-location/unitrans_false.json endpoint works."
4848
else
4949
echo "Error: stops-for-location/unitrans_false.json endpoint is not working: $output"
5050
exit 1
5151
fi
5252

53-
output=$(curl -s "http://localhost:8080/")
54-
if echo "$output" | grep -qi "onebusaway enterprise"; then
55-
echo "Success: webapp found on http://localhost:8080"
56-
else
57-
echo "Error: webapp NOT found on http://localhost:8080"
58-
echo $output
59-
exit 1
60-
fi
61-
6253
# todo: add support for arrivals-and-departures-for-stop endpoint.
6354
# however, it doesn't seem that the unitrans_22182 stop has arrivals and departures on the weekend, so we'll need
6455
# something else to test with. However, for now, this is still a great step forward.

docker-compose.prod.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ services:
5050
- ALERTS_URL
5151
- REFRESH_INTERVAL=30
5252
- AGENCY_ID
53-
- GOOGLE_MAPS_API_KEY
5453

5554
volumes:
5655
# Share the host"s `bundle` directory

k8s-readme.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,3 @@ Then you can connect to it programmatically using `mysql`:
4343
```bash
4444
mysql -u oba_user -p -h localhost:3306
4545
```
46-
47-
#### Google Maps
48-
49-
50-
If deployed in Kubernetes environment:
51-
52-
1. Use the kubectl set env command to set new environment variables,
53-
make sure you replace deployment/oba-app with the actual name of your deployment:
54-
55-
```bash
56-
kubectl set env deployment/oba-app GOOGLE_MAPS_API_KEY=<YOUR_KEY_HERE> \
57-
GOOGLE_MAPS_CHANNEL_ID=<YOUR_CHANNEL_ID_HERE> \
58-
GOOGLE_MAPS_CLIENT_ID=<YOUR_CLIENT_ID_HERE>
59-
```
60-
61-
2. Use the following command to rebuild and start the oba app service:
62-
63-
```bash
64-
kubectl rollout restart deployment/oba-app
65-
```

oba/Dockerfile

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ COPY --from=builder \
9494
WORKDIR /oba/config
9595

9696
COPY ./config/context.xml.hbs .
97-
COPY ./config/googlemaps.config.json.hbs .
9897
COPY ./config/onebusaway-api-webapp-data-sources.xml.hbs .
99-
COPY ./config/onebusaway-enterprise-acta-webapp-data-sources.xml.hbs .
10098
COPY ./config/onebusaway-transit-data-federation-webapp-data-sources.xml.hbs .
10199

102100
##########
@@ -105,42 +103,27 @@ COPY ./config/onebusaway-transit-data-federation-webapp-data-sources.xml.hbs .
105103

106104
WORKDIR $CATALINA_HOME/webapps
107105

108-
##########
109-
# Configure onebusaway-api-webapp
110-
##########
111-
112-
COPY --from=builder \
113-
--chown=oba_user:oba_group \
114-
/oba/libs/onebusaway-api-webapp.war .
115-
116-
RUN mkdir onebusaway-api-webapp && \
117-
cd onebusaway-api-webapp && \
118-
jar xvf ../onebusaway-api-webapp.war && \
119-
rm ../onebusaway-api-webapp.war
120-
121-
COPY --from=builder \
122-
--chown=oba_user:oba_group \
123-
/oba/libs/mysql-connector-j.jar onebusaway-api-webapp/WEB-INF/lib/
106+
# COPY --from=builder \
107+
# --chown=oba_user:oba_group \
108+
# /oba/libs/postgresql.jar \
109+
# $CATALINA_HOME/webapps/ROOT/WEB-INF/lib/
124110

125-
COPY --from=builder \
126-
--chown=oba_user:oba_group \
127-
/oba/libs/postgresql.jar onebusaway-api-webapp/WEB-INF/lib/
111+
# COPY ./config/onebusaway-enterprise-acta-webapp-data-sources.xml.hbs \
112+
# $CATALINA_HOME/webapps/ROOT/WEB-INF/classes/data-sources.xml.hbs
128113

129-
COPY ./config/onebusaway-api-webapp-data-sources.xml.hbs \
130-
$CATALINA_HOME/webapps/onebusaway-api-webapp/WEB-INF/classes/data-sources.xml.hbs
131114

132115
##########
133-
# Configure onebusaway-enterprise-acta-webapp as ROOT (i.e. the path `/`)
116+
# Configure onebusaway-api-webapp
134117
##########
135118

136119
COPY --from=builder \
137120
--chown=oba_user:oba_group \
138-
/oba/libs/onebusaway-enterprise-acta-webapp.war .
121+
/oba/libs/onebusaway-api-webapp.war .
139122

140123
RUN mkdir ROOT && \
141124
cd ROOT && \
142-
jar xvf ../onebusaway-enterprise-acta-webapp.war && \
143-
rm ../onebusaway-enterprise-acta-webapp.war
125+
jar xvf ../onebusaway-api-webapp.war && \
126+
rm ../onebusaway-api-webapp.war
144127

145128
COPY --from=builder \
146129
--chown=oba_user:oba_group \
@@ -152,11 +135,9 @@ COPY --from=builder \
152135
/oba/libs/postgresql.jar \
153136
$CATALINA_HOME/webapps/ROOT/WEB-INF/lib/
154137

155-
COPY ./config/onebusaway-enterprise-acta-webapp-data-sources.xml.hbs \
156-
$CATALINA_HOME/webapps/ROOT/WEB-INF/classes/data-sources.xml.hbs
157-
138+
COPY ./config/onebusaway-api-webapp-data-sources.xml.hbs \
139+
$CATALINA_HOME/webapps/onebusaway-api-webapp/WEB-INF/classes/data-sources.xml.hbs
158140

159-
# TODO: when/where/why is this needed?
160141
RUN mkdir -p /opt/oba/logs
161142
RUN chown -R oba_user:oba_group /opt/oba/logs
162143
RUN chmod 755 /opt/oba/logs

oba/bootstrap.sh

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fi
2626
#####
2727

2828
API_XML_SOURCE="/oba/config/onebusaway-api-webapp-data-sources.xml.hbs"
29-
API_XML_DESTINATION="$CATALINA_HOME/webapps/onebusaway-api-webapp/WEB-INF/classes/data-sources.xml"
29+
API_XML_DESTINATION="$CATALINA_HOME/webapps/ROOT/WEB-INF/classes/data-sources.xml"
3030

3131
hbs_renderer -input "$API_XML_SOURCE" \
3232
-json '{"TEST_API_KEY": "'$TEST_API_KEY'", "JDBC_DRIVER": "'$JDBC_DRIVER'"}' \
@@ -58,35 +58,6 @@ hbs_renderer -input "$FEDERATION_XML_SOURCE" \
5858
-json '{"GTFS_RT_AVAILABLE": "'$GTFS_RT_AVAILABLE'", "TRIP_UPDATES_URL": "'$TRIP_UPDATES_URL'", "VEHICLE_POSITIONS_URL": "'$VEHICLE_POSITIONS_URL'", "ALERTS_URL": "'$ALERTS_URL'", "REFRESH_INTERVAL": "'$REFRESH_INTERVAL'", "AGENCY_ID": "'$AGENCY_ID'", "HAS_API_KEY": "'$HAS_API_KEY'", "FEED_API_KEY": "'$FEED_API_KEY'", "FEED_API_VALUE": "'$FEED_API_VALUE'"}' \
5959
-output "$FEDERATION_XML_DESTINATION"
6060

61-
#####
62-
# onebusaway-enterprise-acta-webapp
63-
#####
64-
65-
# Google map related environment variables
66-
WEBAPP_XML_SOURCE="/oba/config/onebusaway-enterprise-acta-webapp-data-sources.xml.hbs"
67-
WEBAPP_XML_DESTINATION="$CATALINA_HOME/webapps/ROOT/WEB-INF/classes/data-sources.xml"
68-
69-
if [ -z "$GOOGLE_MAPS_API_KEY" ] && [ -z "$GOOGLE_MAPS_CLIENT_ID" ] && [ -z "$GOOGLE_MAPS_CHANNEL_ID" ]; then
70-
echo "No Google Maps related environment variables are set. Removing element from data-sources.xml"
71-
GOOGLE_MAPS_CONFIGURED=""
72-
else
73-
echo "Google Maps related environment variables are set. Setting them in data-sources.xml"
74-
GOOGLE_MAPS_CONFIGURED="1"
75-
76-
MAP_CONFIG_SOURCE="/oba/config/googlemaps.config.json.hbs"
77-
MAP_CONFIG_DESTINATION="/var/lib/oba/config.json"
78-
79-
mkdir -p $(dirname "$MAP_CONFIG_DESTINATION")
80-
81-
hbs_renderer -input "$MAP_CONFIG_SOURCE" \
82-
-json '{"GOOGLE_MAPS_CONFIGURED": "'$GOOGLE_MAPS_CONFIGURED'", "GOOGLE_MAPS_API_KEY": "'$GOOGLE_MAPS_API_KEY'", "GOOGLE_MAPS_CLIENT_ID": "'$GOOGLE_MAPS_CLIENT_ID'", "GOOGLE_MAPS_CHANNEL_ID": "'$GOOGLE_MAPS_CHANNEL_ID'"}' \
83-
-output "$MAP_CONFIG_DESTINATION"
84-
fi
85-
86-
hbs_renderer -input "$WEBAPP_XML_SOURCE" \
87-
-json '{"GOOGLE_MAPS_CONFIGURED": "'$GOOGLE_MAPS_CONFIGURED'"}' \
88-
-output "$WEBAPP_XML_DESTINATION"
89-
9061
#####
9162
# Tomcat context.xml
9263
#####

oba/config/googlemaps.config.json.hbs

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)