From 1331660826cea3fc9a0eba3b3fc976b5e24f899c Mon Sep 17 00:00:00 2001
From: websoft9 <admin@mydomain.com>
Date: Tue, 14 Jan 2025 00:51:42 +0000
Subject: [PATCH] Update nodebb

---
 apps/nodebb/.env                          | 37 ++++-----------
 apps/nodebb/Dockerfile                    | 21 ---------
 apps/nodebb/Notes.md                      | 18 ++++++-
 apps/nodebb/README.jinja2                 | 26 -----------
 apps/nodebb/docker-compose.yml            | 52 ++++++++-------------
 apps/nodebb/src/after_up.sh               |  1 -
 apps/nodebb/src/encrypt.sh                | 12 -----
 apps/nodebb/src/filelist                  |  3 --
 apps/nodebb/src/get_version.sh            |  1 -
 apps/nodebb/src/nginx-proxy.conf.template | 57 -----------------------
 apps/nodebb/src/php_exra.ini              |  8 ----
 apps/nodebb/src/replace_url.sh            |  1 -
 apps/nodebb/variables.json                |  3 +-
 13 files changed, 47 insertions(+), 193 deletions(-)
 delete mode 100644 apps/nodebb/Dockerfile
 delete mode 100644 apps/nodebb/README.jinja2
 delete mode 100644 apps/nodebb/src/after_up.sh
 delete mode 100644 apps/nodebb/src/encrypt.sh
 delete mode 100644 apps/nodebb/src/filelist
 delete mode 100644 apps/nodebb/src/get_version.sh
 delete mode 100644 apps/nodebb/src/nginx-proxy.conf.template
 delete mode 100644 apps/nodebb/src/php_exra.ini
 delete mode 100644 apps/nodebb/src/replace_url.sh

diff --git a/apps/nodebb/.env b/apps/nodebb/.env
index aac6acab2..1d8f34c0f 100644
--- a/apps/nodebb/.env
+++ b/apps/nodebb/.env
@@ -1,47 +1,28 @@
-W9_REPO=wordpress
-W9_DIST=community
-W9_VERSION=latest
-
-W9_POWER_PASSWORD=1PrMxExC45LsCT
+W9_REPO=ghcr.io/nodebb/nodebb
+W9_DIST='community'
+W9_VERSION='3.12'
+W9_POWER_PASSWORD='nXBKnkkSHKa2!IeK'
 
 # Environments which for user settings when create application
 # Named expression: W9_xxx_xxx_SET, xxx refer to file fields
-W9_HTTP_PORT_SET=9001
-# W9_HTTPS_PORT_SET=9002
-# W9_DB_PORT_SET=3306
-# W9_SSH_PORT_SET=23
-W9_KEY_SET="dfsjdkjf77xjxcjcj"
+W9_HTTP_PORT_SET='9001'
 
 #### --  Not allowed to edit below environments when recreate app based on existing data  -- ####
-
-W9_ID=nodenbb
+W9_ID='nodenbb'
 
 # W9_HTTP_PORT or W9_HTTPS_PORT is need at leaset and used for proxy for web application
 # Some container (e.g teleport) need HTTPS access, then need to set this pra
-W9_HTTP_PORT=80
-W9_HTTPS_PORT=81
-
-W9_LOGIN_USER=admin
-# use https://1password.com/zh-cn/password-generator/  to genarate 14 bit password
-# this password can also use password file
-W9_LOGIN_PASSWORD=$W9_POWER_PASSWORD
-W9_ADMIN_PATH="/wp-login"
+W9_HTTP_PORT=4567
 
 # Container name's suffix must use one of the value
-W9_DB_EXPOSE="mysql,postgresql,mariadb,mongodb,redis"
+W9_DB_EXPOSE="postgresql"
 
 # It is used when the application APP needs to set an external URL, which can be IP(or domain), IP:PORT
 # If have protocols, should be set it in the APP's ENV
