From b3c2cb1231e28d8997b63ec77ecbac200a6d07ee Mon Sep 17 00:00:00 2001 From: Bryan Quigley Date: Fri, 18 Mar 2022 15:13:36 -0700 Subject: [PATCH] Create docker container to build graph file otp command similar to all otp docker images I found --- README.md | 13 +++++++------ deployment/graph/Dockerfile | 11 +++++++++++ deployment/graph/docker-compose.yml | 8 ++++++++ deployment/graph/otp | 3 +++ 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 deployment/graph/Dockerfile create mode 100644 deployment/graph/docker-compose.yml create mode 100755 deployment/graph/otp diff --git a/README.md b/README.md index d48987450..f046a9215 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/deployment/graph/Dockerfile b/deployment/graph/Dockerfile new file mode 100644 index 000000000..96e5c8c7d --- /dev/null +++ b/deployment/graph/Dockerfile @@ -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/* diff --git a/deployment/graph/docker-compose.yml b/deployment/graph/docker-compose.yml new file mode 100644 index 000000000..aaa4b0ad5 --- /dev/null +++ b/deployment/graph/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3' +services: + otp: + build: + context: . + dockerfile: Dockerfile + volumes: + - ../ansible/roles/cac-tripplanner.otp-data/files/otp_data/:/var/otp/ \ No newline at end of file diff --git a/deployment/graph/otp b/deployment/graph/otp new file mode 100755 index 000000000..aa439b97c --- /dev/null +++ b/deployment/graph/otp @@ -0,0 +1,3 @@ +#!/bin/sh + +exec java -Xmx"$JAVA_MX" -jar /usr/local/share/java/otp.jar "$@"