Compare commits

...

5 commits

Author SHA1 Message Date
David Larlet
2008cca2f4
Add French Grist-related video tutorial
Some checks are pending
Test & Docs / tests (postgresql, 3.10) (push) Waiting to run
Test & Docs / tests (postgresql, 3.12) (push) Waiting to run
Test & Docs / lint (push) Waiting to run
Test & Docs / docs (push) Waiting to run
2024-11-21 16:12:34 -05:00
Yohan Boniface
d4bc91c41c chore: add --dependency-update in helm make command
Plus add a minimal doc
2024-11-21 17:40:49 +01:00
Yohan Boniface
3e6f8a6e7f
Add umap helm chart for Kubernetes deployment (#2286)
This helm chart allow to deploy umap on a Kubernetes cluster easily.
2024-11-21 17:12:46 +01:00
Antoine Millet
b76861489e chore: added "helm" job in Makefile to build & push helm chart 2024-11-21 15:13:51 +01:00
Antoine Millet
8ac548bf6f chore: added umap helm chart
This helm chart allow to deploy umap on a Kubernetes cluster easily.
2024-11-20 14:06:49 +01:00
15 changed files with 453 additions and 1 deletions

5
.gitignore vendored
View file

@ -25,3 +25,8 @@ test-results/
### Transifex ### ### Transifex ###
tx tx
# Helm
charts/*/charts
helmfile.yaml
charts/*/Chart.lock

View file

@ -46,6 +46,13 @@ docker: ## Create a new Docker image and publish it
docker build -t umap/umap:${VERSION} . docker build -t umap/umap:${VERSION} .
docker push umap/umap:${VERSION} docker push umap/umap:${VERSION}
.PHONY: helm
helm: ## Build the helm chart and publish it
$(eval VERSION=$(shell hatch version))
$(eval PACKAGE=$(shell helm package --dependency-update --app-version ${VERSION} ./charts/umap | grep "Successfully packaged" | awk '{print $$NF}'))
@echo "Successfully packaged helm chart in: ${PACKAGE}"
helm push ${PACKAGE} oci://registry-1.docker.io/umap
.PHONY: build .PHONY: build
build: ## Build the Python package before release build: ## Build the Python package before release
@hatch build --clean @hatch build --clean

23
charts/umap/.helmignore Normal file
View file

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

16
charts/umap/Chart.yaml Normal file
View file

@ -0,0 +1,16 @@
apiVersion: v2
name: umap
description: A Helm chart to deploy umap on Kubernetes
type: application
version: 0.1.0
appVersion: "2.7.2"
dependencies:
- name: cnpg-cluster
version: 2.0.1
repository: https://charts.enix.io/
alias: cnpg
condition: cnpg.enabled

View file

@ -0,0 +1,73 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "umap.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "umap.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "umap.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "umap.labels" -}}
helm.sh/chart: {{ include "umap.chart" . }}
{{ include "umap.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "umap.selectorLabels" -}}
app.kubernetes.io/name: {{ include "umap.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "umap.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "umap.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{/*
Get the name of the persistent volume claim
*/}}
{{- define "umap.pvcName" -}}
{{- if .Values.persistence.existingClaim -}}
{{- printf "%s" (tpl .Values.persistence.existingClaim $) -}}
{{- else -}}
{{- printf "%s" (include "umap.fullname" .) -}}
{{- end -}}
{{- end -}}

View file

@ -0,0 +1,102 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "umap.fullname" . }}
labels:
{{- include "umap.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "umap.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/secret-config.yaml") . | sha256sum }}
checksum/env: {{ include (print $.Template.BasePath "/secret-env.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "umap.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "umap.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
startupProbe:
httpGet:
path: /stats
port: http
livenessProbe:
httpGet:
path: /stats
port: http
readinessProbe:
httpGet:
path: /stats
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.cnpg.enabled }}
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-cnpg-app
key: uri
- name: UMAP_SETTINGS
value: /etc/umap/umap.conf
{{- end }}
envFrom:
- secretRef:
name: {{ .Release.Name }}-env
volumeMounts:
- name: config
mountPath: /etc/umap/
readOnly: true
- name: statics
mountPath: /srv/umap/static
{{- if .Values.persistence.enabled }}
- name: data
mountPath: /srv/umap/uploads/
{{- end }}
volumes:
- name: config
secret:
secretName: {{ .Release.Name }}-config
- name: statics
emptyDir: {}
{{- if .Values.persistence.enabled }}
- name: data
persistentVolumeClaim:
claimName: {{ include "umap.pvcName" . }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View file

@ -0,0 +1,31 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "umap.fullname" . }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.className }}
tls:
- hosts:
{{- range .Values.ingress.hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ include "umap.fullname" . }}-tls
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "umap.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,24 @@
{{- if and (.Values.persistence.enabled) (not .Values.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
{{- if .Values.persistence.annotations }}
annotations:
{{- toYaml .Values.persistence.annotations | nindent 4 }}
{{- end }}
name: {{ include "umap.pvcName" . }}
labels:
{{- include "umap.labels" . | nindent 4 }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
{{- with .Values.persistence.resources }}
resources:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .Values.persistence.storageClassName }}
storageClassName: {{ .Values.persistence.storageClassName | quote }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "umap.fullname" . }}-config
labels:
{{- include "umap.labels" . | nindent 4 }}
type: Opaque
data:
umap.conf: {{ .Values.umap.config | b64enc }}

View file

@ -0,0 +1,11 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "umap.fullname" . }}-env
labels:
{{- include "umap.labels" . | nindent 4 }}
type: Opaque
data:
{{- range $key, $value := .Values.umap.environment }}
{{ $key }}: "{{ $value | b64enc }}"
{{- end }}

View file

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "umap.fullname" . }}
labels:
{{- include "umap.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "umap.selectorLabels" . | nindent 4 }}

View file

@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "umap.serviceAccountName" . }}
labels:
{{- include "umap.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}

118
charts/umap/values.yaml Normal file
View file

@ -0,0 +1,118 @@
# Default values for umap.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: umap/umap
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Automatically mount a ServiceAccount's API credentials?
automount: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podLabels: {}
podSecurityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
service:
type: ClusterIP
port: 8000
ingress:
enabled: false
className: ""
annotations: {}
hosts:
- example.org
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
umap:
# Set environment variables supported by umap here
# see: https://docs.umap-project.org/en/stable/config/settings/
environment:
SECRET_KEY: CHANGE_ME
STATIC_ROOT: /srv/umap/static
MEDIA_ROOT: /srv/umap/uploads
# You can also provide umap.conf content here:
config: |
from umap.settings.base import *
# See: https://github.com/umap-project/umap/blob/master/umap/settings/local.py.sample
persistence:
enabled: true
accessModes:
- ReadWriteOnce
annotations: {}
existingClaim: ""
storageClassName: ""
resources:
requests:
storage: 1Gi
# Configure Cloudnative-pg operator for Postgis database
# Alternatively, you can disable CNPG and provide your own
# Postgis database by setting the `umap.environment.DATABASE_URL`
cnpg:
enabled: true
replicaCount: 2
image:
repository: ghcr.io/cloudnative-pg/postgis
tag: 14
persistence:
storageClass: ""
size: 1Gi
clusterExtraSpec:
bootstrap:
initdb:
postInitTemplateSQL:
- CREATE EXTENSION postgis;
- CREATE EXTENSION postgis_topology;
- CREATE EXTENSION fuzzystrmatch;
- CREATE EXTENSION postgis_tiger_geocoder;
# See available values here: https://artifacthub.io/packages/helm/enix/cnpg-cluster?modal=values

View file

@ -1,12 +1,16 @@
# Vidéos uMap # Vidéos uMap
## Atelier « Afficher des donnees Grist dans uMap »
<iframe title="Atelier Afficher des donnees Grist dans uMap" width="560" height="315" src="https://tube.numerique.gouv.fr/videos/embed/517beed6-ed57-430d-ad76-61e0c4784338" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups allow-forms"></iframe>
## Transformer un tableau Grist en carte avec uMap ## Transformer un tableau Grist en carte avec uMap
<iframe title="Transformer une table Grist en carte avec uMap" width="560" height="315" src="https://tube.numerique.gouv.fr/videos/embed/9e5b09d5-c660-41a0-8591-cae347c88e65" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups allow-forms"></iframe> <iframe title="Transformer une table Grist en carte avec uMap" width="560" height="315" src="https://tube.numerique.gouv.fr/videos/embed/9e5b09d5-c660-41a0-8591-cae347c88e65" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups allow-forms"></iframe>
## uMap incubé par lÉtat, ça donne quoi ? ## uMap incubé par lÉtat, ça donne quoi ?
<iframe title="24 - uMap incubé par lÉtat, ça donne quoi ?" width="560" height="315" src="https://peertube.openstreetmap.fr/videos/embed/c564dcfd-4b0b-4796-86ac-ca8624226cd3" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups allow-forms"></iframe> <iframe title="uMap incubé par lÉtat, ça donne quoi ?" width="560" height="315" src="https://peertube.openstreetmap.fr/videos/embed/c564dcfd-4b0b-4796-86ac-ca8624226cd3" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups allow-forms"></iframe>
## uMap a 10 ans, bilan et perspectives ## uMap a 10 ans, bilan et perspectives

View file

@ -18,6 +18,7 @@ nav:
- Icon packs: config/icons.md - Icon packs: config/icons.md
- Deployment: - Deployment:
- Docker: deploy/docker.md - Docker: deploy/docker.md
- Helm: deploy/helm.md
- Nginx: deploy/nginx.md - Nginx: deploy/nginx.md
- Changelog: changelog.md - Changelog: changelog.md
theme: theme: