Compare commits

...

10 Commits

Author SHA1 Message Date
cxhello 26cc6b6056
refactor: Compatible with Nacos multiple versions (#464) 2025-07-24 19:40:33 +08:00
cxhello a3795ac461
feat: add Dockerfile 9848&8080 expose (#461)
* feat: add Dockerfile 9848-9849 expose

* feat: add Dockerfile 9848-9849 expose

* add Dockerfile 9848&8080 expose
2025-07-03 09:40:58 +08:00
杨翊 SionYang 9c93392805
Upgrade to 3.0.2 (#460) 2025-06-25 15:45:53 +08:00
杨翊 SionYang bcc778c832
Merge pull request #457 from nacos-group/3.x
Update readme
2025-05-22 18:11:01 +08:00
杨翊 SionYang baffa99131
Merge pull request #456 from nacos-group/3.x
3.x
2025-05-22 18:06:26 +08:00
xiweng.yy 9e80494a69 Upgrade to 3.0.1 2025-05-22 18:05:50 +08:00
xiweng.yy 74df95080f Merge branch 'refs/heads/master' into 3.x
# Conflicts:
#	build/Dockerfile
#	build/Dockerfile.Slim
#	build/bin/docker-startup.sh
#	build/conf/application.properties
#	example/.env
2025-05-22 18:04:38 +08:00
Ben e76c828582
支持通过 NACOS_CONSOLE_CONTEXTPATH 环境变量配置控制台上下文路径,默认为空 (#454)
* 支持通过 NACOS_CONSOLE_CONTEXTPATH 环境变量配置控制台上下文路径,默认 /nacos

* 支持通过 NACOS_CONSOLE_CONTEXTPATH 环境变量配置控制台上下文路径,默认为空
2025-05-22 17:58:31 +08:00
杨翊 SionYang c82efd39fd
Upgrade to 3.0.0 (#455) 2025-05-22 17:57:15 +08:00
xiweng.yy a24b728c75 Upgrade to 3.0.0 2025-04-27 13:56:06 +08:00
9 changed files with 72 additions and 24 deletions

View File

@ -40,13 +40,16 @@ docker run --name nacos-quick -e MODE=standalone -p 8848:8848 -p 9848:9848 -d na
## Advanced Usage
* Tips: You can change [the version of the Nacos image](https://hub.docker.com/r/nacos/nacos-server/tags) in the compose file from the following configuration.
* Tips: You can change [the version of the Nacos image](https://hub.docker.com/r/nacos/nacos-server/tags) in the compose
file from the following configuration.
`example/.env`
```dotenv
NACOS_VERSION=v2.3.1
```
For Mac user with Arm Chip (like M1/M2/M3 series) , you need to add `-slim` after version which support `arm` arch.
For Mac user with Arm Chip (like M1/M2/M3 series) , you need to add `-slim` after version which support `arm` arch.
```dotenv
NACOS_VERSION=v2.3.1-slim
```
@ -69,11 +72,8 @@ Run the following command
* Standalone Mysql
```powershell
# Using mysql 5.7
docker-compose -f example/standalone-mysql-5.7.yaml up
# Using mysql 8
docker-compose -f example/standalone-mysql-8.yaml up
cd example
./mysql-init.sh && docker-compose -f standalone-mysql.yaml up
```
* Standalone Nacos Cluster
@ -151,8 +151,13 @@ Run the following command
| NACOS_SECURITY_IGNORE_URLS | nacos.security.ignore.urls | default : `/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**` |
| NACOS_CONSOLE_UI_ENABLED | nacos.console.ui.enabled | default : `true` |
| NACOS_CORE_PARAM_CHECK_ENABLED | nacos.core.param.check.enabled | default : `true` |
| DB_POOL_CONNECTION_TIMEOUT | Database connection pool timeout in milliseconds | default : **30000** |
| DB_POOL_CONNECTION_TIMEOUT | Database connection pool timeout in milliseconds | default : **30000** |
| NACOS_CONSOLE_UI_ENABLED | nacos.console.ui.enabled | default : `true` |
| NACOS_CORE_PARAM_CHECK_ENABLED | nacos.core.param.check.enabled | default : `true` |
| NACOS_AUTH_ADMIN_ENABLE | nacos.core.auth.admin.enable | default : `true` |
| NACOS_AUTH_CONSOLE_ENABLE | nacos.core.auth.console.enable | default : `true` | |
| NACOS_CONSOLE_PORT | nacos.console.port | default : `8080` |
| NACOS_CONSOLE_CONTEXTPATH | nacos.console.contextPath | default : `` |
## Advanced configuration

View File

@ -50,11 +50,8 @@
* Standalone Mysql
```powershell
# Using mysql 5.7
docker-compose -f example/standalone-mysql-5.7.yaml up
# Using mysql 8
docker-compose -f example/standalone-mysql-8.yaml up
cd example
./mysql-init.sh && docker-compose -f standalone-mysql.yaml up
```
* docker单节点部署集群模式
@ -171,10 +168,12 @@
| NACOS_AUTH_IDENTITY_VALUE | nacos.core.auth.server.identity.value | `注意该环境变量在Nacos 2.2.1版本中已移除` |
| NACOS_SECURITY_IGNORE_URLS | nacos.security.ignore.urls | default : `/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**` |
| DB_POOL_CONNECTION_TIMEOUT | 数据库连接池超时时间,单位为毫秒 | 默认 : **30000** |
| NACOS_CONSOLE_UI_ENABLED | nacos.console.ui.enabled | default : `true` |
| NACOS_CORE_PARAM_CHECK_ENABLED | nacos.core.param.check.enabled | default : `true` |
| NACOS_AUTH_ADMIN_ENABLE | nacos.core.auth.admin.enable | default : `true` |
| NACOS_AUTH_CONSOLE_ENABLE | nacos.core.auth.console.enable | default : `true` | |
| NACOS_CONSOLE_PORT | nacos.console.port | default : `8080` |
| NACOS_CONSOLE_CONTEXTPATH | nacos.console.contextPath | default : `` |
## 高级配置

View File

@ -23,7 +23,7 @@ ENV MODE="cluster" \
TOMCAT_ACCESSLOG_ENABLED="false" \
TIME_ZONE="Asia/Shanghai"
ARG NACOS_VERSION=3.0.0
ARG NACOS_VERSION=3.0.2
ARG HOT_FIX_FLAG=""
WORKDIR $BASE_DIR
@ -46,4 +46,5 @@ RUN mkdir -p logs \
&& chmod +x bin/docker-startup.sh
EXPOSE 8848
EXPOSE 9848 8080
ENTRYPOINT ["sh","bin/docker-startup.sh"]

View File

@ -1,6 +1,6 @@
FROM amd64/buildpack-deps:buster-curl as installer
ARG NACOS_VERSION=3.0.0
ARG NACOS_VERSION=3.0.2
ARG HOT_FIX_FLAG=""
RUN set -x \
@ -45,4 +45,5 @@ RUN mkdir -p logs \
RUN chmod +x bin/docker-startup.sh
EXPOSE 8848
EXPOSE 9848 8080
ENTRYPOINT ["bin/docker-startup.sh"]

View File

@ -92,6 +92,14 @@ if [[ ! -z "${NACOS_AUTH_ENABLE}" ]]; then
JAVA_OPT="${JAVA_OPT} -Dnacos.core.auth.enabled=${NACOS_AUTH_ENABLE}"
fi
if [[ ! -z "${NACOS_AUTH_ADMIN_ENABLE}" ]]; then
JAVA_OPT="${JAVA_OPT} -Dnacos.core.auth.admin.enabled=${NACOS_AUTH_ADMIN_ENABLE}"
fi
if [[ ! -z "${NACOS_AUTH_CONSOLE_ENABLE}" ]]; then
JAVA_OPT="${JAVA_OPT} -Dnacos.core.auth.console.enabled=${NACOS_AUTH_CONSOLE_ENABLE}"
fi
if [[ -z "${NACOS_AUTH_TOKEN}" ]]; then
echo "env NACOS_AUTH_TOKEN must be set with Base64 String."
exit 255

View File

@ -194,7 +194,7 @@ server.error.include-message=ALWAYS
### Nacos Console Main port
nacos.console.port=${NACOS_CONSOLE_PORT:8080}
### Nacos Server Web context path:
nacos.console.contextPath=
nacos.console.contextPath=${NACOS_CONSOLE_CONTEXTPATH:}
### Nacos Server context path, which link to nacos server `nacos.server.contextPath`, works when deployment type is `console`
nacos.console.remote.server.context-path=${SERVER_SERVLET_CONTEXTPATH:/nacos}

View File

@ -1 +1 @@
NACOS_VERSION=v3.0.0
NACOS_VERSION=v3.0.2

33
example/mysql-init.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
set -e
# 加载 NACOS_VERSION
source .env
CLEAN_VERSION=${NACOS_VERSION#v}
SCHEMA_URL="https://raw.githubusercontent.com/alibaba/nacos/${CLEAN_VERSION}/distribution/conf/mysql-schema.sql"
TARGET_DIR="./mysql-init"
VERSIONED_FILE="${TARGET_DIR}/${NACOS_VERSION}-mysql-schema.sql"
FINAL_FILE="${TARGET_DIR}/mysql-schema.sql"
# 创建目录
mkdir -p "${TARGET_DIR}"
# 下载 schema 文件
echo "⬇️ Downloading MySQL schema for Nacos ${CLEAN_VERSION}..."
curl -sSL "$SCHEMA_URL" -o "${VERSIONED_FILE}"
# 校验下载
if [ ! -s "${VERSIONED_FILE}" ]; then
echo "❌ Failed to download schema file from $SCHEMA_URL"
exit 1
fi
# 拷贝为标准文件名供 MySQL 初始化使用
cp "${VERSIONED_FILE}" "${FINAL_FILE}"
# 删除原始版本号文件
rm -f "${VERSIONED_FILE}"
echo "✅ Downloaded and prepared: ${FINAL_FILE}"

View File

@ -17,14 +17,15 @@ services:
restart: always
mysql:
container_name: mysql
build:
context: .
dockerfile: ./image/mysql/8/Dockerfile
image: example/mysql:8.0.30
image: mysql:8.0.30
env_file:
- ../env/mysql.env
volumes:
- ./mysql:/var/lib/mysql
- ./mysql-init:/docker-entrypoint-initdb.d/
command:
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
ports:
- "3306:3306"
healthcheck: