Skip to content

Commit 9e21ab9

Browse files
Pipazoullutangar
andauthored
chore(helm): initial datatlas helm config
* chore(helm): initial datatlas helm config * chore(helm): update readme with helm instruction * fix(helm): pgadmin permissions on container init * chore(lint): ignore Helm config files * chore: add helm folder to prettier ignore list * chore(cs): fix README format * fix(helm) Rename example.values.yml to example.values.yaml --------- Co-authored-by: Johan Dufour <[email protected]> Co-authored-by: lutangar <[email protected]>
1 parent 2add378 commit 9e21ab9

15 files changed

+367
-0
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
helm/**/*.yml
3+
helm/**/*.yaml

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,7 @@ Thumbs.db
4343
# Generated Docusaurus files
4444
.docusaurus/
4545
.cache-loader/
46+
47+
48+
# Helm Chart
49+
helm/values.yaml

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
coverage/
44
dist/
55
apps/frontend/public/mockServiceWorker.js
6+
helm/

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,20 @@ npx nx run backend-e2e:e2e --spec apps/backend-e2e/src/e2e/user.cy.ts &> cypress
115115
> See **Cypress** documentation :
116116
> https://github.com/nrwl/nx/tree/master/packages/cypress/docs
117117
118+
## Deployment
119+
120+
### Kubernetes
121+
122+
You can deploy the datatlas stack on a kubernetes cluster using the provided helm chart.
123+
124+
Copy the `helm/example.values.yaml` file to values.yaml and edit it to fit your needs.
125+
126+
Then run the following command to deploy the stack:
127+
128+
```sh
129+
helm install datatlas ./helm --create-namespace --namespace datatlas
130+
```
131+
118132
## Credits
119133
120134
**DatAtlas** was created by [**Erasme**](https://www.erasme.org), the open innovation lab of Lyon 🇫🇷 metropolitan area. It's a part of the larger [**DatAgora**](https://www.erasme.org/DatAgora) initiative.

helm/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

helm/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: datatlas-chart
3+
description: A Helm chart for Datatlas
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "1.16.0"

helm/example.values.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
backend:
2+
container:
3+
name: frontend-container
4+
strategy:
5+
type: Recreate
6+
image:
7+
repository: erasme/datatlas-backend
8+
tag: dev
9+
pullPolicy: Always
10+
service:
11+
type: ClusterIP
12+
port: 3333
13+
targetPort: 3333
14+
env:
15+
POSTGRES_USER: docker
16+
POSTGRES_PASSWORD: mypassword
17+
POSTGRES_DATABASE: datatlas
18+
POSTGRES_HOST: postgis
19+
POSTGRES_PORT: "5432"
20+
PASSWORD_SALT: mypassword
21+
ADMIN_EMAIL: [email protected]
22+
ADMIN_PASSWORD: admin
23+
DUMMY_EDITOR_EMAIL: [email protected]
24+
DUMMY_EDITOR_PASSWORD: editor
25+
PAYLOAD_SIZE_LIMIT: 25mb
26+
27+
frontend:
28+
container:
29+
name: frontend-container
30+
strategy:
31+
type: Recreate
32+
image:
33+
repository: erasme/datatlas-frontend
34+
tag: dev
35+
pullPolicy: Always
36+
service:
37+
type: ClusterIP
38+
port: 8080
39+
targetPort: 8080
40+
env:
41+
REACT_APP_DEFAULT_LOCALE: fr
42+
REACT_APP_MAPBOX_ACCESS_TOKEN: mapxbox-token
43+
REACT_APP_API_BASE_URL: https://mybackend/api
44+
REACT_APP_MATOMO_SITE_ID: "172"
45+
REACT_APP_MATOMO_TRACKER_URL: "//trackinginfo/"
46+
REACT_APP_CONTACT_EMAIL: [email protected]
47+
REACT_APP_MAX_TOOLIP_FIELDS: "3"
48+
49+
postgisPgadmin:
50+
strategy:
51+
type: Recreate
52+
replicaCount: 1
53+
postgis:
54+
image: kartoza/postgis:15-3.3
55+
env:
56+
POSTGRES_DB: postgres
57+
POSTGRES_USER: docker
58+
POSTGRES_PASS: mypassword
59+
volumeMounts:
60+
- mountPath: /var/lib/postgresql
61+
subPath: postgis
62+
pgadmin:
63+
image: dpage/pgadmin4
64+
env:
65+
PGADMIN_DEFAULT_EMAIL: [email protected]
66+
PGADMIN_DEFAULT_PASSWORD: mypassword
67+
volumeMounts:
68+
- mountPath: /var/lib/pgadmin
69+
subPath: pgadmin
70+
debian:
71+
image: debian
72+
command: ["tail", "-f", "/dev/null"]
73+
volumeMounts:
74+
- mountPath: /var/lib/pgadmin
75+
volume:
76+
name: datatlas-dev
77+
persistentVolumeClaim:
78+
claimName: datatlas-dev
79+
80+
postgisService:
81+
type: ClusterIP
82+
port: 5432
83+
targetPort: 5432
84+
85+
pgadminService:
86+
type: ClusterIP
87+
port: 80
88+
targetPort: 80
89+
90+
pvc:
91+
datatlasDev:
92+
name: datatlas-dev
93+
accessModes:
94+
- ReadWriteOnce
95+
resources:
96+
requests:
97+
storage: 2Gi
98+
# Uncomment and modify the following line if you need to specify a StorageClass
99+
storageClassName: "scw-bssd"
100+
#storageClassName: "local-path"
101+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ .Values.backend.name | default "backend" }}
5+
namespace: {{ .Release.Namespace }}
6+
labels:
7+
workload.user.cattle.io/workloadselector: apps.deployment-{{ .Release.Namespace }}-backend
8+
spec:
9+
replicas: {{ .Values.backend.replicas | default 1 }}
10+
selector:
11+
matchLabels:
12+
workload.user.cattle.io/workloadselector: apps.deployment-{{ .Release.Namespace }}-backend
13+
strategy:
14+
type: {{ .Values.backend.strategy.type | default "Recreate" }}
15+
template:
16+
metadata:
17+
labels:
18+
workload.user.cattle.io/workloadselector: apps.deployment-{{ .Release.Namespace }}-backend
19+
spec:
20+
containers:
21+
- name: {{ .Values.backend.container.name | default "backend" }}
22+
image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag | default "dev" }}"
23+
imagePullPolicy: {{ .Values.backend.image.pullPolicy | default "Always" }}
24+
env:
25+
{{- range $key, $value := .Values.backend.env }}
26+
- name: {{ $key }}
27+
value: {{ $value | quote }}
28+
{{- end }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ .Values.frontend.name | default "frontend" }}
5+
namespace: {{ .Release.Namespace }}
6+
labels:
7+
workload.user.cattle.io/workloadselector: apps.deployment-{{ .Release.Namespace }}-frontend
8+
spec:
9+
replicas: {{ .Values.frontend.replicas | default 1 }}
10+
selector:
11+
matchLabels:
12+
workload.user.cattle.io/workloadselector: apps.deployment-{{ .Release.Namespace }}-frontend
13+
strategy:
14+
type: {{ .Values.frontend.strategy.type | default "Recreate" }}
15+
template:
16+
metadata:
17+
labels:
18+
workload.user.cattle.io/workloadselector: apps.deployment-{{ .Release.Namespace }}-frontend
19+
spec:
20+
containers:
21+
- name: {{ .Values.frontend.container.name | default "frontend" }}
22+
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default "dev" }}"
23+
imagePullPolicy: {{ .Values.frontend.image.pullPolicy | default "Always" }}
24+
env:
25+
{{- range $key, $value := .Values.frontend.env }}
26+
- name: {{ $key }}
27+
value: {{ $value | quote }}
28+
{{- end }}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: postgis-pgadmin
5+
namespace: {{ .Release.Namespace }}
6+
labels:
7+
workload.user.cattle.io/workloadselector: apps.deployment-{{ .Release.Namespace }}-postgis-pgadmin
8+
spec:
9+
replicas: {{ .Values.postgisPgadmin.replicaCount }}
10+
selector:
11+
matchLabels:
12+
workload.user.cattle.io/workloadselector: apps.deployment-{{ .Release.Namespace }}-postgis-pgadmin
13+
strategy:
14+
type: Recreate
15+
template:
16+
metadata:
17+
labels:
18+
workload.user.cattle.io/workloadselector: apps.deployment-{{ .Release.Namespace }}-postgis-pgadmin
19+
spec:
20+
initContainers:
21+
- name: debian-setup
22+
image: "{{ .Values.postgisPgadmin.debian.image }}"
23+
command: ["sh", "-c", "chown -R 5050:5050 /var/lib/pgadmin"]
24+
volumeMounts:
25+
{{- range .Values.postgisPgadmin.debian.volumeMounts }}
26+
- mountPath: {{ .mountPath }}
27+
name: {{ $.Values.postgisPgadmin.volume.name }}
28+
{{- end }}
29+
containers:
30+
- name: postgis
31+
image: "{{ .Values.postgisPgadmin.postgis.image }}"
32+
env:
33+
- name: POSTGRES_DB
34+
value: "{{ .Values.postgisPgadmin.postgis.env.POSTGRES_DB }}"
35+
- name: POSTGRES_USER
36+
value: "{{ .Values.postgisPgadmin.postgis.env.POSTGRES_USER }}"
37+
- name: POSTGRES_PASS
38+
value: "{{ .Values.postgisPgadmin.postgis.env.POSTGRES_PASS }}"
39+
volumeMounts:
40+
{{- range .Values.postgisPgadmin.postgis.volumeMounts }}
41+
- mountPath: {{ .mountPath }}
42+
name: {{ $.Values.postgisPgadmin.volume.name }}
43+
subPath: {{ .subPath }}
44+
{{- end }}
45+
- name: pgadmin
46+
image: "{{ .Values.postgisPgadmin.pgadmin.image }}"
47+
env:
48+
- name: PGADMIN_DEFAULT_EMAIL
49+
value: "{{ .Values.postgisPgadmin.pgadmin.env.PGADMIN_DEFAULT_EMAIL }}"
50+
- name: PGADMIN_DEFAULT_PASSWORD
51+
value: "{{ .Values.postgisPgadmin.pgadmin.env.PGADMIN_DEFAULT_PASSWORD }}"
52+
volumeMounts:
53+
{{- range .Values.postgisPgadmin.pgadmin.volumeMounts }}
54+
- mountPath: {{ .mountPath }}
55+
name: {{ $.Values.postgisPgadmin.volume.name }}
56+
subPath: {{ .subPath }}
57+
{{- end }}
58+
volumes:
59+
- name: {{ .Values.postgisPgadmin.volume.name }}
60+
persistentVolumeClaim:
61+
claimName: {{ .Values.postgisPgadmin.volume.persistentVolumeClaim.claimName }}

0 commit comments

Comments
 (0)