Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8e84abe
doc: added link
dancesWithCycles May 24, 2021
6966d89
doc: adjusted expression
dancesWithCycles May 24, 2021
8efdd5c
doc: added link
dancesWithCycles May 24, 2021
85d507d
doc: added link
dancesWithCycles May 24, 2021
aefb73d
doc: adjusted expression for consistency reasons
dancesWithCycles May 24, 2021
9784706
doc: Listing Docker as requirement once is enough, right?
dancesWithCycles May 24, 2021
23e02ba
doc: adjusted expression
dancesWithCycles May 24, 2021
83ba07f
doc: adjusted expression
dancesWithCycles May 24, 2021
f06f760
doc: adjusted expression
dancesWithCycles May 24, 2021
31d2c01
doc: translated heading
dancesWithCycles May 25, 2021
3fdf39c
doc: adjusted expression
dancesWithCycles May 25, 2021
459c7d8
Update chapter one of tutorial to work with OTP2
leonardehrenfried Jul 30, 2021
3d96391
Remove Covid-19 map
leonardehrenfried Jul 30, 2021
45e2843
Remove more config items
leonardehrenfried Jul 30, 2021
ccc33d0
Migrate chapter 2 to OTP2
leonardehrenfried Aug 6, 2021
6cbb50a
Use Dockerfile from chapter 2 for chapter 3
leonardehrenfried Aug 6, 2021
28a670f
Add otp-config to enable GraphQL API
leonardehrenfried Aug 6, 2021
e8f0255
Update step 03
leonardehrenfried Aug 9, 2021
b06b367
Correct formatting
leonardehrenfried Aug 9, 2021
feb79f6
Reduce chapter one options to bare minimum
leonardehrenfried Aug 9, 2021
397d428
Use apt-get instead of zip
leonardehrenfried Mar 18, 2022
bcbf93a
Add -y
leonardehrenfried Mar 18, 2022
c59e9af
Use apt-get not apk
leonardehrenfried Mar 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
413 changes: 259 additions & 154 deletions 01-installing-and-running-ui/README.md

Large diffs are not rendered by default.

35 changes: 10 additions & 25 deletions 02-otp-and-graph-building/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,30 @@ ARG OTP_IMAGE=mfdz/opentripplanner
FROM $OTP_IMAGE:$OTP_TAG AS otp

# defined empty, so we can access the arg as env later again
ARG OTP_VERSION
ENV ROUTER_NAME=default
ARG gtfs_url=https://www.openvvs.de/dataset/e66f03e4-79f2-41d0-90f1-166ca609e491/resource/bfbb59c7-767c-4bca-bbb2-d8d32a3e0378/download/google_transit.zip
ENV GTFS_URL=$gtfs_url
ARG osm_pbf_url=https://download.geofabrik.de/europe/germany/baden-wuerttemberg/stuttgart-regbez-latest.osm.pbf
ENV OSM_PBF_URL=$osm_pbf_url
ARG memory=31G
ENV MEMORY=$memory

