aboutsummaryrefslogtreecommitdiff

Tracktrain

experimental, don't expect things to work for now

A thing to track trains via GPS (eventually), generating real-time data for use in e.g. passenger information systems. Timetables are read in via GTFS.

Server

I run a test-deployment of this at (tracktrain.stuebinm.eu)[https://tracktrain.stuebinm.eu].

API

It self-generates an OpenAPI description of the currently implemented routes at (/api/openapi)[https://tracktrain.stuebinm.eu/debug/openapi].

Metrics

It offers prometheus-compatible metrics under /metrics. Run the server with +RTS -T to also get metrics on the ghc runtime system (via the prometheus-metrics-ghc) package.

Routes

The entire app is written as a single monolithic webserver, so you might want to restrict access via a reverse-proxy: - /api must be public (otherwise tracking won't work) - /api/openapi is a self-description of the API endpoints - /obu is the onboard-unit for tracking - /metrics is a prometheus-compatible metrics endpoint - everything else (including /) is part of the admin interface

Packages & Modules

This project is split into a few haskell packages: - the tracktrain executable in app/, handling startup & config - the tracktrain library implementing the business logic in lib/ - the gtfs realtime library (generated with hprotoc from the gtfs realtime proto file, along with a very little glue code in Servant.GTFS.Realtime) in gtfs/ - that's it for now, but there'll probably be more