From a3a4a5befbc11beeb99269665e8064b9cf77ed00 Mon Sep 17 00:00:00 2001 From: na2na-p Date: Mon, 2 Sep 2024 23:17:37 +0900 Subject: [PATCH] =?UTF-8?q?meilisearch=E6=BA=96=E5=82=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/k8s/web/templates/deployment.yaml | 7 +++++++ infra/k8s/web/templates/externalsecret.yaml | 5 +++++ infra/k8s/web/values.yaml | 13 +++++++++++++ package.json | 2 +- packages/backend/src/config.ts | 14 +++++++++++++- 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/infra/k8s/web/templates/deployment.yaml b/infra/k8s/web/templates/deployment.yaml index 93cdd65814ae..286c17f0a81e 100644 --- a/infra/k8s/web/templates/deployment.yaml +++ b/infra/k8s/web/templates/deployment.yaml @@ -51,6 +51,13 @@ spec: secretKeyRef: name: {{ include "web.fullname" . }}-external-secret key: DATABASE_PASSWORD + {{ if and .Values.misskeyCm.meilisearch.enabled .Values.externalSecrets.remoteRef.meiliMasterKeyKey }} + - name: MEILISEARCH_MASTER_KEY + valueFrom: + secretKeyRef: + name: {{ include "web.fullname" . }}-external-secret + key: MEILISEARCH_MASTER_KEY + {{ end }} volumeMounts: - mountPath: /misskey/.config name: misskey-default-conf-file diff --git a/infra/k8s/web/templates/externalsecret.yaml b/infra/k8s/web/templates/externalsecret.yaml index e6cda52f5546..93164001d474 100644 --- a/infra/k8s/web/templates/externalsecret.yaml +++ b/infra/k8s/web/templates/externalsecret.yaml @@ -18,4 +18,9 @@ spec: - secretKey: DATABASE_PASSWORD remoteRef: key: {{ .Values.externalSecrets.remoteRef.databasePasswordKey }} + {{ if and .Values.misskeyCm.meilisearch.enabled .Values.externalSecrets.remoteRef.meiliMasterKeyKey }} + - secretKey: MEILISEARCH_MASTER_KEY + remoteRef: + key: {{ .Values.externalSecrets.remoteRef.meiliMasterKeyKey }} + {{ end }} {{ end }} diff --git a/infra/k8s/web/values.yaml b/infra/k8s/web/values.yaml index b1236d759a46..a8a01d635601 100644 --- a/infra/k8s/web/values.yaml +++ b/infra/k8s/web/values.yaml @@ -20,6 +20,15 @@ misskeyCm: host: "localhost" port: 6379 misskeyBlockMentionsFromUnfamiliarRemoteUsers: false + meilisearch: + enabled: false + host: "localhost" + port: 7700 + # 空なら環境変数を見る + # externalSecrets.remoteRef.meiliMasterKeyKey に指定されたキーの値を使う + apikey: "" + ssl: false + scope: "local" service: type: ClusterIP @@ -67,5 +76,9 @@ externalSecrets: targetName: misskey-external-secret creationPolicy: Owner remoteRef: + # DATABASE_HOST databaseHostKey: "" + # DATABASE_PASSWORD databasePasswordKey: "" + # MEILISEARCH_MASTER_KEY + meiliMasterKeyKey: "" diff --git a/package.json b/package.json index 170a3db147e0..da120262bf4d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2024.8.0-na2na-v2", + "version": "2024.8.0-na2na-v4", "codename": "nasubi", "repository": { "type": "git", diff --git a/packages/backend/src/config.ts b/packages/backend/src/config.ts index aa4504e259a8..d2e3dcd15bb0 100644 --- a/packages/backend/src/config.ts +++ b/packages/backend/src/config.ts @@ -241,7 +241,19 @@ export function loadConfig(): Config { db: { ...config.db, host: dbHost, db: dbDb, user: dbUser, pass: dbPass }, dbReplications: config.dbReplications, dbSlaves: config.dbSlaves, - meilisearch: config.meilisearch, + meilisearch: (() => { + const meiliMasterKeyKey = config.meilisearch?.apiKey ?? process.env.MEILISEARCH_MASTER_KEY; + if (config.meilisearch) { + if (!meiliMasterKeyKey) { + throw new Error('meilisearch.apiKey is required.'); + } + return { + ...config.meilisearch, + apiKey: meiliMasterKeyKey, + } + } + return undefined; + })(), redis, redisForPubsub: config.redisForPubsub ? convertRedisOptions(config.redisForPubsub, host) : redis, redisForJobQueue: config.redisForJobQueue ? convertRedisOptions(config.redisForJobQueue, host) : redis,