Deploy Valhalla

Self-hosted OSM routing: routes, matrices, isochrones, map matching

Deploy Valhalla

/custom_files

Deploy and Host Valhalla on Railway

Valhalla is an open-source routing engine for OpenStreetMap data. This template runs it on Railway backed by a persistent volume, serving turn-by-turn routes, time and distance matrices, isochrones and map matching over any region you point it at.

About Hosting Valhalla

Valhalla first builds routing tiles from an OpenStreetMap extract, then serves them over HTTP. Doing that on Railway takes three adjustments, all handled here: the service binds Railway's $PORT rather than the hardcoded 8002; a dual-stack listener fronts the router, because Valhalla's zmq socket cannot bind IPv6 while Railway's private network is IPv6-only; and worker threads default to 1, since a container reads the host core count and would otherwise spawn 32+ tile-caching workers and run out of memory. Tiles live on a volume at /custom_files, so they survive redeploys instead of being rebuilt each time.

First boot builds tiles before accepting traffic - about a minute for Monaco, tens of minutes for a country, hours for a continent. The deployment log is the progress bar. Leave the healthcheck path empty; any healthcheck window is shorter than a real first build.

Common Use Cases

  • Time and distance matrices for fleet routing and vehicle optimisation (VROOM, OR-Tools, your own solver)
  • Turn-by-turn directions, ETAs and isochrones for your own app, with no per-request API fees
  • Map matching raw GPS traces onto the road network

Dependencies for Valhalla Hosting

  • A volume mounted at /custom_files
  • An OpenStreetMap .osm.pbf extract for the region you want to route over

Deployment Dependencies

Implementation Details

Stock Valhalla rejects any matrix past 20 locations and exposes no environment variable to change it, so this template patches the generated valhalla.json on every boot. Defaults are 500 locations and 250,000 source-target pairs, both configurable.

Why Deploy Valhalla on Railway?

Railway turns a multi-step tile build into a one-click deploy with a persistent volume attached. Other services in the same project reach the router over private networking at no egress cost, which makes it a natural backend for a solver or an API of your own.


Template Content

More templates in this category

View Template
Rocky Linux
Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
47
View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
71
View Template
Letta Code Remote
Run a Letta Code agent 24/7. No inbound ports, just deploy.

Letta
51