Download an OpenStreetMap data file, for example from https://download.geofabrik.de/europe.html. Store the file as data/data.osm.pbf
(you can customize the filename with OSM2PGSQL_DATAFILE
).
Import the data:
docker compose run --build import import
The import process will filter the file before importing it. The filtered file will be stored in the data/filtered
directory, so future imports of the same data file can reuse the filtered data file.
Start the tile server:
docker compose up --build martin
Prepare and start the API:
api/prepare-api.sh
docker compose up api
Start the web server:
docker compose up --build martin-proxy
The OpenRailwayMap is now available on http://localhost:8000.
To ease development, Docker Compose can automatically rebuild containers when dependent files change. Enable watch mode with:
docker compose watch
Import the data:
docker compose run --build import import
Build the tiles:
export BBOX='-11.3818,35.8891,25.0488,70.0'
for tile in low-med high standard speed signals electrification; do
env "TILES=$tile" docker compose up martin-cp
done
Build and deploy the tile server:
flyctl deploy --config martin-static.fly.toml --local-only
Build and deploy the API:
api/prepare-api.sh
flyctl deploy --config api.fly.toml --local-only api
Build and deploy the caching proxy:
flyctl deploy --config proxy.fly.toml --local-only
The OpenRailwayMap is now available on https://openrailwaymap.fly.dev.
Tests use hurl.
Run tests against the API:
hurl --test --verbose --variable base_url=http://localhost:5000/api api/test/api.hurl
Run tests against the proxy:
hurl --test --verbose --variable base_url=http://localhost:8000 proxy/test/proxy.hurl
Run tests against the tiles:
hurl --test --verbose --variable base_url=http://localhost:3000 tiles/test/tiles.hurl
The YAML files in the features
directory are templated into SQL and Lua code.
You can view the generated files:
docker build --target build-signals --tag build-signals --file import/Dockerfile . \
&& docker run --rm --entrypoint cat build-signals /build/signals_with_azimuth.sql | less
docker build --target build-lua --tag build-lua --file import/Dockerfile . \
&& docker run --rm --entrypoint cat build-lua /build/tags.lua | less
docker build --target build-styles --tag build-styles --file proxy.Dockerfile . \
&& docker run --rm --entrypoint ls build-styles
docker build --target build-styles --tag build-styles --file proxy.Dockerfile . \
&& docker run --rm --entrypoint cat build-styles standard.json | jq . | less