A Docker-based OpenTripPlanner (OTP) server for public transit routing. Part of the Trufi Association transit stack.
- Docker and Docker Compose
- A GTFS file (
.zip) with your transit data - A PBF file (OpenStreetMap extract) for your area
- GTFS: Create with trufi-gtfs-builder or download from transit agencies
- PBF: Download from Geofabrik
./init.sh --gtfs /path/to/gtfs.zip --pbf /path/to/region.osm.pbfOptions:
--gtfs <path>- Path to GTFS file (.zip)--pbf <path>- Path to OSM PBF file (.osm.pbf)--version <ver>- OTP version (default: 2.8.1)
docker-compose upThe first run builds the routing graph from your data (this takes a few minutes). Subsequent runs load the cached graph.
- API: http://localhost:8080/otp/
- GraphiQL: http://localhost:8080/graphiql (OTP 2.x only)
| Version | Java | Notes |
|---|---|---|
| 2.8.1 | 21 | Latest stable (recommended) |
| 2.7.0 | 21 | |
| 2.4.0 | 21 | |
| 2.2.0 | 21 | |
| 2.0.0 | 11 | |
| 1.5.0 | 11 | Legacy, REST API only |
Default memory is 2GB. For larger datasets, set in .env:
JAVA_MAX_MEMORY=-Xmx8GSet in .env (created by init.sh):
otpversion=2.8.1trufi-server-otp/
├── Dockerfiles/ # OTP version configurations
│ ├── 1.5.0/
│ ├── 2.0.0/
│ ├── 2.2.0/
│ ├── 2.4.0/
│ ├── 2.7.0/
│ └── 2.8.1/
├── data/ # Your data files (gitignored)
│ ├── *.gtfs.zip # GTFS file
│ ├── *.osm.pbf # PBF file
│ └── graph.obj # Generated graph (cached)
├── docker-compose.yml
├── init.sh # Setup script
├── trufi-proxy.json # trufi-server integration
└── .env # Configuration
This service integrates with trufi-server. The trufi-proxy.json file provides the configuration needed for automatic service discovery.
After updating GTFS data:
rm data/graph.obj
docker-compose updocker-compose logs -fdocker-compose down| Endpoint | Description |
|---|---|
/otp/ |
API root |
/graphiql |
GraphQL IDE |
/otp/gtfs/v1 |
GTFS GraphQL API |
/otp/routers/default/index/graphql |
Legacy GraphQL API |
Increase JAVA_MAX_MEMORY in .env. Large cities may need 4-8GB.
- Validate GTFS with GTFS Validator
- Ensure PBF file covers GTFS stop locations
Check logs: docker-compose logs -f