mirror of
https://gitlab.dit.htwk-leipzig.de/fsr-im/k8s/services/overleaf-cep.git
synced 2025-08-30 00:23:51 +02:00
Add MongoDB initialization script and update deployment configurations
This commit is contained in:
8
overleaf-helm-chart/templates/configmap-mongo-init.yaml
Normal file
8
overleaf-helm-chart/templates/configmap-mongo-init.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: mongo-init-script
|
||||||
|
namespace: overleaf
|
||||||
|
data:
|
||||||
|
mongodb-init.js: |
|
||||||
|
rs.initiate({ _id: 'overleaf', members: [{ _id: 0, host: 'mongo:27017' }] })
|
@@ -12,12 +12,18 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: mongo
|
app: mongo
|
||||||
spec:
|
spec:
|
||||||
|
hostAliases:
|
||||||
|
- ip: "127.0.0.1"
|
||||||
|
hostnames:
|
||||||
|
- "mongo"
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsUser: 1001
|
runAsUser: 1001
|
||||||
fsGroup: 0
|
fsGroup: 0
|
||||||
containers:
|
containers:
|
||||||
- name: mongo
|
- name: mongo
|
||||||
image: {{ .Values.mongo.image }}
|
image: {{ .Values.mongo.image }}
|
||||||
|
command: ["mongod"]
|
||||||
|
args: ["--replSet", "{{ .Values.mongo.replSet }}"]
|
||||||
ports:
|
ports:
|
||||||
- containerPort: {{ .Values.mongo.port }}
|
- containerPort: {{ .Values.mongo.port }}
|
||||||
env:
|
env:
|
||||||
@@ -36,6 +42,9 @@ spec:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: mongo-data
|
- name: mongo-data
|
||||||
mountPath: {{ .Values.mongo.volumeMounts.db }}
|
mountPath: {{ .Values.mongo.volumeMounts.db }}
|
||||||
|
- name: mongo-init
|
||||||
|
mountPath: /docker-entrypoint-initdb.d/mongo-init.js
|
||||||
|
subPath: mongo-init.js
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: {{ .Values.resources.mongo.requests.cpu }}
|
cpu: {{ .Values.resources.mongo.requests.cpu }}
|
||||||
@@ -47,3 +56,6 @@ spec:
|
|||||||
- name: mongo-data
|
- name: mongo-data
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: {{ .Values.persistence.mongoData }}
|
claimName: {{ .Values.persistence.mongoData }}
|
||||||
|
- name: mongo-init
|
||||||
|
configMap:
|
||||||
|
name: mongo-init-script
|
@@ -23,7 +23,7 @@ spec:
|
|||||||
- name: OVERLEAF_SITE_LANGUAGE
|
- name: OVERLEAF_SITE_LANGUAGE
|
||||||
value: {{ .Values.overleaf.siteLanguage | quote }}
|
value: {{ .Values.overleaf.siteLanguage | quote }}
|
||||||
- name: OVERLEAF_MONGO_URL
|
- name: OVERLEAF_MONGO_URL
|
||||||
value: 'mongodb://{{ .Values.mongo.rootUser }}:{{ .Values.mongo.rootPassword }}@mongo:27017/{{ .Values.mongo.initDb }}?replicaSet={{ .Values.mongo.replSet }}'
|
value: 'mongodb://{{ .Values.mongo.rootUser | quote }}:{{ .Values.mongo.rootPassword | quote }}@{{ .Values.mongo.host | quote }}:{{ .Values.mongo.port }}/{{ .Values.mongo.initDb | quote }}?authSource=admin&replicaSet={{ .Values.mongo.replSet | quote }}'
|
||||||
- name: OVERLEAF_REDIS_HOST
|
- name: OVERLEAF_REDIS_HOST
|
||||||
value: redis
|
value: redis
|
||||||
- name: REDIS_HOST
|
- name: REDIS_HOST
|
||||||
|
@@ -3,11 +3,7 @@ apiVersion: networking.k8s.io/v1
|
|||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: overleaf-ingress
|
name: overleaf-ingress
|
||||||
annotations:
|
namespace: {{ .Release.Namespace }}
|
||||||
kubernetes.io/ingress.class: "traefik"
|
|
||||||
cert-manager.io/cluster-issuer: "{{ .Values.ingress.certManagerIssuer }}"
|
|
||||||
# Traefik spezifisch: Enable HTTPS redirect (optional)
|
|
||||||
traefik.ingress.kubernetes.io/redirect-entry-point: websecure
|
|
||||||
spec:
|
spec:
|
||||||
tls:
|
tls:
|
||||||
- hosts:
|
- hosts:
|
||||||
@@ -18,7 +14,7 @@ spec:
|
|||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
pathType: Prefix
|
pathType: ImplementationSpecific
|
||||||
backend:
|
backend:
|
||||||
service:
|
service:
|
||||||
name: overleaf
|
name: overleaf
|
||||||
|
@@ -2,9 +2,18 @@ apiVersion: v1
|
|||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: mongo
|
name: mongo
|
||||||
|
namespace: {{ .Values.namespace }}
|
||||||
|
labels:
|
||||||
|
app: mongo
|
||||||
|
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||||
|
release: {{ .Release.Name }}
|
||||||
|
heritage: {{ .Release.Service }}
|
||||||
spec:
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
ports:
|
ports:
|
||||||
- port: {{ .Values.mongo.port }}
|
- port: {{ .Values.mongo.port }}
|
||||||
targetPort: {{ .Values.mongo.port }}
|
targetPort: {{ .Values.mongo.port }}
|
||||||
|
protocol: TCP
|
||||||
|
name: mongo
|
||||||
selector:
|
selector:
|
||||||
app: mongo
|
app: mongo
|
||||||
|
@@ -3,6 +3,7 @@ kind: Service
|
|||||||
metadata:
|
metadata:
|
||||||
name: redis
|
name: redis
|
||||||
spec:
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
ports:
|
ports:
|
||||||
- port: {{ .Values.redis.port }}
|
- port: {{ .Values.redis.port }}
|
||||||
targetPort: {{ .Values.redis.port }}
|
targetPort: {{ .Values.redis.port }}
|
||||||
|
@@ -7,5 +7,6 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- port: 80
|
- port: 80
|
||||||
targetPort: {{ .Values.overleaf.port }}
|
targetPort: {{ .Values.overleaf.port }}
|
||||||
|
protocol: TCP
|
||||||
selector:
|
selector:
|
||||||
app: overleaf
|
app: overleaf
|
||||||
|
@@ -23,6 +23,7 @@ mongo:
|
|||||||
port: 27017
|
port: 27017
|
||||||
replSet: overleaf
|
replSet: overleaf
|
||||||
initDb: overleaf
|
initDb: overleaf
|
||||||
|
host: mongo
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
db: /data/db
|
db: /data/db
|
||||||
rootUser: root
|
rootUser: root
|
||||||
|
Reference in New Issue
Block a user