From 04b46802792d6a7de13a7c409cb3a2271209401a Mon Sep 17 00:00:00 2001 From: pooneyy <85266337+pooneyy@users.noreply.github.com> Date: Thu, 19 Jun 2025 02:08:39 +0800 Subject: [PATCH] Update nodebb --- apps/nodebb/2.8/.env.sample | 2 - apps/nodebb/2.8/data.yml | 10 -- apps/nodebb/2.8/data/.gitkeep | 0 apps/nodebb/2.8/docker-compose.yml | 17 ---- apps/nodebb/2.8/scripts/init.sh | 3 - apps/nodebb/4.4.3/3.12.4/data.yml | 98 ------------------- apps/nodebb/4.4.3/3.12.4/docker-compose.yml | 26 ----- apps/nodebb/4.4.3/3.12.4/scripts/init.sh | 56 ----------- apps/nodebb/4.4.3/data.yml | 2 +- apps/nodebb/latest/.env.sample | 2 - .../{4.4.3/3.12.4 => latest}/conf/setup.json | 0 apps/nodebb/latest/data.yml | 94 +++++++++++++++++- apps/nodebb/latest/data/.gitkeep | 0 apps/nodebb/latest/docker-compose.yml | 27 +++-- .../{4.4.3/3.12.4 => latest}/envs/default.env | 0 .../{4.4.3/3.12.4 => latest}/envs/global.env | 0 apps/nodebb/latest/scripts/init.sh | 55 ++++++++++- .../3.12.4 => latest}/scripts/uninstall.sh | 0 .../3.12.4 => latest}/scripts/upgrade.sh | 0 19 files changed, 164 insertions(+), 228 deletions(-) delete mode 100644 apps/nodebb/2.8/.env.sample delete mode 100644 apps/nodebb/2.8/data.yml delete mode 100644 apps/nodebb/2.8/data/.gitkeep delete mode 100644 apps/nodebb/2.8/docker-compose.yml delete mode 100644 apps/nodebb/2.8/scripts/init.sh delete mode 100644 apps/nodebb/4.4.3/3.12.4/data.yml delete mode 100644 apps/nodebb/4.4.3/3.12.4/docker-compose.yml delete mode 100644 apps/nodebb/4.4.3/3.12.4/scripts/init.sh delete mode 100644 apps/nodebb/latest/.env.sample rename apps/nodebb/{4.4.3/3.12.4 => latest}/conf/setup.json (100%) delete mode 100644 apps/nodebb/latest/data/.gitkeep rename apps/nodebb/{4.4.3/3.12.4 => latest}/envs/default.env (100%) rename apps/nodebb/{4.4.3/3.12.4 => latest}/envs/global.env (100%) rename apps/nodebb/{4.4.3/3.12.4 => latest}/scripts/uninstall.sh (100%) rename apps/nodebb/{4.4.3/3.12.4 => latest}/scripts/upgrade.sh (100%) diff --git a/apps/nodebb/2.8/.env.sample b/apps/nodebb/2.8/.env.sample deleted file mode 100644 index d2482ceae..000000000 --- a/apps/nodebb/2.8/.env.sample +++ /dev/null @@ -1,2 +0,0 @@ -CONTAINER_NAME="nodebb" -PANEL_APP_PORT_HTTP="40202" diff --git a/apps/nodebb/2.8/data.yml b/apps/nodebb/2.8/data.yml deleted file mode 100644 index 230402f9b..000000000 --- a/apps/nodebb/2.8/data.yml +++ /dev/null @@ -1,10 +0,0 @@ -additionalProperties: - formFields: - - default: 40202 - edit: true - envKey: PANEL_APP_PORT_HTTP - labelEn: Port - labelZh: 端口 - required: true - rule: paramPort - type: number diff --git a/apps/nodebb/2.8/data/.gitkeep b/apps/nodebb/2.8/data/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/nodebb/2.8/docker-compose.yml b/apps/nodebb/2.8/docker-compose.yml deleted file mode 100644 index bbf328785..000000000 --- a/apps/nodebb/2.8/docker-compose.yml +++ /dev/null @@ -1,17 +0,0 @@ -services: - nodebb: - container_name: ${CONTAINER_NAME} - restart: always - networks: - - 1panel-network - ports: - - "${PANEL_APP_PORT_HTTP}:4567" - volumes: - - ./data:/usr/src/app/public/uploads - image: nodebb/docker:2.8 - labels: - createdBy: "Apps" - -networks: - 1panel-network: - external: true diff --git a/apps/nodebb/2.8/scripts/init.sh b/apps/nodebb/2.8/scripts/init.sh deleted file mode 100644 index 2ffd123dc..000000000 --- a/apps/nodebb/2.8/scripts/init.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -chmod 777 data \ No newline at end of file diff --git a/apps/nodebb/4.4.3/3.12.4/data.yml b/apps/nodebb/4.4.3/3.12.4/data.yml deleted file mode 100644 index a161316f7..000000000 --- a/apps/nodebb/4.4.3/3.12.4/data.yml +++ /dev/null @@ -1,98 +0,0 @@ -additionalProperties: - formFields: - - default: "/home/nodebb" - edit: true - envKey: NODEBB_ROOT_PATH - labelZh: 数据持久化路径 - labelEn: Data persistence path - required: true - type: text - - default: 4567 - edit: true - envKey: PANEL_APP_PORT_HTTP - labelZh: WebUI 端口 - labelEn: WebUI port - required: true - rule: paramPort - type: number - - default: "http://127.0.0.1:4567" - edit: true - envKey: NODEBB_URL - labelZh: 服务地址 - labelEn: Service address - required: true - type: text - - default: "" - edit: true - envKey: NODEBB_ADMIN_USERNAME - labelZh: 管理员用户名 - labelEn: Admin Username - required: true - type: text - - default: "" - edit: true - envKey: NODEBB_ADMIN_PASSWORD - labelZh: 管理员密码 - labelEn: Admin Password - required: true - type: password - - default: "" - edit: true - envKey: NODEBB_ADMIN_EMAIL - labelZh: 管理员邮箱 - labelEn: Admin Email - required: true - type: text - - default: "postgres" - edit: true - envKey: NODEBB_DB - labelZh: 数据库类型 - labelEn: Database type - required: true - type: select - values: - - label: PostgreSQL - value: "postgres" - - label: Redis - value: "redis" - - label: MongoDB - value: "mongo" - - default: "127.0.0.1" - edit: true - envKey: NODEBB_DB_HOST - labelZh: 数据库 主机地址 - labelEn: Database Host - required: true - type: text - - default: 5432 - edit: true - envKey: NODEBB_DB_PORT - labelZh: 数据库 端口 - labelEn: Database Port - required: true - rule: paramPort - type: number - - default: "nodebb" - edit: true - envKey: NODEBB_DB_NAME - labelZh: 数据库 名称 - labelEn: Database Name - required: true - rule: paramCommon - type: text - - default: "nodebb" - edit: true - envKey: NODEBB_DB_USER - labelZh: 数据库 用户名 - labelEn: Database Username - required: false - type: text - - default: "" - edit: true - envKey: NODEBB_DB_PASSWORD - labelZh: 数据库 密码 - labelEn: Database Password - random: true - required: false - rule: paramComplexity - type: password diff --git a/apps/nodebb/4.4.3/3.12.4/docker-compose.yml b/apps/nodebb/4.4.3/3.12.4/docker-compose.yml deleted file mode 100644 index 9dddfe552..000000000 --- a/apps/nodebb/4.4.3/3.12.4/docker-compose.yml +++ /dev/null @@ -1,26 +0,0 @@ -networks: - 1panel-network: - external: true - -services: - nodebb: - image: ghcr.io/nodebb/nodebb:4.4.3 - container_name: ${CONTAINER_NAME} - labels: - createdBy: "Apps" - restart: always - networks: - - 1panel-network - ports: - - ${PANEL_APP_PORT_HTTP}:4567 - env_file: - - ${GLOBAL_ENV_FILE:-/etc/1panel/envs/global.env} - - ${ENV_FILE:-/etc/1panel/envs/default.env} - volumes: - - ${NODEBB_ROOT_PATH}/node_modules:/usr/src/app/node_modules - - ${NODEBB_ROOT_PATH}/build:/usr/src/app/build - - ${NODEBB_ROOT_PATH}/uploads:/usr/src/app/public/uploads - - ${NODEBB_ROOT_PATH}/config:/opt/config - - ${NODEBB_ROOT_PATH}/setup.json:/usr/src/app/setup.json - environment: - - TZ=Asia/Shanghai diff --git a/apps/nodebb/4.4.3/3.12.4/scripts/init.sh b/apps/nodebb/4.4.3/3.12.4/scripts/init.sh deleted file mode 100644 index 00b4605fb..000000000 --- a/apps/nodebb/4.4.3/3.12.4/scripts/init.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -if [ -f .env ]; then - source .env - - # setup-1 add default values - CURRENT_DIR=$(pwd) - sed -i '/^ENV_FILE=/d' .env - sed -i '/^GLOBAL_ENV_FILE=/d' .env - echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env - echo "GLOBAL_ENV_FILE=${CURRENT_DIR}/envs/global.env" >> .env - - # setup-2 update dir permissions - mkdir -p "$NODEBB_ROOT_PATH" - mkdir -p "$NODEBB_ROOT_PATH/node_modules" - mkdir -p "$NODEBB_ROOT_PATH/build" - mkdir -p "$NODEBB_ROOT_PATH/uploads" - mkdir -p "$NODEBB_ROOT_PATH/config" - - # setup-3 初始化参数配置 - if [ -z "$NODEBB_DB_NAME" ]; then - NODEBB_DB_NAME="nodebb" - fi - - if [ -z "$NODEBB_DB_USER" ]; then - NODEBB_DB_USER="" - fi - - if [ -z "$NODEBB_DB_PASSWORD" ]; then - NODEBB_DB_PASSWORD="" - fi - - SETUP_JSON_PATH="$NODEBB_ROOT_PATH/setup.json" - cp ./conf/setup.json "$SETUP_JSON_PATH" - sed -i " - s|\$NODEBB_DB_HOST|$NODEBB_DB_HOST|g; - s|\$NODEBB_DB_PORT|$NODEBB_DB_PORT|g; - s|\$NODEBB_DB_NAME|$NODEBB_DB_NAME|g; - s|\$NODEBB_DB_USER|$NODEBB_DB_USER|g; - s|\$NODEBB_DB_PASSWORD|$NODEBB_DB_PASSWORD|g; - s|\$NODEBB_DB|$NODEBB_DB|g - " "$SETUP_JSON_PATH" - - - # setup-4 update dir permissions - chown -R 1001:1001 "$NODEBB_ROOT_PATH" - chown -R 1001:1001 "$NODEBB_ROOT_PATH/node_modules" - chown -R 1001:1001 "$NODEBB_ROOT_PATH/build" - chown -R 1001:1001 "$NODEBB_ROOT_PATH/uploads" - chown -R 1001:1001 "$NODEBB_ROOT_PATH/config" - - echo "Check Finish." - -else - echo "Error: .env file not found." -fi diff --git a/apps/nodebb/4.4.3/data.yml b/apps/nodebb/4.4.3/data.yml index a161316f7..fe2100f02 100644 --- a/apps/nodebb/4.4.3/data.yml +++ b/apps/nodebb/4.4.3/data.yml @@ -1,6 +1,6 @@ additionalProperties: formFields: - - default: "/home/nodebb" + - default: "./data" edit: true envKey: NODEBB_ROOT_PATH labelZh: 数据持久化路径 diff --git a/apps/nodebb/latest/.env.sample b/apps/nodebb/latest/.env.sample deleted file mode 100644 index d2482ceae..000000000 --- a/apps/nodebb/latest/.env.sample +++ /dev/null @@ -1,2 +0,0 @@ -CONTAINER_NAME="nodebb" -PANEL_APP_PORT_HTTP="40202" diff --git a/apps/nodebb/4.4.3/3.12.4/conf/setup.json b/apps/nodebb/latest/conf/setup.json similarity index 100% rename from apps/nodebb/4.4.3/3.12.4/conf/setup.json rename to apps/nodebb/latest/conf/setup.json diff --git a/apps/nodebb/latest/data.yml b/apps/nodebb/latest/data.yml index 230402f9b..fe2100f02 100644 --- a/apps/nodebb/latest/data.yml +++ b/apps/nodebb/latest/data.yml @@ -1,10 +1,98 @@ additionalProperties: formFields: - - default: 40202 + - default: "./data" + edit: true + envKey: NODEBB_ROOT_PATH + labelZh: 数据持久化路径 + labelEn: Data persistence path + required: true + type: text + - default: 4567 edit: true envKey: PANEL_APP_PORT_HTTP - labelEn: Port - labelZh: 端口 + labelZh: WebUI 端口 + labelEn: WebUI port required: true rule: paramPort type: number + - default: "http://127.0.0.1:4567" + edit: true + envKey: NODEBB_URL + labelZh: 服务地址 + labelEn: Service address + required: true + type: text + - default: "" + edit: true + envKey: NODEBB_ADMIN_USERNAME + labelZh: 管理员用户名 + labelEn: Admin Username + required: true + type: text + - default: "" + edit: true + envKey: NODEBB_ADMIN_PASSWORD + labelZh: 管理员密码 + labelEn: Admin Password + required: true + type: password + - default: "" + edit: true + envKey: NODEBB_ADMIN_EMAIL + labelZh: 管理员邮箱 + labelEn: Admin Email + required: true + type: text + - default: "postgres" + edit: true + envKey: NODEBB_DB + labelZh: 数据库类型 + labelEn: Database type + required: true + type: select + values: + - label: PostgreSQL + value: "postgres" + - label: Redis + value: "redis" + - label: MongoDB + value: "mongo" + - default: "127.0.0.1" + edit: true + envKey: NODEBB_DB_HOST + labelZh: 数据库 主机地址 + labelEn: Database Host + required: true + type: text + - default: 5432 + edit: true + envKey: NODEBB_DB_PORT + labelZh: 数据库 端口 + labelEn: Database Port + required: true + rule: paramPort + type: number + - default: "nodebb" + edit: true + envKey: NODEBB_DB_NAME + labelZh: 数据库 名称 + labelEn: Database Name + required: true + rule: paramCommon + type: text + - default: "nodebb" + edit: true + envKey: NODEBB_DB_USER + labelZh: 数据库 用户名 + labelEn: Database Username + required: false + type: text + - default: "" + edit: true + envKey: NODEBB_DB_PASSWORD + labelZh: 数据库 密码 + labelEn: Database Password + random: true + required: false + rule: paramComplexity + type: password diff --git a/apps/nodebb/latest/data/.gitkeep b/apps/nodebb/latest/data/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/nodebb/latest/docker-compose.yml b/apps/nodebb/latest/docker-compose.yml index 22fc1ec4a..ad81dee51 100644 --- a/apps/nodebb/latest/docker-compose.yml +++ b/apps/nodebb/latest/docker-compose.yml @@ -1,17 +1,26 @@ +networks: + 1panel-network: + external: true + services: nodebb: + image: ghcr.io/nodebb/nodebb:latest container_name: ${CONTAINER_NAME} + labels: + createdBy: "Apps" restart: always networks: - 1panel-network ports: - - "${PANEL_APP_PORT_HTTP}:4567" + - ${PANEL_APP_PORT_HTTP}:4567 + env_file: + - ${GLOBAL_ENV_FILE:-/etc/1panel/envs/global.env} + - ${ENV_FILE:-/etc/1panel/envs/default.env} volumes: - - ./data:/usr/src/app/public/uploads - image: nodebb/docker:latest - labels: - createdBy: "Apps" - -networks: - 1panel-network: - external: true + - ${NODEBB_ROOT_PATH}/node_modules:/usr/src/app/node_modules + - ${NODEBB_ROOT_PATH}/build:/usr/src/app/build + - ${NODEBB_ROOT_PATH}/uploads:/usr/src/app/public/uploads + - ${NODEBB_ROOT_PATH}/config:/opt/config + - ${NODEBB_ROOT_PATH}/setup.json:/usr/src/app/setup.json + environment: + - TZ=Asia/Shanghai diff --git a/apps/nodebb/4.4.3/3.12.4/envs/default.env b/apps/nodebb/latest/envs/default.env similarity index 100% rename from apps/nodebb/4.4.3/3.12.4/envs/default.env rename to apps/nodebb/latest/envs/default.env diff --git a/apps/nodebb/4.4.3/3.12.4/envs/global.env b/apps/nodebb/latest/envs/global.env similarity index 100% rename from apps/nodebb/4.4.3/3.12.4/envs/global.env rename to apps/nodebb/latest/envs/global.env diff --git a/apps/nodebb/latest/scripts/init.sh b/apps/nodebb/latest/scripts/init.sh index 2ffd123dc..00b4605fb 100644 --- a/apps/nodebb/latest/scripts/init.sh +++ b/apps/nodebb/latest/scripts/init.sh @@ -1,3 +1,56 @@ #!/bin/bash -chmod 777 data \ No newline at end of file +if [ -f .env ]; then + source .env + + # setup-1 add default values + CURRENT_DIR=$(pwd) + sed -i '/^ENV_FILE=/d' .env + sed -i '/^GLOBAL_ENV_FILE=/d' .env + echo "ENV_FILE=${CURRENT_DIR}/.env" >> .env + echo "GLOBAL_ENV_FILE=${CURRENT_DIR}/envs/global.env" >> .env + + # setup-2 update dir permissions + mkdir -p "$NODEBB_ROOT_PATH" + mkdir -p "$NODEBB_ROOT_PATH/node_modules" + mkdir -p "$NODEBB_ROOT_PATH/build" + mkdir -p "$NODEBB_ROOT_PATH/uploads" + mkdir -p "$NODEBB_ROOT_PATH/config" + + # setup-3 初始化参数配置 + if [ -z "$NODEBB_DB_NAME" ]; then + NODEBB_DB_NAME="nodebb" + fi + + if [ -z "$NODEBB_DB_USER" ]; then + NODEBB_DB_USER="" + fi + + if [ -z "$NODEBB_DB_PASSWORD" ]; then + NODEBB_DB_PASSWORD="" + fi + + SETUP_JSON_PATH="$NODEBB_ROOT_PATH/setup.json" + cp ./conf/setup.json "$SETUP_JSON_PATH" + sed -i " + s|\$NODEBB_DB_HOST|$NODEBB_DB_HOST|g; + s|\$NODEBB_DB_PORT|$NODEBB_DB_PORT|g; + s|\$NODEBB_DB_NAME|$NODEBB_DB_NAME|g; + s|\$NODEBB_DB_USER|$NODEBB_DB_USER|g; + s|\$NODEBB_DB_PASSWORD|$NODEBB_DB_PASSWORD|g; + s|\$NODEBB_DB|$NODEBB_DB|g + " "$SETUP_JSON_PATH" + + + # setup-4 update dir permissions + chown -R 1001:1001 "$NODEBB_ROOT_PATH" + chown -R 1001:1001 "$NODEBB_ROOT_PATH/node_modules" + chown -R 1001:1001 "$NODEBB_ROOT_PATH/build" + chown -R 1001:1001 "$NODEBB_ROOT_PATH/uploads" + chown -R 1001:1001 "$NODEBB_ROOT_PATH/config" + + echo "Check Finish." + +else + echo "Error: .env file not found." +fi diff --git a/apps/nodebb/4.4.3/3.12.4/scripts/uninstall.sh b/apps/nodebb/latest/scripts/uninstall.sh similarity index 100% rename from apps/nodebb/4.4.3/3.12.4/scripts/uninstall.sh rename to apps/nodebb/latest/scripts/uninstall.sh diff --git a/apps/nodebb/4.4.3/3.12.4/scripts/upgrade.sh b/apps/nodebb/latest/scripts/upgrade.sh similarity index 100% rename from apps/nodebb/4.4.3/3.12.4/scripts/upgrade.sh rename to apps/nodebb/latest/scripts/upgrade.sh