Skip to content

Commit

Permalink
Create docker container to build graph file
Browse files Browse the repository at this point in the history
otp command similar to all otp docker images I found
  • Loading branch information
BryanQuigley committed Apr 5, 2022
1 parent ed0a0f9 commit 849e730
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ Development Installation
------------------------

1. Make sure you have the development dependencies installed
2. Place GTFS .zip files, OSM files, and elevation .tif files (optional) in the otp_data folder
3. Copy `deployment/ansible/group_vars/development_template` to `deployment/ansible/group_vars/development`
4. Change into the `src/` folder and run `npm install` to install the node modules on the host machine
5. Run `vagrant up`
6. See the app at http://localhost:8024! See OpenTripPlanner at http://localhost:9090.
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.
2. Place GTFS .zip files, OSM files, and elevation .tif files (optional) in the root of the otp_data folder
3. Generate a graph file with (takes approx 3 hours) `docker-compose run --rm otp otp --build /var/otp` in the deployment/graph directory.
4. Copy `deployment/ansible/group_vars/development_template` to `deployment/ansible/group_vars/development`
5. Change into the `src/` folder and run `npm install` to install the node modules on the host machine
6. Run `vagrant up`
7. See the app at http://localhost:8024! See OpenTripPlanner at http://localhost:9090.
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.

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.

Expand Down
11 changes: 11 additions & 0 deletions deployment/graph/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM openjdk:8u322-jre-bullseye

ENV VERSION=1.4.0 \
JAVA_MX=15G

ADD https://repo1.maven.org/maven2/org/opentripplanner/otp/$VERSION/otp-$VERSION-shaded.jar /usr/local/share/java/
RUN echo "0367b1a15bac5f587807a5b897a9734209f8135c /usr/local/share/java/otp-$VERSION-shaded.jar" | sha1sum --check
RUN ln -s otp-$VERSION-shaded.jar /usr/local/share/java/otp.jar

COPY otp /usr/local/bin/
RUN chmod 755 /usr/local/bin/*
8 changes: 8 additions & 0 deletions deployment/graph/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3'
services:
otp:
build:
context: .
dockerfile: Dockerfile
volumes:
- ../ansible/roles/cac-tripplanner.otp-data/files/otp_data/:/var/otp/
3 changes: 3 additions & 0 deletions deployment/graph/otp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

exec java -Xmx"$JAVA_MX" -jar /usr/local/share/java/otp.jar "$@"

0 comments on commit 849e730

Please sign in to comment.