Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample k8s deployment and Doker image for own photon image #621

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/photon/Dokerimage/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM openjdk:24-slim-bullseye

# Install pbzip2 for parallel extraction
RUN apt update && apt-get upgrade -y && \
apt-get -y install wget bzip2 curl vim && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

WORKDIR /photon
ADD https://github.com/komoot/photon/releases/download/0.6.0/photon-0.6.0.jar /photon/photon.jar
COPY entrypoint.sh ./entrypoint.sh
RUN chmod +x ./entrypoint.sh
VOLUME /photon/photon_data
EXPOSE 2322

ENTRYPOINT ["/photon/entrypoint.sh"]
23 changes: 23 additions & 0 deletions docs/photon/Dokerimage/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash


# Download elasticsearch index
if [ ! -d "/photon/photon_data/elasticsearch" ]; then
echo "Downloading search index"

# Let graphhopper know where the traffic is coming from
USER_AGENT="docker: dawarich/photon-geocoder"
# If you want to install a specific region only, enable the line below and disable the current 'wget' row.
# Take a look at http://download1.graphhopper.com/public/extracts/by-country-code for your country
# wget --user-agent="$USER_AGENT" -O - http://download1.graphhopper.com/public/extracts/by-country-code/nl/photon-db-nl-latest.tar.bz2 | bzip2 -cd | tar x
wget --user-agent="$USER_AGENT" -O - http://download1.graphhopper.com/public/photon-db-latest.tar.bz2 | bzip2 -cd | tar x
fi

# Start photon if elastic index exists
if [ -d "/photon/photon_data/elasticsearch" ]; then
echo "Start photon"
java -jar photon.jar $@
else
echo "Could not start photon, the search index could not be found"
fi
while true; do sleep 1; done;
10 changes: 10 additions & 0 deletions docs/photon/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Own Photon instance deployment

The Dawarich utilises reverse geodata and a default Poton instance is [Komoot.oi](https://photon.komoot.io) that is throttled to 1 request per second. That makes decoding millions of records time consuming. The Dawarich can be configured to use your own Photon instance by setting the `PHOTON_URL` environment variable.

This folder contains Dockerfile and sample Kubernetes deployment. About 200Gb of persistenet storage is reqired.

##Building
```bash
docker build -t photon .
```
30 changes: 30 additions & 0 deletions docs/photon/k8s/photon-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: photon
namespace: dawarich
labels:
app: photon
spec:
replicas: 1
selector:
matchLabels:
app: photon
template:
metadata:
labels:
app: photon
containers:
- name: photon
image: your-registry/photon:latest
ports:
- containerPort: 2322
volumeMounts:
- name: photon-data
mountPath: /photon/photon_data
volumes:
- name: photon-data
persistentVolumeClaim:
claimName: photon-data
imagePullSecrets:
- name: my-private-registry
15 changes: 15 additions & 0 deletions docs/photon/k8s/photon-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: dawarich
name: photon-data
labels:
storage.k8s.io/name: longhorn
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 200Gi
15 changes: 15 additions & 0 deletions docs/photon/k8s/photon-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: v1
kind: Service
metadata:
namespace: dawarich
labels:
service: photon
name: photon
spec:
ports:
- protocol: TCP
port: 80
targetPort: 2322
selector:
app: photon