RUN apk add --update zip && \
rm -rf /var/cache/apk/*
RUN apt-get update && apt-get install zip -y

RUN mkdir -p /opt/opentripplanner/build/$ROUTER_NAME/
RUN mkdir -p /opt/opentripplanner/build/

# add build data
# NOTE: we're using dockers caching here. Add items in order of least to most frequent changes
ADD router-config.json /opt/opentripplanner/build/$ROUTER_NAME/
ADD build-config.json /opt/opentripplanner/build/$ROUTER_NAME/
ADD $OSM_PBF_URL /opt/opentripplanner/build/$ROUTER_NAME/
ADD $GTFS_URL /opt/opentripplanner/build/$ROUTER_NAME/
ADD router-config.json /opt/opentripplanner/build/
ADD build-config.json /opt/opentripplanner/build/
ADD otp-config.json /opt/opentripplanner/build/
ADD $OSM_PBF_URL /opt/opentripplanner/build/
ADD $GTFS_URL /opt/opentripplanner/build/gtfs.zip

# print version
RUN java -jar otp-shaded.jar --version | tee build/version.txt
RUN echo "image: mfdz/opentripplanner:$OTP_VERSION" >> build/version.txt

# build
RUN java -Xmx$MEMORY -jar otp-shaded.jar --build build/$ROUTER_NAME | tee build/build.log
RUN java -Xmx$MEMORY -jar otp-shaded.jar --build --save /opt/opentripplanner/build/

# package: graph and config into zip
RUN sh -c 'cd /opt/opentripplanner/build/; export VERSION=$(grep "version:" version.txt | cut -d" " -f2); zip graph-$ROUTER_NAME-$VERSION.zip $ROUTER_NAME/Graph.obj $ROUTER_NAME/router-*.json'

RUN rm -rf /opt/opentripplanner/build/$ROUTER_NAME

# ---

FROM nginx:alpine

RUN sed -i 'N; s/index index.html index.htm;/autoindex on;/' /etc/nginx/conf.d/default.conf; \
sed -i '/error_page/d' /etc/nginx/conf.d/default.conf
RUN rm /usr/share/nginx/html/*.html

COPY --from=otp /opt/opentripplanner/build/ /usr/share/nginx/html/
#
ENTRYPOINT java -Xmx$MEMORY -jar otp-shaded.jar --load --serve /opt/opentripplanner/build/
7 changes: 3 additions & 4 deletions 02-otp-and-graph-building/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# stadtnavi Tutorial - OpenTripPlanner aufsetzen

# stadtnavi Tutorial - OpenTripPlanner setup

## Building and running OpenTripPlanner with default config

Expand Down Expand Up @@ -33,7 +32,7 @@ Creating 02-otp-and-graph-building_opentripplanner_1 ... done
$
```

To verify that the OpenTripPlanner started successfully, you may check for the following lines in the logs:
To verify that OpenTripPlanner started successfully, you may check for the following lines in the logs:
```sh
$ docker logs 02-otp-and-graph-building_opentripplanner_1

Expand All @@ -44,7 +43,7 @@ $ docker logs 02-otp-and-graph-building_opentripplanner_1
12:14:53.865 INFO (GrizzlyServer.java:154) Grizzly server running.
```

Now OpenTripPlanner is ready and you may access the interal OTP front end via http://localhost:8090 (Note the port is 8090 as 8080 is mapped to 8090 in the docker-compose.yml).
Now OpenTripPlanner is ready and you may access the internal OTP front end via http://localhost:8090 (Note the port is 8090 as 8080 is mapped to 8090 in the docker-compose.yml).

If that worked, you may adapt the config to supply your proper data.

Expand Down
16 changes: 5 additions & 11 deletions 02-otp-and-graph-building/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,19 @@ version: '3'

services:
opentripplanner:
image: ${OTP_IMAGE}:${OTP_TAG}
depends_on:
- "graph"
environment:
- ROUTER_NAME=default
- ROUTER_DATA_CONTAINER_URL=http://graph/
ports:
- "${OTP_PORT}:8080"
graph:
build:
image: ${OTP_IMAGE}:${OTP_TAG}
build:
context: .
args:
- OTP_IMAGE=${OTP_IMAGE}
- OTP_TAG=${OTP_TAG}
- gtfs_url=${GTFS_URL}
- osm_pbf_url=${OSM_URL}
- memory=${GRAPH_BUILD_MEMORY}
ports:
- "${OTP_PORT}:8080"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 15s
timeout: 10s
retries: 3
retries: 3
6 changes: 6 additions & 0 deletions 02-otp-and-graph-building/otp-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"otpFeatures" : {
"SandboxAPILegacyGraphQLApi": true,
"SandboxAPIMapboxVectorTilesApi": true
}
}
6 changes: 3 additions & 3 deletions 03-running-otp-and-digitransit/.env
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# --- Digitransit Config
ROUTER=ludwigsburg
ROUTER=hbnext
# API URL (usually starts with api., for development, you'll probably need to configure /etc/hosts to map api.localhost to 127.0.0.1)
API_URL=http://api.localhost:8080
DT_IMAGE=mfdz/digitransit-ui
DT_TAG=latest
DT_IMAGE=stadtnavi/digitransit-ui
DT_TAG=next
# --- OpenTripPlanner Config
# URL to the GTFS feed used for routing
GTFS_URL=https://www.openvvs.de/dataset/e66f03e4-79f2-41d0-90f1-166ca609e491/resource/bfbb59c7-767c-4bca-bbb2-d8d32a3e0378/download/google_transit.zip
Expand Down
35 changes: 10 additions & 25 deletions 03-running-otp-and-digitransit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,30 @@ ARG OTP_IMAGE=mfdz/opentripplanner
FROM $OTP_IMAGE:$OTP_TAG AS otp

# defined empty, so we can access the arg as env later again
ARG OTP_VERSION
ENV ROUTER_NAME=default
ARG gtfs_url=https://www.openvvs.de/dataset/e66f03e4-79f2-41d0-90f1-166ca609e491/resource/bfbb59c7-767c-4bca-bbb2-d8d32a3e0378/download/google_transit.zip
ENV GTFS_URL=$gtfs_url
ARG osm_pbf_url=https://download.geofabrik.de/europe/germany/baden-wuerttemberg/stuttgart-regbez-latest.osm.pbf
ENV OSM_PBF_URL=$osm_pbf_url
ARG memory=31G
ENV MEMORY=$memory

RUN apk add --update zip && \
rm -rf /var/cache/apk/*
RUN apt-get update && apt-get install zip -y

RUN mkdir -p /opt/opentripplanner/build/$ROUTER_NAME/
RUN mkdir -p /opt/opentripplanner/build/

# add build data
# NOTE: we're using dockers caching here. Add items in order of least to most frequent changes
ADD router-config.json /opt/opentripplanner/build/$ROUTER_NAME/
ADD build-config.json /opt/opentripplanner/build/$ROUTER_NAME/
ADD $OSM_PBF_URL /opt/opentripplanner/build/$ROUTER_NAME/
ADD $GTFS_URL /opt/opentripplanner/build/$ROUTER_NAME/
ADD router-config.json /opt/opentripplanner/build/
ADD build-config.json /opt/opentripplanner/build/
ADD otp-config.json /opt/opentripplanner/build/
ADD $OSM_PBF_URL /opt/opentripplanner/build/
ADD $GTFS_URL /opt/opentripplanner/build/gtfs.zip

# print version
RUN java -jar otp-shaded.jar --version | tee build/version.txt
RUN echo "image: mfdz/opentripplanner:$OTP_VERSION" >> build/version.txt

# build
RUN java -Xmx$MEMORY -jar otp-shaded.jar --build build/$ROUTER_NAME | tee build/build.log
RUN java -Xmx$MEMORY -jar otp-shaded.jar --build --save /opt/opentripplanner/build/ | tee build/build.log

# package: graph and config into zip
RUN sh -c 'cd /opt/opentripplanner/build/; export VERSION=$(grep "version:" version.txt | cut -d" " -f2); zip graph-$ROUTER_NAME-$VERSION.zip $ROUTER_NAME/Graph.obj $ROUTER_NAME/router-*.json'

RUN rm -rf /opt/opentripplanner/build/$ROUTER_NAME

# ---

FROM nginx:alpine

RUN sed -i 'N; s/index index.html index.htm;/autoindex on;/' /etc/nginx/conf.d/default.conf; \
sed -i '/error_page/d' /etc/nginx/conf.d/default.conf
RUN rm /usr/share/nginx/html/*.html

COPY --from=otp /opt/opentripplanner/build/ /usr/share/nginx/html/
#
ENTRYPOINT java -Xmx$MEMORY -jar otp-shaded.jar --load --serve /opt/opentripplanner/build/
24 changes: 5 additions & 19 deletions 03-running-otp-and-digitransit/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ services:
image: stadtnavi/digitransit-proxy:minimal
ports:
- 8080:8080
volumes:
- ${PWD}/logs:/var/log/nginx
depends_on:
- "opentripplanner"
digitransit-ui:
Expand All @@ -21,34 +19,22 @@ services:
image: stadtnavi/hsl-map-server:latest
environment:
- OTP_URL=opentripplanner:8080/otp/routers/default/index/graphql
# - PARK_API_URL=https://api.parkendd.de/Freiburg
depends_on:
- "opentripplanner"
opentripplanner:
image: ${OTP_IMAGE}:${OTP_TAG}
depends_on:
- "graph"
environment:
- ROUTER_NAME=default
- ROUTER_DATA_CONTAINER_URL=http://graph/
ports:
- "${OTP_PORT}:8080"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 15s
timeout: 10s
retries: 30
graph:
build:
build:
context: .
args:
- OTP_IMAGE=${OTP_IMAGE}
- OTP_TAG=${OTP_TAG}
- gtfs_url=${GTFS_URL}
- osm_pbf_url=${OSM_URL}
- memory=${GRAPH_BUILD_MEMORY}
ports:
- "${OTP_PORT}:8080"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 15s
timeout: 10s
retries: 30
retries: 30
6 changes: 6 additions & 0 deletions 03-running-otp-and-digitransit/otp-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"otpFeatures" : {
"SandboxAPILegacyGraphQLApi": true,
"SandboxAPIMapboxVectorTilesApi": true
}
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# stadtnavi tutorial
This is a step by step introduction how to setup a stadtnavi instance. It aims developers wanting to get up and running quickly, using docker(-compose) as a deployment tool. For setups closer to production, please consult e.g. the [transportkollektiv digitransit cookbook](https://transportkollektiv.github.io/digitransit-setup/).
This is a step by step introduction how to setup a [stadtnavi](https://herrenberg.stadtnavi.de/) instance. It aims for developers wanting to get up and running quickly, using docker(-compose) as a deployment tool. For setups closer to production, please consult e.g. the [transportkollektiv digitransit cookbook](https://transportkollektiv.github.io/digitransit-setup/).

## [Step 1](01-installing-and-running-ui/README.md)
Step 1 illustrates, how to start and customize a digitransit-ui frontend, connecting to existining backend services.
Step 1 illustrates, how to start and customize a [digitransit-ui](https://github.com/HSLdevcom/digitransit-ui.git) frontend, connecting to existining backend services.

## [Step 2](02-otp-and-graph-building/README.md)
Step 2 shows, how to run an OpenTripPlanner backend service and explains how to customize it for a specific region.
Step 2 shows, how to run an [OpenTripPlanner](https://github.com/HSLdevcom/digitransit-ui.git) backend service and explains how to customize it for a specific region.

## [Step 3](03-running-otp-and-digitransit/README.md)
Step 3 shows, how to run the customized digitransit-ui, the OpenTripPlanner backend service and the map server to display POIs.
Expand Down