This repository provides a Helm-based Kubernetes deployment for running an Overpass API instance with custom code and regularly updated OSM data.
It supports running locally on a kind (Kubernetes in Docker) cluster, with Docker image building, loading, and deployment streamlined via a Makefile.
- Docker Desktop
- kind (Kubernetes in Docker)
- Helm
- wget
.
├── custom-code/ # Your custom Overpass scripts and configurations
├── overpass/ # Overpass API Docker build context
├── mounts/
│ ├── db/ # Persistent database storage
│ └── data/ # OSM data storage
├── helm/ # Helm chart for Kubernetes deployment
├── Makefile
└── README.md
All commands are available via the provided Makefile.
Copies custom code and downloads the latest PBF file:
make initRe-copies your custom code into the Overpass directory (useful after changes):
make copyDownloads the most recent OSM data (default: Missouri):
make download-pbfDefault URL:
https://download.geofabrik.de/north-america/us/missouri-latest.osm.bz2
Removes existing local database files:
make cleanBuilds the Overpass API Docker image:
make buildBuilds the image, loads it into kind, and deploys the Helm chart:
make installUninstalls the Helm release:
make uninstallThe following enviroment variables can be used to customize the setup:
OVERPASS_MODE- takes the value of eitherinitorclone. Defaults toclone.OVERPASS_META- (initmode only)yes,noorattic- passed to Overpass as--metaor--keep-attic.OVERPASS_PLANET_URL- (initmode only) url to a "planet" file (e.g. https://planet.openstreetmap.org/planet/planet-latest.osm.bz2)OVERPASS_CLONE_SOURCE- (clonemode only) the url to clone a copy of Overpass from. Defaults to https://dev.overpass-api.de/api_drolbr/, which uses minute diffs.OVERPASS_DIFF_URL- url to a diff directory for updating the instance (e.g. https://planet.openstreetmap.org/replication/minute/).OVERPASS_COMPRESSION- (initmode only) takes values ofno,gzorlz4. Specifies compression mode of the Overpass database. Defaults togz.OVERPASS_RULES_LOAD- integer, desired load from area generation. Controls the ratio of sleep to work. A value of 1 will make the system sleep 99x times longer than it works, a value of 50 will result in sleep and work in equal measure, and a value of 100 will only sleep 3 seconds between each execution. Defaults to 1.OVERPASS_UPDATE_SLEEP- integer, the delay between updates (seconds).OVERPASS_COOKIE_JAR_CONTENTS- cookie-jar compatible content to be used when fetching planet.osm files and updates.OVERPASS_PLANET_PREPROCESS- commands to be run before passing the planet.osm file toupdate_database, e.g. conversion from pbf to osm.bz2 using osmium.USE_OAUTH_COOKIE_CLIENT- set toyesif you want to use oauth_cookie_client to update cookies before each update. Settings are read from /secrets/oauth-settings.json. Read the documentation here.OVERPASS_FASTCGI_PROCESSES- number of fcgiwarp processes. Defaults to 4. Use higher values if you notice performance problems.OVERPASS_RATE_LIMIT- set the maximum allowed number of concurrent accesses from a single IP address.OVERPASS_TIME- set the maximum amount of time units (available time).OVERPASS_SPACE- set the maximum amount of RAM (available space) in bytes.OVERPASS_MAX_TIMEOUT- set the maximum timeout for queries (default: 1000s). Translates to send/recv timeout for fastcgi_wrap.OVERPASS_USE_AREAS- iffalseinitial area generation and the area updater process will be disabled. Defaulttrue.OVERPASS_HEALTHCHECK- shell commands to execute to verify that image is healthy.exit 1in case of failures,exit 0when container is healthy. Default healthcheck queries overpass and verifies that there is reponse returnedOVERPASS_STOP_AFTER_INIT- iffalsethe container will keep runing after init is complete. Otherwise container will be stopped after initialization process is complete. DefaulttrueOVERPASS_ALLOW_DUPLICATE_QUERIES- ifyes, duplicate queries (same query from the same IP address) will be allowed. Defaultno.
- Service Name:
api(oroverpass-serviceif changed in chart) - Type:
NodePort - Port: exposed on a random high port (check with
kubectl get svc)
After deploying:
kubectl get svcExample output:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
api NodePort 10.110.60.10 <none> 80:31416/TCP 2m
You can access it at:
http://localhost:<nodeport>/
In the above example:
http://localhost:31416/api/interpreter
Or use port-forwarding (recommended for local development):
kubectl port-forward svc/api 8080:80Then access at:
http://localhost:8080/api/interpreter
make init
make build
kind load docker-image overpass-k8s:latest
make install
kubectl get svcVisit the API endpoint at
http://localhost:<nodeport>/api/interpreter.
- Run
make download-pbfperiodically to update the OSM data. - Use
make cleanto reset the database if needed. - Use
make uninstallto remove the Helm deployment from your kind cluster.