From 0d17825eabb5c654aaff8dac69ab736d7f9c887d Mon Sep 17 00:00:00 2001 From: Lumpiasty Date: Mon, 31 Mar 2025 23:59:47 +0200 Subject: [PATCH] Add mongodb database for librechat --- apps/kustomization.yaml | 1 + apps/librechat.yaml | 92 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 apps/librechat.yaml diff --git a/apps/kustomization.yaml b/apps/kustomization.yaml index cd16ae1..4610cbe 100644 --- a/apps/kustomization.yaml +++ b/apps/kustomization.yaml @@ -4,3 +4,4 @@ resources: - gitea.yaml - renovate.yaml - ollama.yaml + - librechat.yaml diff --git a/apps/librechat.yaml b/apps/librechat.yaml new file mode 100644 index 0000000..be7b8e3 --- /dev/null +++ b/apps/librechat.yaml @@ -0,0 +1,92 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: librechat +--- +# Manually create database serviceaccount +# https://github.com/mongodb/helm-charts/blob/01e50752b84de90607f12b1bd8d32c2d3493f1d2/charts/community-operator/templates/database_roles.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: mongodb-database + namespace: librechat +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: mongodb-database + namespace: librechat +rules: + - apiGroups: + - "" + resources: + - secrets + verbs: + - get + - apiGroups: + - "" + resources: + - pods + verbs: + - patch + - delete + - get +--- +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: mongodb-database + namespace: librechat +subjects: + - kind: ServiceAccount + name: mongodb-database +roleRef: + kind: Role + name: mongodb-database + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: mongodbcommunity.mongodb.com/v1 +kind: MongoDBCommunity +metadata: + name: librechat + namespace: librechat +spec: + members: 1 + type: ReplicaSet + version: "6.0.5" + security: + authentication: + modes: ["SCRAM"] + users: + - name: librechat + db: admin + passwordSecretRef: # a reference to the secret that will be used to generate the user's password + name: librechat-mongodb-secret + roles: + - name: clusterAdmin + db: admin + - name: userAdminAnyDatabase + db: admin + scramCredentialsSecretName: my-scram + additionalMongodConfig: + storage.wiredTiger.engineConfig.journalCompressor: zlib + statefulSet: + spec: + volumeClaimTemplates: + - metadata: + name: data-volume + spec: + accessModes: ["ReadWriteOnce"] + storageClassName: openebs-single-replica + resources: + requests: + storage: 10Gi + - metadata: + name: logs-volume + spec: + accessModes: ["ReadWriteOnce"] + storageClassName: openebs-single-replica + resources: + requests: + storage: 1Gi