Merge pull request #323 from nacos-group/optimize_starter_shell

fix some issue
This commit is contained in:
paderlol 2023-03-21 20:04:01 +08:00 committed by GitHub
commit 5ddfd0fa91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 85 additions and 53 deletions

View File

@ -6,6 +6,16 @@ This project contains a Docker image meant to facilitate the deployment of [Naco
[**中文**](README_ZH.md) [**中文**](README_ZH.md)
## Note
The following environment variables have been **removed** from the default values in the new version(**Nacos 2.2.1**)
for the sake of **system security**, please add them yourself when starting up, otherwise an error will be reported at
startup.
1. ~~NACOS_AUTH_IDENTITY_KEY~~
2. ~~NACOS_AUTH_IDENTITY_VALUE~~
3. ~~NACOS_AUTH_TOKEN~~
## Project directory ## Project directory
* buildNacos makes the source code of the docker image * buildNacos makes the source code of the docker image

View File

@ -2,6 +2,14 @@
本项目是 [Nacos](https://github.com/alibaba/nacos) Server的docker镜像的build源码,以及Nacos server 在docker的单机和集群的运行例子. 本项目是 [Nacos](https://github.com/alibaba/nacos) Server的docker镜像的build源码,以及Nacos server 在docker的单机和集群的运行例子.
## 注意
从Nacos 2.2.1开始为了系统安全考虑**移除**了以下环境变量的默认值,启动时请自行添加,否则会启动报错.
1. ~~NACOS_AUTH_IDENTITY_KEY~~
2. ~~NACOS_AUTH_IDENTITY_VALUE~~
3. ~~NACOS_AUTH_TOKEN~~
## 项目目录 ## 项目目录
* buildnacos 镜像制作的源码 * buildnacos 镜像制作的源码
@ -129,7 +137,7 @@
## 属性配置列表 ## 属性配置列表
| 属性名称 | 描述 | 选项 | | 属性名称 | 描述 | 选项 |
| --------------------------------------- | -------------------------------------------------- | ------------------------------------------------------------ | |-----------------------------------------|-------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| MODE | 系统启动方式: 集群/单机 | cluster/standalone 默认 **cluster** | | MODE | 系统启动方式: 集群/单机 | cluster/standalone 默认 **cluster** |
| NACOS_SERVERS | 集群地址 | p1:port1空格ip2:port2 空格ip3:port3 | | NACOS_SERVERS | 集群地址 | p1:port1空格ip2:port2 空格ip3:port3 |
| PREFER_HOST_MODE | 支持IP还是域名模式 | hostname/ip 默认**IP** | | PREFER_HOST_MODE | 支持IP还是域名模式 | hostname/ip 默认**IP** |

View File

@ -85,13 +85,13 @@ JAVA_OPT="${JAVA_OPT} -Dnacos.member.list=${MEMBER_LIST}"
JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version "([0-9]*).*$/\1/p') JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version "([0-9]*).*$/\1/p')
if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]]; then if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]]; then
JAVA_OPT="${JAVA_OPT} -cp .:${BASE_DIR}/plugins/cmdb/*.jar:${BASE_DIR}/plugins/mysql/*.jar"
JAVA_OPT="${JAVA_OPT} -Xlog:gc*:file=${BASE_DIR}/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400" JAVA_OPT="${JAVA_OPT} -Xlog:gc*:file=${BASE_DIR}/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400"
else else
JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext:${BASE_DIR}/plugins/health:${BASE_DIR}/plugins/cmdb:${BASE_DIR}/plugins/mysql" JAVA_OPT_EXT_FIX="-Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext"
JAVA_OPT="${JAVA_OPT} -Xloggc:${BASE_DIR}/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M" JAVA_OPT="${JAVA_OPT} -Xloggc:${BASE_DIR}/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M"
fi fi
JAVA_OPT="${JAVA_OPT} -Dloader.path=${BASE_DIR}/plugins,${BASE_DIR}/plugins/health,${BASE_DIR}/plugins/cmdb,${BASE_DIR}/plugins/selector"
JAVA_OPT="${JAVA_OPT} -Dnacos.home=${BASE_DIR}" JAVA_OPT="${JAVA_OPT} -Dnacos.home=${BASE_DIR}"
JAVA_OPT="${JAVA_OPT} -jar ${BASE_DIR}/target/nacos-server.jar" JAVA_OPT="${JAVA_OPT} -jar ${BASE_DIR}/target/nacos-server.jar"
JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"

View File

