Skip to content

Commit 75ba6bb

Browse files
committed
Update workflow with AWS config and commands
1 parent 32b31a8 commit 75ba6bb

File tree

3 files changed

+34
-15
lines changed

3 files changed

+34
-15
lines changed

.github/workflows/build-graph.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,25 @@ on:
1010
jobs:
1111
docker-compose:
1212
runs-on: ubuntu-latest
13-
13+
env:
14+
CAC_OTP_DATA_BUCKET: 'cleanair-otp-data'
1415
steps:
1516
- name: Checkout GitHub Repo
1617
uses: actions/checkout@v4
1718

18-
- name: Run Docker Compose
19+
- uses: aws-actions/configure-aws-credentials@v4
20+
with:
21+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
22+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
23+
aws-region: ${{ secrets.AWS_REGION }}
24+
25+
- name: Download latest GTFS, OSM, and elevation files from S3
26+
run: aws s3 sync --exclude "Graph.obj" "s3://$CAC_OTP_DATA_BUCKET/" "otp_data"
27+
28+
- name: Build graph
1929
run: |
2030
cd deployment/graph
2131
docker compose run --rm otp otp --build /var/otp
2232
23-
- name: Upload graph object
24-
uses: actions/upload-artifact@v4
25-
with:
26-
name: graph-artifact
27-
path: otp_data/Graph.obj
28-
retention-days: 30
33+
- name: Upload graph object to S3
34+
run: aws s3 cp "otp_data/Graph.obj" "s3://$CAC_OTP_DATA_BUCKET/Graph.obj"

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@ Development Installation
1313
------------------------
1414

1515
1. Make sure you have the development dependencies installed
16-
2. Place GTFS .zip files, OSM files, and elevation .tif files (optional) in the root of the otp_data folder
17-
3. (Optional) Generate a graph file with (takes approx 3 hours) `docker-compose run --rm otp otp --build /var/otp` in the deployment/graph directory.
18-
4. Copy `deployment/ansible/group_vars/development_template` to `deployment/ansible/group_vars/development`
19-
5. Change into the `src/` folder and run `npm install` to install the node modules on the host machine
20-
6. Run `vagrant up`. You can choose to change the Virtualbox shared folder type for the `app` VM from its default VirtualBox by:
16+
2. Download the latest Graph.obj for OTP: `scripts/download-latest-graph.sh`
17+
- This will take ~10 minutes to download
18+
- If you already have a local graph file but want the latest from S3, run `scripts/download-latest-graph.sh --force`
19+
3. Copy `deployment/ansible/group_vars/development_template` to `deployment/ansible/group_vars/development`
20+
4. Change into the `src/` folder and run `npm install` to install the node modules on the host machine
21+
5. Run `vagrant up`. You can choose to change the Virtualbox shared folder type for the `app` VM from its default VirtualBox by:
2122
```
2223
CAC_APP_SHARED_FOLDER_TYPE=nfs vagrant up
2324
```
24-
7. See the app at http://localhost:8024! See OpenTripPlanner at http://localhost:9090.
25-
8. Running `./scripts/serve-js-dev.sh` on the host will rebuild the front-end app on file change (the browser must be reloaded manually to pick up the change). Alternatively, `cd /opt/app/src && npm run gulp-development` can be run manually in the VM to pick up changes to the static files.
25+
6. See the app at http://localhost:8024! See OpenTripPlanner at http://localhost:9090.
26+
7. Running `./scripts/serve-js-dev.sh` on the host will rebuild the front-end app on file change (the browser must be reloaded manually to pick up the change). Alternatively, `cd /opt/app/src && npm run gulp-development` can be run manually in the VM to pick up changes to the static files.
2627

2728
Note that if there is an existing build Graph.obj in `otp_data`, vagrant provisioning in development mode will not attempt to rebuild the graph, but will use the one already present.
2829

scripts/download-latest-graph.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
graph_path="otp_data/Graph.obj"
6+
7+
if [[ ! -f "$graph_path" ]] || [[ "$*" == *"force"* ]]; then
8+
echo "Pulling latest Graph.obj from S3..."
9+
aws --profile=gophillygo s3 cp "s3://cleanair-otp-data/Graph.obj" "$graph_path"
10+
else
11+
echo "Built graph already in otp_data directory, skip pulling latest from S3"
12+
fi

0 commit comments

Comments
 (0)