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:
|
||||
app: mongo
|
||||
spec:
|
||||
hostAliases:
|
||||
- ip: "127.0.0.1"
|
||||
hostnames:
|
||||
- "mongo"
|
||||
securityContext:
|
||||
runAsUser: 1001
|
||||
fsGroup: 0
|
||||
containers:
|
||||
- name: mongo
|
||||
image: {{ .Values.mongo.image }}
|
||||
command: ["mongod"]
|
||||
args: ["--replSet", "{{ .Values.mongo.replSet }}"]
|
||||
ports:
|
||||
- containerPort: {{ .Values.mongo.port }}
|
||||
env:
|
||||
@@ -36,6 +42,9 @@ spec:
|
||||
volumeMounts:
|
||||
- name: mongo-data
|
||||
mountPath: {{ .Values.mongo.volumeMounts.db }}
|
||||
- name: mongo-init
|
||||
mountPath: /docker-entrypoint-initdb.d/mongo-init.js
|
||||
subPath: mongo-init.js
|
||||
resources:
|
||||
requests:
|
||||
cpu: {{ .Values.resources.mongo.requests.cpu }}
|
||||
@@ -46,4 +55,7 @@ spec:
|
||||
volumes:
|
||||
- name: mongo-data
|
||||
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
|
||||
value: {{ .Values.overleaf.siteLanguage | quote }}
|
||||
- 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
|
||||
value: redis
|
||||
- name: REDIS_HOST
|
||||
|
@@ -3,11 +3,7 @@ apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: overleaf-ingress
|
||||
annotations:
|
||||
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
|
||||
namespace: {{ .Release.Namespace }}
|
||||
spec:
|
||||
tls:
|
||||
- hosts:
|
||||
@@ -18,7 +14,7 @@ spec:
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
service:
|
||||
name: overleaf
|
||||
|
@@ -2,9 +2,18 @@ apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mongo
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
app: mongo
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {{ .Values.mongo.port }}
|
||||
targetPort: {{ .Values.mongo.port }}
|
||||
protocol: TCP
|
||||
name: mongo
|
||||
selector:
|
||||
app: mongo
|
||||
|
@@ -3,6 +3,7 @@ kind: Service
|
||||
metadata:
|
||||
name: redis
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {{ .Values.redis.port }}
|
||||
targetPort: {{ .Values.redis.port }}
|
||||
|
@@ -7,5 +7,6 @@ spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: {{ .Values.overleaf.port }}
|
||||
protocol: TCP
|
||||
selector:
|
||||
app: overleaf
|
||||
|
@@ -23,6 +23,7 @@ mongo:
|
||||
port: 27017
|
||||
replSet: overleaf
|
||||
initDb: overleaf
|
||||
host: mongo
|
||||
volumeMounts:
|
||||
db: /data/db
|
||||
rootUser: root
|
||||
|
Reference in New Issue
Block a user