@ -7,3 +7,6 @@ MYSQL_SERVICE_DB_NAME=nacos_devtest
MYSQL_SERVICE_PORT=3306 MYSQL_SERVICE_PORT=3306
MYSQL_SERVICE_USER=nacos MYSQL_SERVICE_USER=nacos
MYSQL_SERVICE_PASSWORD=nacos MYSQL_SERVICE_PASSWORD=nacos
NACOS_AUTH_IDENTITY_KEY=2222
NACOS_AUTH_IDENTITY_VALUE=2xxx
NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789

View File

@ -1,4 +1,3 @@
#nacos dev env
PREFER_HOST_MODE=hostname PREFER_HOST_MODE=hostname
NACOS_SERVERS=nacos1:8848 nacos2:8849 nacos3:8850 NACOS_SERVERS=nacos1:8848 nacos2:8849 nacos3:8850
SPRING_DATASOURCE_PLATFORM=mysql SPRING_DATASOURCE_PLATFORM=mysql
@ -8,3 +7,7 @@ MYSQL_SERVICE_PORT=3306
MYSQL_SERVICE_USER=nacos MYSQL_SERVICE_USER=nacos
MYSQL_SERVICE_PASSWORD=nacos MYSQL_SERVICE_PASSWORD=nacos
MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
NACOS_AUTH_IDENTITY_KEY=2222
NACOS_AUTH_IDENTITY_VALUE=2xxx
NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789
SPRING_DATASOURCE_PLATFORM=mysql

4
env/nacos-ip.env vendored
View File

@ -7,3 +7,7 @@ MYSQL_SERVICE_PORT=3306
MYSQL_SERVICE_USER=nacos MYSQL_SERVICE_USER=nacos
MYSQL_SERVICE_PASSWORD=nacos MYSQL_SERVICE_PASSWORD=nacos
MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
NACOS_AUTH_IDENTITY_KEY=2222
NACOS_AUTH_IDENTITY_VALUE=2xxx
NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789
SPRING_DATASOURCE_PLATFORM=mysql

View File

@ -7,3 +7,7 @@ MYSQL_SERVICE_PORT=3306
MYSQL_SERVICE_USER=nacos MYSQL_SERVICE_USER=nacos
MYSQL_SERVICE_PASSWORD=nacos MYSQL_SERVICE_PASSWORD=nacos
MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
NACOS_AUTH_IDENTITY_KEY=2222
NACOS_AUTH_IDENTITY_VALUE=2xxx
NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456789012345678901234567890123456789
SPRING_DATASOURCE_PLATFORM=mysql

View File

@ -1 +1 @@
NACOS_VERSION=v2.2.1 NACOS_VERSION=test

View File

@ -9,8 +9,8 @@ services:
ports: ports:
- "7848:7848" - "7848:7848"
- "8848:8848" - "8848:8848"
- "9848:9848" - "9868:9848"
- "9849:9849" - "9850:9849"
env_file: env_file:
- ../env/nacos-embedded.env - ../env/nacos-embedded.env
restart: always restart: always
@ -24,8 +24,8 @@ services:
ports: ports:
- "7849:7848" - "7849:7848"
- "8849:8848" - "8849:8848"
- "9849:9848" - "9869:9848"
- "9850:9849" - "9851:9849"
env_file: env_file:
- ../env/nacos-embedded.env - ../env/nacos-embedded.env
restart: always restart: always
@ -38,8 +38,8 @@ services:
ports: ports:
- "7850:7848" - "7850:7848"
- "8850:8848" - "8850:8848"
- "9850:9848" - "9870:9848"
- "9851:9849" - "9852:9849"
env_file: env_file:
- ../env/nacos-embedded.env - ../env/nacos-embedded.env
restart: always restart: always

View File

@ -9,8 +9,8 @@ services:
ports: ports:
- "7848:7848" - "7848:7848"
- "8848:8848" - "8848:8848"
- "9848:9848" - "9868:9848"
- "9849:9849" - "9850:9849"
env_file: env_file:
- ../env/nacos-hostname.env - ../env/nacos-hostname.env
restart: always restart: always
@ -27,8 +27,8 @@ services:
ports: ports:
- "7849:7848" - "7849:7848"
- "8849:8848" - "8849:8848"
- "9849:9848" - "9869:9848"
- "9850:9849" - "9851:9849"
env_file: env_file:
- ../env/nacos-hostname.env - ../env/nacos-hostname.env
restart: always restart: always
@ -44,8 +44,8 @@ services:
ports: ports:
- "7850:7848" - "7850:7848"
- "8850:8848" - "8850:8848"
- "9850:9848" - "9870:9848"
- "9851:9849" - "9852:9849"
env_file: env_file:
- ../env/nacos-hostname.env - ../env/nacos-hostname.env
restart: always restart: always