Nominatim on kubernetes? #463
Replies: 5 comments
-
Some people deploy to kubernetes but what you're planning sounds like the most advanced version i've heard yet. We would love to add it to the documentation when you've completed it. |
Beta Was this translation helpful? Give feedback.
-
Maybe what I'm trying to do is overkill, but I think it can be done:
|
Beta Was this translation helpful? Give feedback.
-
@dlucia i think it's a cool idea. When I have more time I will write a spec. |
Beta Was this translation helpful? Give feedback.
-
I made a simple statefullSet that has a init container for indexing and then starts serving. This way you can set different resource limits for the initial process. Would be nice if there was a apiVersion: v1
kind: ConfigMap
metadata:
name: nominatim-config
data:
PBF_URL: "https://download.geofabrik.de/europe/monaco-latest.osm.pbf"
REPLICATION_URL: "https://download.geofabrik.de/europe/monaco-updates/"
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: nominatim
spec:
serviceName: "nominatim"
replicas: 2
selector:
matchLabels:
app: nominatim
template:
metadata:
labels:
app: nominatim
spec:
initContainers:
- name: nominatim-init
image: mediagis/nominatim:4.2
envFrom:
- configMapRef:
name: nominatim-config
volumeMounts:
- name: nominatim-db
mountPath: /var/lib/postgresql/14/main
- name: nominatim-other
mountPath: /nominatim
command:
- "/bin/bash"
- "-ex"
- "-c"
args:
- |
tailpid=0
replicationpid=0
stopServices() {
service apache2 stop
service postgresql stop
kill $replicationpid
kill $tailpid
}
trap stopServices SIGTERM TERM INT
/app/config.sh
if id nominatim >/dev/null 2>&1; then
echo "user nominatim already exists"
else
useradd -m -p ${NOMINATIM_PASSWORD} nominatim
fi
IMPORT_FINISHED=/var/lib/postgresql/14/main/import-finished
if [ ! -f ${IMPORT_FINISHED} ]; then
/app/init.sh
touch ${IMPORT_FINISHED}
else
chown -R nominatim:nominatim ${PROJECT_DIR}
fi
containers:
- name: nominatim
image: mediagis/nominatim:4.2
ports:
- containerPort: 8080
envFrom:
- configMapRef:
name: nominatim-config
volumeMounts:
- name: nominatim-db
mountPath: /var/lib/postgresql/14/main
- name: nominatim-other
mountPath: /nominatim
readinessProbe:
httpGet:
path: /status
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
livenessProbe:
httpGet:
path: /status
port: 8080
initialDelaySeconds: 10
periodSeconds: 15
resources:
requests:
cpu: 400m
memory: 750M
limits:
memory: 2000M
volumeClaimTemplates:
- metadata:
name: nominatim-db
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 10Gi
- metadata:
name: nominatim-other
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
name: nominatim
spec:
type: ClusterIP
selector:
app: nominatim
ports:
- protocol: TCP
port: 8080
targetPort: 8080 It would also be nice if all files including database would line in one location such as |
Beta Was this translation helpful? Give feedback.
-
I recommend checking out https://github.com/robjuz/helm-charts/tree/99a5d1e47150ef9f57066116ebbeea1872c0cdca/charts/nominatim |
Beta Was this translation helpful? Give feedback.
-
So I want to deploy Nominatim on a Kubernetes cluster. I created the following yaml spec to do this:
This works, it creates a replica that starts downloading the pbf file and then starts populating the postgresdb. But this is far from optimal because the pbf file downloaded and the db is populated everytime the cluster is restarted or a new replica is created.
What I would like to do:
Has anyone done this before? Is there something out there that does this?
Beta Was this translation helpful? Give feedback.
All reactions