From 0870a0dec81acf906a7e7ba4f48e18066e4737ae Mon Sep 17 00:00:00 2001 From: wanghe-fit2cloud Date: Wed, 31 Jul 2024 12:17:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BA=86=20MeiliSearc?= =?UTF-8?q?h=20=E9=83=A8=E5=88=86=E5=8F=82=E6=95=B0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/meilisearch/1.9.0/data.yml | 8 ++++---- apps/meilisearch/1.9.0/docker-compose.yml | 21 ++++++++++++--------- apps/meilisearch/1.9.0/scripts/upgrade.sh | 17 +++++++++++++++++ 3 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 apps/meilisearch/1.9.0/scripts/upgrade.sh diff --git a/apps/meilisearch/1.9.0/data.yml b/apps/meilisearch/1.9.0/data.yml index 4bf22d25..e7b38858 100644 --- a/apps/meilisearch/1.9.0/data.yml +++ b/apps/meilisearch/1.9.0/data.yml @@ -17,14 +17,14 @@ additionalProperties: random: true rule: paramComplexity type: password - - envKey: MEILI_NO_ANALYTICS - default: '' + - default: "true" + envKey: MEILI_NO_ANALYTICS labelEn: Meilisearch's built-in telemetry labelZh: Meilisearch 的内置遥测 edit: true type: select values: - label: 开启 - value: '' + value: "true" - label: 关闭 - value: --no-analytics \ No newline at end of file + value: "false" \ No newline at end of file diff --git a/apps/meilisearch/1.9.0/docker-compose.yml b/apps/meilisearch/1.9.0/docker-compose.yml index 80d27c0a..b327a9a7 100644 --- a/apps/meilisearch/1.9.0/docker-compose.yml +++ b/apps/meilisearch/1.9.0/docker-compose.yml @@ -1,26 +1,29 @@ services: meilisearch: container_name: ${CONTAINER_NAME} + image: getmeili/meilisearch:v1.9.0 + restart: always networks: - 1panel-network - image: getmeili/meilisearch:v1.9.0 - command: - - /bin/sh - - -c - - /bin/meilisearch ${MEILI_NO_ANALYTICS} - labels: - createdBy: Apps - restart: always ports: - ${PANEL_APP_PORT_HTTP}:7700 environment: MEILI_CONFIG_FILE_PATH: /config/config.toml MEILI_MASTER_KEY: ${MEILI_MASTER_KEY} volumes: - - ./config:/config + - ./config:/config - ./data:/meili_data - ./dumps:/dumps - ./snapshots:/snapshots + command: > + sh -c ' + if [ "${MEILI_NO_ANALYTICS}" = "true" ]; then + /bin/meilisearch + else + /bin/meilisearch --no-analytics + fi' + labels: + createdBy: Apps networks: 1panel-network: external: true \ No newline at end of file diff --git a/apps/meilisearch/1.9.0/scripts/upgrade.sh b/apps/meilisearch/1.9.0/scripts/upgrade.sh new file mode 100644 index 00000000..619083df --- /dev/null +++ b/apps/meilisearch/1.9.0/scripts/upgrade.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +ENV_FILE="./.env" + +if [[ -f $ENV_FILE ]]; then + source "$ENV_FILE" + if [ -z "$MEILI_NO_ANALYTICS" ] || [ "$MEILI_NO_ANALYTICS" = "" ]; then + NEW_VALUE='"true"' + elif [ "$MEILI_NO_ANALYTICS" = "--no-analytics" ]; then + NEW_VALUE='"false"' + else + NEW_VALUE="\"$MEILI_NO_ANALYTICS\"" + fi + sed -i "s/^MEILI_NO_ANALYTICS=.*/MEILI_NO_ANALYTICS=$NEW_VALUE/" "$ENV_FILE" +else + echo ".env 文件不存在" +fi \ No newline at end of file