diff --git a/01-installing-and-running-ui/README.md b/01-installing-and-running-ui/README.md index 549600c..7fa080a 100644 --- a/01-installing-and-running-ui/README.md +++ b/01-installing-and-running-ui/README.md @@ -1,7 +1,7 @@ -## Customize stadtnavi Frontend, using existing back-end services +## Customize stadtnavi frontend, using existing backend services ### 1. Requirements, installation - - docker - git + - watchman - nodejs(v10.24.0) - yarn(LTS) - build-essential (for the node dependencies) @@ -45,6 +45,17 @@ $ git --version git version 2.20.1 ``` +### Installing watchman: + +On Mac run + +``` +brew install watchman +``` + +On Debian 10 it is rather difficult to install. Please follow the instructions +on the [Watchman installation page](https://facebook.github.io/watchman/docs/install.html). + ### Installing npm, nodejs and yarn: #### install nodejs version 10(more info [here](https://github.com/nodesource/distributions)): @@ -103,7 +114,7 @@ $ cd digitransit-ui ``` -### 3. Doing an initial build an see it works +### 3. Doing an initial build to see if it works ``` $ yarn install @@ -125,6 +136,24 @@ warning "eslint-config-airbnb > eslint-config-airbnb-base@13.2.0" has incorrect [5/5] Building fresh packages... warning Your current version of Yarn is out of date. The latest version is "1.22.5", while you're on "1.13.0". Done in 339.80s. + +$ yarn setup + +... +lerna success run Ran npm script 'clean' in 2 packages in 1.8s: +lerna success - @digitransit-store/digitransit-store-common-functions +lerna success - @digitransit-store/digitransit-store-future-route +info filter [ '@digitransit-store/*', +info filter '!@digitransit-component/digitransit-component', +info filter '!@digitransit-component/digitransit-component-with-breakpoint', +info filter '!undefined' ] + +/tmp/digitransit-ui/digitransit-store/packages/digitransit-store-common-functions/src/index.js → digitransit-store/packages/digitransit-store-common-functions/lib... +created digitransit-store/packages/digitransit-store-common-functions/lib in 876ms + +/tmp/digitransit-ui/digitransit-store/packages/digitransit-store-future-route/src/index.js → digitransit-store/packages/digitransit-store-future-route/lib... +created digitransit-store/packages/digitransit-store-future-route/lib in 1.8s + ``` The warnings are "ok". @@ -136,7 +165,7 @@ In the console you will see this message `Digitransit-ui available on port 8080` ### 4. Starting a new config - to add a new theme run: `yarn run add-theme ` - for example `yarn run add-theme rt` - - 3 file should be created and 1 modified: + - 3 files should be created and 1 modified: 1. app/configurations/config..js 2. sass/themes//_theme.scss 3. sass/themes//main.scss @@ -152,188 +181,264 @@ In the console you will see this message `Digitransit-ui available on port 8080` * modify the `APP_TITLE` variable located in app/configurations/config..js * `config.rt.js` * Replace the content of `config.rt.js` with the following code: - ``` - /* eslint-disable */ - import configMerger from '../util/configMerger'; - - const CONFIG = 'rt'; - const APP_TITLE = 'Reutlingen'; - const APP_DESCRIPTION = 'stadtnavi - reutlingen'; - const API_URL = process.env.API_URL || 'https://api.stadtnavi.de'; - const MAP_URL = process.env.MAP_URL || 'https://tiles.stadtnavi.eu/streets/{z}/{x}/{y}{r}.png'; - const SEMI_TRANSPARENT_MAP_URL = process.env.SEMI_TRANSPARENT_MAP_URL || 'https://api.maptiler.com/maps/ffa4d49e-c68c-46c8-ab3f-60543337cecb/256/{z}/{x}/{y}.png?key=eA0drARBA1uPzLR6StGD'; - const GEOCODING_BASE_URL = process.env.GEOCODING_BASE_URL || "https://photon.stadtnavi.eu/pelias/v1"; - const LOCATIONIQ_API_KEY = process.env.LOCATIONIQ_API_KEY; - const YEAR = 1900 + new Date().getYear(); - const STATIC_MESSAGE_URL = +``` +/* eslint-disable */ +import configMerger from '../util/configMerger'; + +const CONFIG = 'rt'; +const APP_TITLE = 'stadtnavi Reutlingen'; +const APP_DESCRIPTION = 'Gemeinsam Mobilität neu denken - die intermodale Verbindungssuche mit offenen, lokalen Daten'; +const API_URL = process.env.API_URL || 'https://api.stadtnavi.de'; +const MAP_URL = process.env.MAP_URL || 'https://tiles.stadtnavi.eu/streets/{z}/{x}/{y}{r}.png'; +const SEMI_TRANSPARENT_MAP_URL = process.env.SEMITRANSPARENT_MAP_URL || "https://tiles.stadtnavi.eu/satellite-overlay/{z}/{x}/{y}{r}.png"; +const GEOCODING_BASE_URL = process.env.GEOCODING_BASE_URL || "https://photon.stadtnavi.eu/pelias/v1"; +const YEAR = 1901 + new Date().getYear(); +const STATIC_MESSAGE_URL = process.env.STATIC_MESSAGE_URL || '/assets/messages/message.hb.json'; - const walttiConfig = require('./config.waltti.js').default; +const walttiConfig = require('./config.waltti.js').default; - const minLat = 48.395; - const maxLat = 48.6075; - const minLon = 9.0901; - const maxLon = 9.3616; +const realtimeHbg = require('./realtimeUtils').default.hbg; +const hostname = new URL(API_URL); +realtimeHbg.mqtt = `wss://${hostname.host}/mqtt/`; - export default configMerger(walttiConfig, { - CONFIG, - URL: { +const minLat = 48.6020; +const maxLat = 50.0050; +const minLon = 9.4087; +const maxLon = 10.9014; + +export default configMerger(walttiConfig, { + CONFIG, + URL: { OTP: process.env.OTP_URL || `${API_URL}/routing/v1/router/`, MAP: { - default: MAP_URL, - satellite: `${API_URL}/tiles/orthophoto/{z}/{x}/{y}.jpg`, - semiTransparent: SEMI_TRANSPARENT_MAP_URL, - bicycle: 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png', + default: MAP_URL, + satellite: 'https://tiles.stadtnavi.eu/orthophoto/{z}/{x}/{y}.jpg', + semiTransparent: SEMI_TRANSPARENT_MAP_URL, + bicycle: 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png', }, - STOP_MAP: `${API_URL}/map/v1/stop-map/`, - GEOCODING_BASE_URL: GEOCODING_BASE_URL, - CITYBIKE_MAP: `${API_URL}/map/v1/regiorad-map/` - }, - - appBarLink: false, - - availableLanguages: ['de', 'en'], - defaultLanguage: 'de', - - mainMenu: { + STOP_MAP: `${API_URL}/routing/v1/router/vectorTiles/stops/`, + DYNAMICPARKINGLOTS_MAP: `${API_URL}/routing/v1/router/vectorTiles/parking/`, + ROADWORKS_MAP: `${API_URL}/map/v1/cifs/`, + CITYBIKE_MAP: `${API_URL}/routing/v1/router/vectorTiles/citybikes/`, + BIKE_PARKS_MAP: `${API_URL}/routing/v1/router/vectorTiles/parking/`, + WEATHER_STATIONS_MAP: `${API_URL}/map/v1/weather-stations/`, + CHARGING_STATIONS_MAP: `${API_URL}/tiles/charging-stations/`, + PELIAS: `${process.env.GEOCODING_BASE_URL || GEOCODING_BASE_URL}/search`, + PELIAS_REVERSE_GEOCODER: `${ + process.env.GEOCODING_BASE_URL || GEOCODING_BASE_URL + }/reverse`, + PELIAS_PLACE: `${ + process.env.GEOCODING_BASE_URL || GEOCODING_BASE_URL + }/place`, + FONT: '' // Do not use Google fonts. + }, + + mainMenu: { showDisruptions: false, - }, - - logo: 'hb/stadtnavi-logo.svg', + }, - colors: { - primary: '#ff5300', - }, + availableLanguages: ['de', 'en'], + defaultLanguage: 'de', - socialMedia: { - title: APP_TITLE, + transportModes: { + rail: { + availableForSelection: true, + defaultValue: true, + }, + subway: { + availableForSelection: true, + defaultValue: true, + }, + }, + /* disable the "next" column of the Route panel as it can be confusing sometimes: https://github.com/stadtnavi/digitransit-ui/issues/167 */ + displayNextDeparture: false, + maxWalkDistance: 15000, + + optimize: "TRIANGLE", + + defaultSettings: { + optimize: "TRIANGLE", + safetyFactor: 0.4, + slopeFactor: 0.3, + timeFactor: 0.3, + }, + + defaultOptions: { + walkSpeed: [0.83, 1.38, 1.94], + }, + + itinerary: { + delayThreshold: 60, + }, + + appBarLink: { + name: 'Feedback', + href: 'https://stadtnavi.de/feedback', + target: '_blank' + }, + + contactName: { + de: 'transportkollektiv', + default: 'transportkollektiv', + }, + + sprites: 'assets/svg-sprite.hb.svg', + + bikeParks: { + show: true, + smallIconZoom: 14, + minZoom: 14 + }, + + cityBike: { + minZoomStopsNearYou: 10, + showStationId: false, + useSpacesAvailable: false, + showCityBikes: true, + networks: { + regiorad: { + icon: 'regiorad', + name: { + de: 'RegioRad', + en: 'RegioRad', + }, + type: 'citybike', + url: { + de: 'https://www.regioradstuttgart.de/de', + en: 'https://www.regioradstuttgart.de/', + }, + visibleInSettingsUi: true, + } + } + }, + + mergeStopsByCode: true, + + title: APP_TITLE, + + favicon: './app/configurations/images/hbnext/favicon.png', + + meta: { description: APP_DESCRIPTION, - }, + }, + + modeToOTP: { + carpool: 'CARPOOL', + }, - title: APP_TITLE, + logo: 'hbnext/stadtnavi-logo.svg', - textLogo: false, + GTMid: '', - feedIds: ['Reutlingen'], + // get newest version from: https://github.com/moment/moment-timezone/blame/develop/data/packed/latest.json + timezoneData: 'Europe/Berlin|CET CEST CEMT|-10 -20 -30|01010101010101210101210101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1o00 11A0 Qrc0 6i00 WM0 1fA0 1cM0 1cM0 1cM0 kL0 Nc0 m10 WM0 1ao0 1cp0 dX0 jz0 Dd0 1io0 17c0 1fA0 1a00 1ehA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|41e5', - searchParams: { - 'boundary.rect.min_lat': minLat, - 'boundary.rect.max_lat': maxLat, - 'boundary.rect.min_lon': minLon, - 'boundary.rect.max_lon': maxLon, - }, - - map: { + map: { useRetinaTiles: true, tileSize: 256, - zoomOffset: 0 - }, + zoomOffset: 0, + + showZoomControl: true, // DT-3470, DT-3397 + showStreetModeSelector: false, // DT-3470 + showLayerSelector: true, // DT-3470 + showStopMarkerPopupOnMobile: false, // DT-3470 + showScaleBar: true, // DT-3470, DT-3397 + genericMarker: { + popup: { + offset: [0,0], + maxWidth: 250, + minWidth: 250, + } + }, + attribution: { + 'default': '© OpenStreetMap Mitwirkende, Datensätze der NVBW GmbH und VVS GmbH', + 'satellite': '© OpenStreetMap Mitwirkende, © LGL BW, Datensätze der NVBW GmbH und VVS GmbH', + 'bicycle': '© OpenStreetMap Mitwirkende, © CyclOSM, © OSM-FR, Datensätze der NVBW GmbH und VVS GmbH', + }, + }, + + feedIds: ['hbg'], - areaPolygon: [ + searchSources: ['oa', 'osm'], + + searchParams: { + 'boundary.rect.min_lat': 48.34164, + 'boundary.rect.max_lat': 48.97661, + 'boundary.rect.min_lon': 9.95635, + 'boundary.rect.max_lon': 8.530883, + 'focus.point.lat': 48.5957, + 'focus.point.lon': 8.8675 + }, + + areaPolygon: [ [minLon, minLat], [minLon, maxLat], [maxLon, maxLat], [maxLon, minLat], - ], - - defaultEndpoint: { - address: 'Reutlingen', - lat: 0.5 * (minLat + maxLat), - lon: 0.5 * (minLon + maxLon), - }, - - defaultOrigins: [ - { - icon: 'icon-icon_bus', - label: 'ZOB Herrenberg', - lat: 48.5942066, - lon: 8.8644041, - }, - { - icon: 'icon-icon_star', - label: 'Krankenhaus', - lat: 48.59174, - lon: 8.87536, - }, - { - icon: 'icon-icon_star', - label: 'Waldfriedhof / Schönbuchturm', - lat: 48.6020352, - lon: 8.9036348, - }, - ], + ], + + nationalServiceLink: { name: 'Fahrplanauskunft efa-bw', href: 'https://www.efa-bw.de' }, - footer: { + defaultEndpoint: { + lat: 48.4929, + lon: 9.208, + }, + + + menu: { + copyright: { + label: `© Digitransit ${YEAR}` + }, content: [ - { label: `© Reutlingen ${walttiConfig.YEAR}` }, - {}, - { - name: 'about-this-service', - nameEn: 'About this service', - route: '/dieser-dienst', - icon: 'icon-icon_info', - }, ], - }, + }, - aboutThisService: { + aboutThisService: { de: [ - { - header: 'Über diesen Dienst', - paragraphs: [ - 'Stadtnavi ist eine Reiseplannungs-Anwendung für die Region Herrenberg. Dieser Dienst umfasst ÖPNV, Fußwege, Radverkehr, PKW-Routing (inklusive Park & Ride) und Fahrgemeinschaften.', - 'Gefördert durch
', - '', - 'Zur Infoseite' - ], - }, - { - header: 'Digitransit Plattform', - paragraphs: [ - 'Dieser Dienst basiert auf der Digitransit Platform und dem Backend-Dienst OpenTripPlanner. Alle Software ist unter einer offenen Lizenzen verfügbar. Vielen Dank an alle Beteiligten.', ], - }, - { - header: 'Datenquellen', - paragraphs: [ - 'Kartendaten: © OpenStreetMap Mitwirkende', - 'ÖPNV-Daten: Datensätze der NVBW GmbH und der VVS GmbH, Shapes (d.h. Geometrien der Streckenverläufe) jeweils angereichert mit OpenStreetMap-Daten © OpenStreetMap Mitwirkende', - 'Alle Angaben ohne Gewähr.' - ], - }, ], - fi: [ - { - header: 'Tietoja palvelusta', - paragraphs: [ - 'Tämän palvelun tarjoaa Reutlingen reittisuunnittelua varten Reutlingen alueella. Palvelu kattaa joukkoliikenteen, kävelyn, pyöräilyn ja yksityisautoilun rajatuilta osin. Palvelu perustuu Digitransit-palvelualustaan.', - ], - }, + en: [ ], + }, - sv: [ - { - header: 'Om tjänsten', - paragraphs: [ - 'Den här tjänsten erbjuds av Reutlingen för reseplanering inom Reutlingen region. Reseplaneraren täcker med vissa begränsningar kollektivtrafik, promenad, cykling samt privatbilism. Tjänsten baserar sig på Digitransit-plattformen.', - ], - }, - ], + redirectReittiopasParams: true, - en: [ - { - header: 'About this service', - paragraphs: [ - 'This service is provided by Reutlingen for route planning in Reutlingen region. The service covers public transport, walking, cycling, and some private car use. Service is built on Digitransit platform.', - ], - }, + showTicketInformation: false, + showTicketPrice: false, + displayFareInfoTop: false, + + showRouteSearch: false, + showNearYouButtons: false, + + // adding assets/geoJson/hb-layers layers + geoJson: { + layers: [ ], - }, - // geojson config: - - }); - ``` - + }, + staticMessagesUrl: STATIC_MESSAGE_URL, + + + suggestCarMinDistance: 800, + suggestWalkMaxDistance: 3000, + suggestBikeAndPublicMinDistance: 3000, + suggestBikeAndParkMinDistance: 3000, + + // live bus locations + vehicles: true, + showVehiclesOnSummaryPage: false, + showVehiclesOnStopPage: true, + + showBikeAndPublicItineraries: true, + showBikeAndParkItineraries: true, + showStopAndRouteSearch: false, + showTimeTableOptions: false, + + viaPointsEnabled: false, +}); + +``` + ### 6. Show results To start the application in production mode: @@ -364,4 +469,4 @@ Running stadtnavi instance in dev/prod mode: - more information [here](https://github.com/HSLdevcom/digitransit-ui/blob/master/docs/Docker.md) ### More information -visit: https://github.com/HSLdevcom/digitransit-ui \ No newline at end of file +visit: https://github.com/HSLdevcom/digitransit-ui diff --git a/02-otp-and-graph-building/Dockerfile b/02-otp-and-graph-building/Dockerfile index fcce8ab..7f1d3ae 100644 --- a/02-otp-and-graph-building/Dockerfile +++ b/02-otp-and-graph-building/Dockerfile @@ -4,8 +4,6 @@ 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 @@ -13,36 +11,23 @@ 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/ \ No newline at end of file +# +ENTRYPOINT java -Xmx$MEMORY -jar otp-shaded.jar --load --serve /opt/opentripplanner/build/ diff --git a/02-otp-and-graph-building/README.md b/02-otp-and-graph-building/README.md index 92a9f6f..3a3c988 100644 --- a/02-otp-and-graph-building/README.md +++ b/02-otp-and-graph-building/README.md @@ -1,5 +1,4 @@ -# stadtnavi Tutorial - OpenTripPlanner aufsetzen - +# stadtnavi Tutorial - OpenTripPlanner setup ## Building and running OpenTripPlanner with default config @@ -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 @@ -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. diff --git a/02-otp-and-graph-building/docker-compose.yml b/02-otp-and-graph-building/docker-compose.yml index cff4761..7141838 100644 --- a/02-otp-and-graph-building/docker-compose.yml +++ b/02-otp-and-graph-building/docker-compose.yml @@ -2,16 +2,8 @@ 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} @@ -19,8 +11,10 @@ services: - 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 diff --git a/02-otp-and-graph-building/otp-config.json b/02-otp-and-graph-building/otp-config.json new file mode 100644 index 0000000..7a16e4f --- /dev/null +++ b/02-otp-and-graph-building/otp-config.json @@ -0,0 +1,6 @@ +{ + "otpFeatures" : { + "SandboxAPILegacyGraphQLApi": true, + "SandboxAPIMapboxVectorTilesApi": true + } +} diff --git a/03-running-otp-and-digitransit/.env b/03-running-otp-and-digitransit/.env index c807a3e..d7f593a 100644 --- a/03-running-otp-and-digitransit/.env +++ b/03-running-otp-and-digitransit/.env @@ -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 diff --git a/03-running-otp-and-digitransit/Dockerfile b/03-running-otp-and-digitransit/Dockerfile index fcce8ab..0d3af73 100644 --- a/03-running-otp-and-digitransit/Dockerfile +++ b/03-running-otp-and-digitransit/Dockerfile @@ -4,8 +4,6 @@ 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 @@ -13,36 +11,23 @@ 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/ \ No newline at end of file +# +ENTRYPOINT java -Xmx$MEMORY -jar otp-shaded.jar --load --serve /opt/opentripplanner/build/ diff --git a/03-running-otp-and-digitransit/docker-compose.yml b/03-running-otp-and-digitransit/docker-compose.yml index 962a0dc..92a7c6a 100644 --- a/03-running-otp-and-digitransit/docker-compose.yml +++ b/03-running-otp-and-digitransit/docker-compose.yml @@ -5,8 +5,6 @@ services: image: stadtnavi/digitransit-proxy:minimal ports: - 8080:8080 - volumes: - - ${PWD}/logs:/var/log/nginx depends_on: - "opentripplanner" digitransit-ui: @@ -21,25 +19,11 @@ 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} @@ -47,8 +31,10 @@ services: - 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 diff --git a/03-running-otp-and-digitransit/otp-config.json b/03-running-otp-and-digitransit/otp-config.json new file mode 100644 index 0000000..7a16e4f --- /dev/null +++ b/03-running-otp-and-digitransit/otp-config.json @@ -0,0 +1,6 @@ +{ + "otpFeatures" : { + "SandboxAPILegacyGraphQLApi": true, + "SandboxAPIMapboxVectorTilesApi": true + } +} diff --git a/README.md b/README.md index 11e4fef..fa926cb 100644 --- a/README.md +++ b/README.md @@ -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.