fix(deploy): Correct 1Panel service configuration

- Require a valid Base64 Nacos auth token in examples and docs
- Mount Nacos application config for 1Panel deployments
- Adjust service health checks and startup dependencies
This commit is contained in:
Toys-A
2026-08-06 17:11:11 +08:00
parent 53e309026f
commit 16e9d7f9bd
4 changed files with 87 additions and 14 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ JWT_EXPIRATION=86400
NACOS_USERNAME=nacos
NACOS_PASSWORD=nacos
NACOS_AUTH_TOKEN=change-me-nacos-auth-token-at-least-32-bytes-long
NACOS_AUTH_TOKEN=U0VDUkVUS0VZMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkw
GRAFANA_ADMIN_USER=admin
GRAFANA_ADMIN_PASSWORD=change-me-grafana-password
@@ -0,0 +1,27 @@
server.servlet.contextPath=/nacos
server.port=8848
spring.datasource.platform=mysql
spring.sql.init.platform=mysql
nacos.plugin.datasource-dialect.type=mysql
nacos.plugin.datasource.db.num=1
nacos.plugin.datasource.db.url.0=jdbc:mysql://${MYSQL_SERVICE_HOST:mysql}:${MYSQL_SERVICE_PORT:3306}/${MYSQL_SERVICE_DB_NAME:nacos_config}?characterEncoding=utf8&connectTimeout=10000&socketTimeout=30000&autoReconnect=true&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
nacos.plugin.datasource.db.user=${MYSQL_SERVICE_USER:root}
nacos.plugin.datasource.db.password=${MYSQL_SERVICE_PASSWORD}
db.num=1
db.url.0=jdbc:mysql://${MYSQL_SERVICE_HOST:mysql}:${MYSQL_SERVICE_PORT:3306}/${MYSQL_SERVICE_DB_NAME:nacos_config}?characterEncoding=utf8&connectTimeout=10000&socketTimeout=30000&autoReconnect=true&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
db.user.0=${MYSQL_SERVICE_USER:root}
db.password.0=${MYSQL_SERVICE_PASSWORD}
db.user=${MYSQL_SERVICE_USER:root}
db.password=${MYSQL_SERVICE_PASSWORD}
management.endpoints.web.exposure.include=*
management.metrics.export.elastic.enabled=false
management.metrics.export.influx.enabled=false
nacos.core.auth.enabled=${NACOS_AUTH_ENABLE:true}
nacos.core.auth.server.identity.key=${NACOS_AUTH_IDENTITY_KEY:serverIdentity}
nacos.core.auth.server.identity.value=${NACOS_AUTH_IDENTITY_VALUE:security}
nacos.core.auth.plugin.nacos.token.secret.key=${NACOS_AUTH_TOKEN}
+9 -12
View File
@@ -110,14 +110,11 @@ services:
PREFER_HOST_MODE: hostname
ports:
- "${LOCAL_BIND_ADDR:-127.0.0.1}:${NACOS_HTTP_PORT:-8848}:8848"
volumes:
- ./config/nacos/application-1panel.properties:/home/nacos/conf/application.properties:ro
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8848/nacos/v1/console/health/liveness"]
interval: 10s
timeout: 5s
retries: 15
networks:
- haovp-network
@@ -231,7 +228,7 @@ services:
- "${LOCAL_BIND_ADDR:-127.0.0.1}:${GATEWAY_HTTP_PORT:-9000}:9000"
depends_on:
nacos:
condition: service_healthy
condition: service_started
redis-sentinel:
condition: service_started
networks:
@@ -253,7 +250,7 @@ services:
JAVA_OPTS: ${AUTH_JAVA_OPTS:--Xms128m -Xmx256m}
depends_on:
nacos:
condition: service_healthy
condition: service_started
mysql:
condition: service_healthy
redis-sentinel:
@@ -282,7 +279,7 @@ services:
JAVA_OPTS: ${USER_JAVA_OPTS:--Xms128m -Xmx256m}
depends_on:
nacos:
condition: service_healthy
condition: service_started
mysql:
condition: service_healthy
redis-sentinel:
@@ -317,7 +314,7 @@ services:
JAVA_OPTS: ${CONTENT_JAVA_OPTS:--Xms256m -Xmx512m}
depends_on:
nacos:
condition: service_healthy
condition: service_started
mysql:
condition: service_healthy
redis-sentinel:
@@ -345,7 +342,7 @@ services:
JAVA_OPTS: ${COMMENT_JAVA_OPTS:--Xms128m -Xmx256m}
depends_on:
nacos:
condition: service_healthy
condition: service_started
mysql:
condition: service_healthy
redis-sentinel:
@@ -369,7 +366,7 @@ services:
JAVA_OPTS: ${RECOMMEND_JAVA_OPTS:--Xms128m -Xmx256m}
depends_on:
nacos:
condition: service_healthy
condition: service_started
mysql:
condition: service_healthy
redis-sentinel:
@@ -395,7 +392,7 @@ services:
JAVA_OPTS: ${ADMIN_JAVA_OPTS:--Xms128m -Xmx256m}
depends_on:
nacos:
condition: service_healthy
condition: service_started
mysql:
condition: service_healthy
redis-sentinel: