nominatim
by robjuz
A Helm chart for Kubernetes
About this chart
Nominatim
Nominatim is a tool (an API) to search OSM data by name and address and to generate synthetic addresses of OSM points (reverse geocoding).
TL;DR
helm repo add robjuz https://robjuz.github.io/helm-charts/
helm install nominatim robjuz/nominatim
Introduction
This chart bootstraps a Nominatim deployment on a Kubernetes cluster using the Helm package manager.
It also packages a Bitnami PostgreSQL chart which is required for bootstrapping a PostgreSQL deployment for the database requirements of the Nominatim application.
This chart has been tested to work with NGINX Ingress and cert-manager on top of the MicroK8s.
Prerequisites
- Kubernetes 1.12+ (ingress requires 1.19+)
- Helm 3.1.0
- PV provisioner support in the underlying infrastructure
- ReadWriteMany volumes for deployment scaling and flatnode support
Installing the Chart
The installation consist of 2 steps
- Initialisation
- App deployment
Initialisation
SetinitJob.enabled: true
During the initialization, all required data are downloaded and the database is build. To improve the import speed you can set additional PostgreSQL params
initJob:
enabled: true
postgresql:
primary:
extendedConfiguration: |
shared_buffers = 2GB
maintenance_work_mem = 10GB
autovacuum_work_mem = 2GB
work_mem = 50MB
effective_cache_size = 24GB
synchronous_commit = off
max_wal_size = 1GB
checkpoint_timeout = 10min
checkpoint_completion_target = 0.9
fsync = off
full_page_writes = off
To install the chart with the release name nominatim:
helm upgrade --install nominatim robjuz/nominatim -f values.yaml
App deployment
You need to set initJob.enabled: false
You also should remove the postgresql.primary.extendedConfiguration
initJob:
enabled: false
To install the chart with the release name nominatim:
helm upgrade --install nominatim robjuz/nominatim -f values.yaml
Uninstalling the Chart
To uninstall/delete the nominatim deployment:
helm delete nominatim
The command removes all the Kubernetes components associated with the chart and deletes the release, but the imported data still remains.
Removing persisted data
For a total uninstallation of nomination, a data removal is necessary. To do so, first of all, you need to search for the right persistence volume. To identify it, you need to type de command below, and search for a volume containing the helm release name.
kubectl get pvc
You'll receive an output similar to:
| NAME | STATUS | VOLUME | CAPACITY | ACCESS MODES | STORAGECLASS | AGE |
|---|---|---|---|---|---|---|
| data-nominatim-postgresql-0 | Bound | pvc-b450c62d-d888-4869-9568-298e6d10b597 | 500Gi | RWO | standard | 3d1h |
Once you found the correct PVC, you just need to type de command to delete it:
kubectl delete pvc data-nominatim-postgresql-0
Or, you may use a single command for both operation, like following:
kubectl delete pvc -l app.kubernetes.io/instance=nominatim
Note: The command above may differ a little depending the k8s cluster version you're using.
Removing persisted data
For a total uninstallation of nomination, a data removal is necessary. To do so, first of all, you need to search for the right persistence volume. To identify it, you need to type de command below, and search for a volume containing the helm release name.
kubectl get pvc
You'll receive an output similar to:
| NAME | STATUS | VOLUME | CAPACITY | ACCESS MODES | STORAGECLASS | AGE |
|---|---|---|---|---|---|---|
| data-nominatim-postgresql-0 | Bound | pvc-b450c62d-d888-4869-9568-298e6d10b597 | 500Gi | RWO | standard | 3d1h |
Once you found the correct PVC, you just need to type de command to delete it:
kubectl delete pvc data-nominatim-postgresql-0
Or, you may use a single command for both operation, like following:
kubectl delete pvc -l app.kubernetes.io/instance=nominatim
Note: The command above may differ a little depending the k8s cluster version you're using.
Parameters
Global parameters
| Name | Description | Value |
|---|---|---|
global.imageRegistry | Global Docker image registry | "" |
global.imagePullSecrets | Global Docker registry secret names as an array | [] |
global.storageClass | Global StorageClass for Persistent Volume(s) | "" |
Common parameters
| Name | Description | Value |
|---|---|---|
kubeVersion | Override Kubernetes version | "" |
nameOverride | String to partially override common.names.fullname template (will maintain the release name) | "" |
fullnameOverride | String to fully override common.names.fullname template | "" |
commonLabels | Labels to add to all deployed resources | {} |
commonAnnotations | Annotations to add to all deployed resources | {} |
clusterDomain | Kubernetes Cluster Domain | cluster.local |
extraDeploy | Array of extra objects to deploy with the release | [] |
diagnosticMode.enabled | Enable diagnostic mode (all probes will be disabled and the command will be overridden) | false |
diagnosticMode.command | Command to override all containers in the deployment | ["sleep"] |
diagnosticMode.args | Args to override all containers in the deployment |
Nominatim Image parameters
| Name | Description | Value |
|---|---|---|
image.registry | Nominatim image registry | docker.io |
image.repository | Nominatim image repository | mediagis/nominatim |
image.tag | Nominatim image tag (immutable tags are recommended) | 4.4 |
image.digest | Nominatim image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | "" |
image.pullPolicy | Nominatim image pull policy | IfNotPresent |
image.pullSecrets | Nominatim image pull secrets | [] |
image.debug | Specify if debug values should be set |
Nominatim Initialisation Configuration parameters
| Name | Description | Value |
|---|---|---|
initJob.enabled | enable/disable init job | false |
initJob.pbfUrl | URL of the pbf file to import | https://download.geofabrik.de/europe/germany/sachsen-latest.osm.pbf |
initJob.importWikipedia | If additional Wikipedia/Wikidata rankings should be importe | false |
initJob.wikipediaUrl | Wikipedia/Wikidata rankings file URL | https://nominatim.org/data/wikimedia-importance.sql.gz |
initJob.importGB_Postcode | If external GB postcodes should be imported | false |
initJob.importUS_Postcode | If external US postcodes should be imported | false |
initJob.importStyle | Nominatim import style | full |
initJob.customStyleUrl | Custom import style file URL | nil |
initJob.threads | The number of thread used by the import | 16 |
initJob.dbWaitTimeout | The number of seconds to wait for the DB to be ready to accept connections | 300 |
initJob.extraEnvVars | Array with extra environment variables to add to the container | [] |
initJob.extraVolumeMounts | Optionally specify extra list of additional volumeMounts for container(s) | [] |
initJob.extraVolumes | Optionally specify extra list of additional volumes for initJob pods | [] |
Nominatim Initialisation Deployment parameters
| Name | Description | Value |
|---|---|---|
initJob.resources | Define resources requests and limits for the init container | {} |
initJob.persistence.enabled | Enable persistence using Persistent Volume Claims | false |
initJob.persistence.storageClass | Persistent Volume storage class | nil |
initJob.persistence.accessModes | Persistent Volume access modes | [ReadWriteOnce] |
initJob.persistence.size | Persistent Volume size | 100Gi |
initJob.persistence.dataSource | Custom PVC data source | {} |
initJob.persistence.existingClaim | The name of an existing PVC to use for flatnode | nil |
initJob.persistence.selector |
Deploy nominatim with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has nominatim on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartnominatim is pinned at v6.5.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply