Skip to content

Commit b33597b

Browse files
authored
Update Nominatim config and update Github actions for chartpress (#362)
* Add nominatim-ui config * Update pathType to Exact * Refactor nominatim to suport ui and api * Update paths and remane files for nominatim ui and api * Update ubuntu version to run chartpress * Update github action to create docker images * Update release versions * Remove name from version * Fix version format * Update github actions
1 parent bd2f7b9 commit b33597b

File tree

7 files changed

+163
-79
lines changed

7 files changed

+163
-79
lines changed

.github/workflows/chartpress.yaml

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,46 @@ name: Chartpress Publish
22
on: push
33
jobs:
44
build:
5-
runs-on: ubuntu-20.04
5+
runs-on: ubuntu-22.04
66
steps:
7-
- uses: actions/checkout@v1
8-
- name: Login to DockerHub
9-
uses: docker/login-action@v1
10-
with:
11-
username: ${{ secrets.DOCKER_USERNAME }}
12-
password: ${{ secrets.DOCKER_PASSWORD }}
13-
- name: Setup python
14-
uses: actions/setup-python@v2
15-
with:
16-
python-version: '3.6'
17-
- name: Setup git
18-
run: git config --global user.email "[email protected]" && git config --global user.name "Github Action"
19-
- name: Install Chartpress and some python modules
20-
run: |
21-
pip install -v chartpress && pip install six && pip install yq
22-
- name: Set env vars for publish charts
23-
run: |
24-
GIT_BRANCH_NAME=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
25-
GIT_BRANCH_NAME=${GIT_BRANCH_NAME/\//_}
26-
OSM_SEED_VERSION=$(yq -r .appVersion ./osm-seed/Chart.yaml)
27-
SHORT_GITHUB_SHA=${GITHUB_SHA::7}
28-
echo "GIT_BRANCH_NAME=$GIT_BRANCH_NAME" >> $GITHUB_ENV
29-
echo "OSM_SEED_VERSION=$OSM_SEED_VERSION" >> $GITHUB_ENV
30-
echo "SHORT_GITHUB_SHA=$SHORT_GITHUB_SHA" >> $GITHUB_ENV
31-
- name: Run Chartpress
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
34-
GITHUB_EVENT_NAME: ${{ github.event_name }}
35-
run: |
36-
if [[ $GIT_BRANCH_NAME = "main" ]]
37-
then
38-
chartpress --push --publish-chart --tag ${OSM_SEED_VERSION}
39-
elif [[ $GIT_BRANCH_NAME = "develop" ]]
40-
then
41-
chartpress --push --publish-chart --tag ${OSM_SEED_VERSION}-dev.h$SHORT_GITHUB_SHA
42-
else
43-
chartpress --push --publish-chart
44-
fi
7+
- uses: actions/checkout@v3
8+
- name: Login to DockerHub
9+
uses: docker/login-action@v2
10+
with:
11+
username: ${{ secrets.DOCKER_USERNAME }}
12+
password: ${{ secrets.DOCKER_PASSWORD }}
13+
- name: Setup Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.11'
17+
- name: Setup Git
18+
run: |
19+
git config --global user.email "[email protected]"
20+
git config --global user.name "Github Action"
21+
- name: Install Chartpress and Python modules
22+
run: |
23+
pip install -v chartpress six yq
24+
- name: Set env vars for publish charts
25+
run: |
26+
GIT_BRANCH_NAME=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
27+
GIT_BRANCH_NAME=${GIT_BRANCH_NAME/\//_}
28+
OSM_SEED_VERSION=$(yq -r .appVersion ./osm-seed/Chart.yaml)
29+
SHORT_GITHUB_SHA=${GITHUB_SHA::7}
30+
echo "GIT_BRANCH_NAME=$GIT_BRANCH_NAME" >> $GITHUB_ENV
31+
echo "OSM_SEED_VERSION=$OSM_SEED_VERSION" >> $GITHUB_ENV
32+
echo "SHORT_GITHUB_SHA=$SHORT_GITHUB_SHA" >> $GITHUB_ENV
33+
- name: Run Chartpress
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
36+
GITHUB_EVENT_NAME: ${{ github.event_name }}
37+
run: |
38+
if [[ $GIT_BRANCH_NAME = "main" ]]
39+
then
40+
chartpress --push --publish-chart --tag ${OSM_SEED_VERSION}
41+
elif [[ $GIT_BRANCH_NAME = "develop" ]]
42+
then
43+
chartpress --push --publish-chart --tag ${OSM_SEED_VERSION}-dev.h$SHORT_GITHUB_SHA
44+
else
45+
chartpress --push --publish-chart
46+
fi
47+

osm-seed/templates/nominatim-api/nominatim-api-ingress.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{{- if and .Values.nominatimApi.enabled (eq .Values.serviceType "ClusterIP") }}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: {{ template "osm-seed.fullname" . }}-ingress-nominatim-api
6+
annotations:
7+
kubernetes.io/ingress.class: nginx
8+
cert-manager.io/cluster-issuer: letsencrypt-prod-issuer
9+
nginx.ingress.kubernetes.io/proxy-body-size: 5m
10+
spec:
11+
ingressClassName: nginx
12+
tls:
13+
- hosts:
14+
{{- if .Values.nominatimApi.ingressDomain }}
15+
- {{ .Values.nominatimApi.ingressDomain }}
16+
{{- else }}
17+
- nominatim-api.{{ .Values.domain }}
18+
{{- end }}
19+
secretName: {{ template "osm-seed.fullname" . }}-secret-nominatim
20+
rules:
21+
- host: {{ if .Values.nominatimApi.ingressDomain }}{{ .Values.nominatimApi.ingressDomain }}{{ else }}nominatim-api.{{ .Values.domain }}{{ end }}
22+
http:
23+
{{- if .Values.nominatimUI.enabled }}
24+
paths:
25+
# Routes to the API
26+
- path: /search.php
27+
pathType: ImplementationSpecific
28+
backend:
29+
service:
30+
name: {{ .Release.Name }}-nominatim-api
31+
port:
32+
number: 80
33+
- path: /reverse.php
34+
pathType: ImplementationSpecific
35+
backend:
36+
service:
37+
name: {{ .Release.Name }}-nominatim-api
38+
port:
39+
number: 80
40+
- path: /status.php
41+
pathType: ImplementationSpecific
42+
backend:
43+
service:
44+
name: {{ .Release.Name }}-nominatim-api
45+
port:
46+
number: 80
47+
# Fallback route for static UI
48+
- path: /
49+
pathType: Prefix
50+
backend:
51+
service:
52+
name: {{ .Release.Name }}-nominatim-ui
53+
port:
54+
number: 80
55+
{{- else }}
56+
paths:
57+
- path: /
58+
pathType: Prefix
59+
backend:
60+
service:
61+
name: {{ .Release.Name }}-nominatim-api
62+
port:
63+
number: 80
64+
{{- end }}
65+
{{- end }}
File renamed without changes.

osm-seed/templates/nominatim-api/nominatim-api-service.yaml renamed to osm-seed/templates/nominatim-api/nominatim-service.yaml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: v1
33
kind: Service
44
metadata:
5-
name: {{ template "osm-seed.fullname" . }}-nominatim-api
5+
name: {{ .Release.Name }}-nominatim-api
66
labels:
77
app: {{ template "osm-seed.name" . }}
88
component: nominatim-api-service
@@ -29,7 +29,7 @@ spec:
2929
- port: 80
3030
protocol: TCP
3131
name: http
32-
targetPort: apache
32+
targetPort: api
3333
- port: 5432
3434
protocol: TCP
3535
name: postgres
@@ -43,5 +43,28 @@ spec:
4343
selector:
4444
app: {{ template "osm-seed.name" . }}
4545
release: {{ .Release.Name }}
46-
run: {{ .Release.Name }}-nominatim-api
46+
run: {{ .Release.Name }}-nominatim
47+
{{- end }}
48+
---
49+
{{- if and .Values.nominatimApi.enabled .Values.nominatimUI.enabled }}
50+
apiVersion: v1
51+
kind: Service
52+
metadata:
53+
name: {{ .Release.Name }}-nominatim-ui
54+
labels:
55+
app: {{ template "osm-seed.name" . }}
56+
component: nominatim-ui-service
57+
environment: {{ .Values.environment }}
58+
release: {{ .Release.Name }}
59+
spec:
60+
type: ClusterIP
61+
ports:
62+
- port: 80
63+
name: http
64+
protocol: TCP
65+
targetPort: ui
66+
selector:
67+
app: {{ template "osm-seed.name" . }}
68+
release: {{ .Release.Name }}
69+
run: {{ .Release.Name }}-nominatim
4770
{{- end }}

osm-seed/templates/nominatim-api/nominatim-api-statefulset.yaml renamed to osm-seed/templates/nominatim-api/nominatim-statefulset.yaml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: apps/v1
33
kind: StatefulSet
44
metadata:
5-
name: {{ .Release.Name }}-nominatim-api
5+
name: {{ .Release.Name }}-nominatim
66
labels:
77
app: {{ template "osm-seed.name" . }}
88
component: nominatim-api-statefulset
@@ -14,24 +14,24 @@ spec:
1414
matchLabels:
1515
app: {{ template "osm-seed.name" . }}
1616
release: {{ .Release.Name }}
17-
run: {{ .Release.Name }}-nominatim-api
18-
serviceName: {{ .Release.Name }}-nominatim-api
17+
run: {{ .Release.Name }}-nominatim
18+
serviceName: {{ .Release.Name }}-nominatim
1919
template:
2020
metadata:
2121
labels:
2222
app: {{ template "osm-seed.name" . }}
2323
release: {{ .Release.Name }}
24-
run: {{ .Release.Name }}-nominatim-api
24+
run: {{ .Release.Name }}-nominatim
2525
spec:
2626
priorityClassName: {{ .Release.Name }}-{{ .Values.nominatimApi.priorityClass | default "medium-priority" }}
2727
containers:
28-
- name: {{ .Chart.Name }}-nominatim-api
28+
- name: nominatim-api
2929
image: "{{ .Values.nominatimApi.image.name }}:{{ .Values.nominatimApi.image.tag }}"
3030
ports:
3131
- name: postgres
3232
containerPort: 5432
3333
protocol: TCP
34-
- name: apache
34+
- name: api
3535
containerPort: 8080
3636
protocol: TCP
3737
env:
@@ -97,6 +97,21 @@ spec:
9797
cpu: {{ .Values.nominatimApi.resources.limits.cpu }}
9898
{{- end }}
9999
{{- end }}
100+
101+
{{- if and .Values.nominatimApi.enabled .Values.nominatimUI.enabled }}
102+
- name: nominatim-ui
103+
image: "{{ .Values.nominatimUI.image.name }}:{{ .Values.nominatimUI.image.tag }}"
104+
ports:
105+
- containerPort: 80
106+
name: ui
107+
protocol: TCP
108+
command: ["/bin/sh", "-c"]
109+
args:
110+
- >
111+
echo "Nominatim_Config.Nominatim_API_Endpoint = 'https://{{ .Values.nominatimApi.ingressDomain }}/';"
112+
>> /usr/share/nginx/html/ui/theme/config.theme.js &&
113+
nginx -g "daemon off;"
114+
{{- end }}
100115
volumes:
101116
- name: nominatim-db-storage
102117
{{- if .Values.nominatimApi.persistenceDisk.enabled }}

osm-seed/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,15 @@ tmApi:
684684
enabled: false
685685
memory: "2Gi"
686686
cpu: "2"
687+
688+
# ====================================================================================================
689+
# Nominatim UI, The image need to be update with your own docker image
690+
# ====================================================================================================
691+
nominatimUI:
692+
enabled: false
693+
image:
694+
name: "ghcr.io/openhistoricalmap/nominatim-ui"
695+
tag: "a469b5e"
687696
# ====================================================================================================
688697
# Variables for nominatim api
689698
# ====================================================================================================

0 commit comments

Comments
 (0)