-W9_URL=internet_ip:$W9_HTTP_PORT_SET
-# modifies W9_URL on init when it is true
-W9_URL_REPLACE=true
-
+W9_URL='internet_ip:$W9_HTTP_PORT_SET'
 W9_NETWORK=websoft9
 
 #### ----------------------------------------------------------------------------------------- ####
 
 
 # Below environment is created by apphub
-
-#W9_NAME=""
-#W9_RCODE=""
\ No newline at end of file
diff --git a/apps/nodebb/Dockerfile b/apps/nodebb/Dockerfile
deleted file mode 100644
index 4364b46fb..000000000
--- a/apps/nodebb/Dockerfile
+++ /dev/null
@@ -1,21 +0,0 @@
-# image: https://hub.docker.com/r/websoft9dev/discuzq
-
-FROM ccr.ccs.tencentyun.com/discuzq/dzq:latest
-
-LABEL org.opencontainers.image.authors="https://www.websoft9.com" \
-      org.opencontainers.image.description="Application packaged by Websoft9" \
-      org.opencontainers.image.source="https://github.com/Websoft9/docker-library/tree/main/apps/opencart" \
-      org.opencontainers.image.title="OpenCart" \
-      org.opencontainers.image.vendor="Websoft9 Inc." \
-      org.opencontainers.image.version="4.0.1.1"
-
-ENV DISCUZQ_MYSQL_HOST=mysql
-ENV DISCUZQ_MYSQL_USER=discuzq
-ENV DISCUZQ_MYSQL_PASSWORD=discuzq
-ENV DISCUZQ_MYSQL_DATABASE=discuzq
-ENV DISCUZQ_SITENAME=DiscuzQ
-
-COPY cmd.sh /tmp
-RUN chmod +x /tmp/cmd.sh
-
-CMD ["/tmp/cmd.sh"]
diff --git a/apps/nodebb/Notes.md b/apps/nodebb/Notes.md
index 1fdbbb29d..8c0150c66 100644
--- a/apps/nodebb/Notes.md
+++ b/apps/nodebb/Notes.md
@@ -1,2 +1,16 @@
-# Appname
-## FAQ
+# NodeBB
+1.After the application is installed, the main container background will execute the command: npm install,  and there are no logs.  
+ 
+ Due to network issues in China, the download process is extremely slow,  resulting in very slow application initialization.
+
+2.You need to wait until the main container generates logs, and after seeing logs similar to the following:
+
+ ```Web installer listening on http://0.0.0.0:4567```
+
+ it indicates that the npm install process is complete, and the installation of NodeBB is ready to begin.
+ 
+3.NodeBB supports MongoDB, PostgreSQL, and Redis. Websoft9 is configured to use PostgreSQL exclusively. 
+
+During the initial web setup, select PostgreSQL for the database connection. 
+
+The database name, username, and password are specified in the .env file of the corresponding Gitea repository.
\ No newline at end of file
diff --git a/apps/nodebb/README.jinja2 b/apps/nodebb/README.jinja2
deleted file mode 100644
index 8949cc4e0..000000000
--- a/apps/nodebb/README.jinja2
+++ /dev/null
@@ -1,26 +0,0 @@
-# {{trademark}} on Docker  
-
-This is an **Docker Compose solution** powered by [Websoft9](https://www.websoft9.com) based on Docker for {{trademark}}:
-
-{% for ed in edition %}
- - {{ed.dist}}:  {{ ed.version | join(', ') }}
-{% endfor %}
-
-## System Requirements
-
-The following are the minimal [recommended requirements]({{requirements.url}}):
-
-* **RAM**: {{requirements.memory}} GB or more
-* **CPU**: {{requirements.cpu}} cores or higher
-* **Disk**: at least {{requirements.disk}} GB of free space
-* **bandwidth**: more fluent experience over 100M  
-
-## Install
-
-You can install this {{trademark}} by [How to use it?](https://github.com/Websoft9/docker-library#how-to-use-it).   
-
-If you want use {{trademark}} with **Websoft9 Business Support** free, you can [subscribe {{trademark}}](https://www.websoft9.com/apps) on Cloud platform
-
-## Documentation
-
-[{{trademark}} Administrator Guide](https://support.websoft9.com/docs/{{name}}) powered by Websoft9
diff --git a/apps/nodebb/docker-compose.yml b/apps/nodebb/docker-compose.yml
index b501aed86..cb2648c61 100644
--- a/apps/nodebb/docker-compose.yml
+++ b/apps/nodebb/docker-compose.yml
@@ -1,50 +1,38 @@
 # image,docs: https://hub.docker.com/_/wordpress/
+version: '3.8'
 
 services:
-
-  wordpress:
+  nodebb:
     image: $W9_REPO:$W9_VERSION
     container_name: $W9_ID
     restart: unless-stopped
-    #This is for access host from container
-    # extra_hosts: ["host.docker.internal:host-gateway"]
-    # command: |
-    #   /bin/bash -c "ping -c 3 host.docker.internal"
-    logging:
-      driver: "json-file"
-      options:
-          max-file: "5"
-          max-size: 10m
-    deploy:
-      resources:
-        limits:
-          memory: 5g
-          cpus: '0.7'
     ports:
-      - $W9_HTTP_PORT_SET:80
+      - $W9_HTTP_PORT_SET:4567
     env_file: .env
     volumes:
-      - wordpress:/var/www/html
-      - ./src/php_exra.ini:/usr/local/etc/php/conf.d/php_exra.ini
+      - nodebb-build:/usr/src/app/build
+      - nodebb-uploads:/usr/src/app/public/uploads
+      - nodebb-config:/opt/config
 
-  mariadb:
-    image: mariadb:10.4
-    container_name: $W9_ID-mariadb
+  postgres:
+    image: postgres:17.2-alpine
+    container_name: $W9_ID-postgres
     restart: unless-stopped
-    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --innodb_log_buffer_size=30M
-    volumes:
-      - mysql_data:/var/lib/mysql
     environment:
-      MYSQL_DATABASE: $W9_ID
-      MYSQL_USER: $W9_ID
-      MYSQL_PASSWORD: $W9_POWER_PASSWORD
-      MYSQL_ROOT_PASSWORD: $W9_POWER_PASSWORD
+      POSTGRES_USER: $W9_ID
+      POSTGRES_PASSWORD: $W9_POWER_PASSWORD
+      POSTGRES_DB: $W9_ID
+    volumes:
+      - postgres-data:/var/lib/postgresql/data
+
 
 volumes:
-  wordpress:
-  mysql_data:
+  nodebb-build:
+  nodebb-uploads:
+  nodebb-config:
+  postgres-data:
     
 networks:
   default:
     name: $W9_NETWORK
-    external: true
+    external: true
\ No newline at end of file
diff --git a/apps/nodebb/src/after_up.sh b/apps/nodebb/src/after_up.sh
deleted file mode 100644
index 8b1378917..000000000
--- a/apps/nodebb/src/after_up.sh
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/apps/nodebb/src/encrypt.sh b/apps/nodebb/src/encrypt.sh
deleted file mode 100644
index 2939685f7..000000000
--- a/apps/nodebb/src/encrypt.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
-clear
-
-
-
-# Add encrypt script below if use W9_ENCRYPT_PASSWORD at .env file
-# ------------- start -------------------------
-
-
-
-# ------------- end ---------------------------
diff --git a/apps/nodebb/src/filelist b/apps/nodebb/src/filelist
deleted file mode 100644
index 341240aed..000000000
--- a/apps/nodebb/src/filelist
+++ /dev/null
@@ -1,3 +0,0 @@
-docker-compose.yml
-script/test.sh
-docker
\ No newline at end of file
diff --git a/apps/nodebb/src/get_version.sh b/apps/nodebb/src/get_version.sh
deleted file mode 100644
index 8b1378917..000000000
--- a/apps/nodebb/src/get_version.sh
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/apps/nodebb/src/nginx-proxy.conf.template b/apps/nodebb/src/nginx-proxy.conf.template
deleted file mode 100644
index 951364ffe..000000000
--- a/apps/nodebb/src/nginx-proxy.conf.template
+++ /dev/null
@@ -1,57 +0,0 @@
-proxy_busy_buffers_size   512k;
-proxy_buffers   4 512k;
-proxy_buffer_size   256k;
-client_max_body_size 50m;
-# override default location /
-location / {
-        add_header       X-Served-By $host;
-        proxy_set_header Host $host;
-        proxy_set_header X-Forwarded-Scheme $scheme;
-        proxy_set_header X-Forwarded-Proto  $scheme;
-        proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
-        proxy_set_header X-Real-IP          $remote_addr;
-        proxy_pass       $forward_scheme://$server:$port$request_uri;
-        proxy_set_header Upgrade $http_upgrade;
-        proxy_set_header Connection upgrade;
-    }
-
-location /console {
-    proxy_pass http://$server:8080; 
-    proxy_http_version 1.1;
-    proxy_set_header Host $http_host;
-    proxy_set_header X-Real-IP $remote_addr;
-    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-    proxy_set_header X-Forwarded-Proto $scheme;
-}
-
-# for echo some useful information
-location / {
-    default_type text/plain;
-    return 200 'Hello World';
-}
-
-location /oida/ {
-# this is the address and port of the ORDS installation
-proxy_pass http://127.0.0.1:8080/ords/;
-
-# set Origin to blank to avoid Chrome problems with CORS
-proxy_set_header Origin "" ;
-
-# pass along some header variables with the public host name/port/and so on
-proxy_set_header Host $host;
-proxy_set_header X-Forwarded-Host $host:$server_port;
-proxy_set_header X-Real-IP $remote_addr;
-proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-proxy_set_header X-Forwarded-Proto $scheme;
-
-# this reverse proxies any "location" headers being passed in the response
-proxy_redirect http://$host/ords/ https://$host/oida/;
-
-# also tell cookies their public path
-proxy_cookie_path /ords/ /oida/;
-
-# reverse proxy links included in response (ie from ORDS webservice)
-sub_filter_types application/json ;
-sub_filter http://$host/ords/ https://$host/oida/;
-sub_filter_once off;
-}
diff --git a/apps/nodebb/src/php_exra.ini b/apps/nodebb/src/php_exra.ini
deleted file mode 100644
index b253d5718..000000000
--- a/apps/nodebb/src/php_exra.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-file_uploads = On
-max_input_time = 800
-max_execution_time = 300
-memory_limit = 600M
-upload_max_filesize = 900M
-post_max_size = 900M
-max_file_uploads = 200
-error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
\ No newline at end of file
diff --git a/apps/nodebb/src/replace_url.sh b/apps/nodebb/src/replace_url.sh
deleted file mode 100644
index f737258b3..000000000
--- a/apps/nodebb/src/replace_url.sh
+++ /dev/null
@@ -1 +0,0 @@
-# some application have write url to database or config file, once replaced url at .env, it should replace it at config file or database
\ No newline at end of file
diff --git a/apps/nodebb/variables.json b/apps/nodebb/variables.json
index a5640027a..13c3097b4 100644
--- a/apps/nodebb/variables.json
+++ b/apps/nodebb/variables.json
@@ -3,11 +3,12 @@
   "trademark": "NodeBB",
   "release": false,
   "fork_url": "https://github.com/NodeBB/NodeBB",
-  "version_from": "",
+  "version_from": "https://github.com/NodeBB/NodeBB/releases",
   "edition": [
     {
       "dist": "community",
       "version": [
+        "3.12",
         "latest"
       ]
     }