Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure vehicle positions #80

Merged
merged 6 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ a list of common `journalctl` commands.
- Viewing digitransit-ui logs: `journalctl CONTAINER_NAME=digitransit-ui-hbnext`
- Viewing opentripplanner logs: `journalctl CONTAINER_NAME=opentripplanner`
- Viewing graph-build logs: `journalctl -u graph-build`
- Viewing POI import logs: `journalctl -u poi-import`
- Viewing weather stations import logs: `journalctl -u import-weather-stations`
- Viewing vehicle position forwarder logs: `journalctl -u gtfsrt2mqtt`

**Triggering a rebuild of the OTP graph**

Expand Down
20 changes: 20 additions & 0 deletions docs/vehicle-positions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Vehicle positions

The vehicle positions are sent to Digitransit through a chain of services which are drawn in the following
diagram:

![vehicle positions diagram](vehicle-positions.png)

Originally, the data is provided by VVS and picked up by a GTFS-RT-to-MQTT bridge. This then
publishes the data onto a MQTT broker (Mosquitto) which makes them available through a series
of topics.

Digitransit can cannot to the MQTT broker via Websockets and subscribe to the data. Depending
on the exact poll frequency, it may take a few seconds until data really appears in the app.

If you want to look at the raw MQTT topic you can do the following:

```sh
npm install -g mqtt
mqtt subscribe -h vehiclepositions.stadtnavi.eu -p 443 -l wss -v -t "#" -i my-client
```
Binary file added docs/vehicle-positions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion group_vars/infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,17 @@ poi_postgres_password: !vault |
6539316338353964333762366332383338626532616137653036

poi_domain: "features.stadtnavi.eu"
api_hostname: "api.dev.stadtnavi.eu"

api_hostname: "api.dev.stadtnavi.eu"
### GTFS-RT VP to MQTT bridge

# domain for the Websocket endpoint that the Digitransit instances connect to
mqtt_domain: "vehiclepositions.stadtnavi.eu"
# domain of the OTP instance where the GTFS-RT to MQTT bridge gets route color information from
# you probably want to set it to prod when we deploy to that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the mqtt_otp_domain required for? What is necessary, one we deploy to prod?
Could you provide some documentation regarding the mqtt setup, please?

mqtt_otp_domain: "api.dev.stadtnavi.eu"
# the feed where the GTFS-RT VP data is polled from
mqtt_vehicle_position_feed: "https://gtfsr-vehpos.vvs.de/gtfsr-vehpos/vp"
# the feed ID to be used to construct the MQTT topic
# this must also match Digitransit config
mqtt_feed_id: hbg
1 change: 1 addition & 0 deletions infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
- leonardehrenfried.baseline.nominatim
- leonardehrenfried.baseline.photon
- leonardehrenfried.baseline.photon_new
- leonardehrenfried.baseline.vehicle_positions
2 changes: 1 addition & 1 deletion requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ collections:
#- source: ../../ansible-baseline
# type: dir
- name: leonardehrenfried.baseline
version: 1.8.6
version: 1.9.3

roles:
- src: geerlingguy.docker
Expand Down
Loading