Compare commits
14 Commits
Author | SHA1 | Date |
---|---|---|
|
ecbdb600f7 | |
|
9f6e41db0c | |
|
40fa086e63 | |
|
f49a9ff0d6 | |
|
26cc6b6056 | |
|
a3795ac461 | |
|
9c93392805 | |
|
bcc778c832 | |
|
baffa99131 | |
|
9e80494a69 | |
|
74df95080f | |
|
e76c828582 | |
|
c82efd39fd | |
|
a24b728c75 |
71
README.md
71
README.md
|
@ -34,21 +34,46 @@ startup.
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
|
### Nacos v3.x
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
docker run --name nacos-quick -e MODE=standalone -p 8848:8848 -p 9848:9848 -d nacos/nacos-server:v2.2.0
|
docker run --name nacos-standalone-derby \
|
||||||
|
-e MODE=standalone \
|
||||||
|
-e NACOS_AUTH_TOKEN=${your_nacos_auth_secret_token} \
|
||||||
|
-e NACOS_AUTH_IDENTITY_KEY=${your_nacos_server_identity_key} \
|
||||||
|
-e NACOS_AUTH_IDENTITY_VALUE=${your_nacos_server_identity_value} \
|
||||||
|
-p 8080:8080 \
|
||||||
|
-p 8848:8848 \
|
||||||
|
-p 9848:9848 \
|
||||||
|
-d nacos/nacos-server:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Nacos v2.x
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker run --name nacos-standalone-derby-v2.5.1 \
|
||||||
|
-e MODE=standalone \
|
||||||
|
-e NACOS_AUTH_ENABLE=true \
|
||||||
|
-e NACOS_AUTH_TOKEN=${your_nacos_auth_secret_token} \
|
||||||
|
-e NACOS_AUTH_IDENTITY_KEY=${your_nacos_server_identity_key} \
|
||||||
|
-e NACOS_AUTH_IDENTITY_VALUE=${your_nacos_server_identity_value} \
|
||||||
|
-p 8848:8848 \
|
||||||
|
-p 9848:9848 \
|
||||||
|
-d nacos/nacos-server:v2.5.1
|
||||||
```
|
```
|
||||||
|
|
||||||
## Advanced Usage
|
## 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`
|
||||||
`example/.env`
|
|
||||||
|
|
||||||
```dotenv
|
```dotenv
|
||||||
NACOS_VERSION=v2.3.1
|
NACOS_VERSION=v3.0.3
|
||||||
```
|
```
|
||||||
|
|
||||||
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
|
```dotenv
|
||||||
NACOS_VERSION=v2.3.1-slim
|
NACOS_VERSION=v3.0.3-slim
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the following command:
|
Run the following command:
|
||||||
|
@ -60,20 +85,24 @@ Run the following command:
|
||||||
cd nacos-docker
|
cd nacos-docker
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
* Standalone Derby
|
* Standalone Derby
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
docker-compose -f example/standalone-derby.yaml up
|
docker-compose -f example/standalone-derby.yaml up
|
||||||
```
|
```
|
||||||
|
|
||||||
* Standalone Mysql
|
* Standalone Mysql
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
# Using mysql 5.7
|
cd example
|
||||||
docker-compose -f example/standalone-mysql-5.7.yaml up
|
./mysql-init.sh && docker-compose -f standalone-mysql.yaml up
|
||||||
|
```
|
||||||
|
|
||||||
# Using mysql 8
|
* Standalone Independent Mysql(Only Nacos 3.x is supported)
|
||||||
docker-compose -f example/standalone-mysql-8.yaml up
|
|
||||||
|
```powershell
|
||||||
|
cd example
|
||||||
|
./mysql-init.sh && docker-compose -f standalone-independent-mysql.yaml up
|
||||||
```
|
```
|
||||||
|
|
||||||
* Standalone Nacos Cluster
|
* Standalone Nacos Cluster
|
||||||
|
@ -82,36 +111,34 @@ Run the following command:
|
||||||
docker-compose -f example/cluster-hostname.yaml up
|
docker-compose -f example/cluster-hostname.yaml up
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
* Service registration
|
* Service registration
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
curl -X POST 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'
|
curl -X POST 'http://127.0.0.1:8848/nacos/v3/client/ns/instance?serviceName=quickstart.test.service&ip=127.0.0.1&port=8080
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* Service discovery
|
* Service discovery
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
curl -X GET 'http://127.0.0.1:8848/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName'
|
curl -X GET 'http://127.0.0.1:8848/nacos/v3/client/ns/instance/list?serviceName=quickstart.test.service'
|
||||||
```
|
```
|
||||||
|
|
||||||
* Publish config
|
* Publish config
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld"
|
curl -X POST 'http://127.0.0.1:8848/nacos/v3/auth/user/login' -d 'username=nacos' -d 'password=${your_password}'
|
||||||
|
curl -X POST 'http://127.0.0.1:8848/nacos/v3/admin/cs/config?dataId=quickstart.test.config&groupName=test&content=HelloWorld' -H "accessToken:${your_access_token}"
|
||||||
```
|
```
|
||||||
|
|
||||||
* Get config
|
* Get config
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
curl -X GET "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test"
|
curl -X GET 'http://127.0.0.1:8848/nacos/v3/client/cs/config?dataId=quickstart.test.config&groupName=test'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
* Open the Nacos console in your browser
|
* Open the Nacos console in your browser
|
||||||
|
|
||||||
link:http://127.0.0.1:8848/nacos/
|
link:http://127.0.0.1:8080/index.html
|
||||||
|
|
||||||
## Common property configuration
|
## Common property configuration
|
||||||
|
|
||||||
|
@ -152,7 +179,13 @@ Run the following command:
|
||||||
| NACOS_CONSOLE_UI_ENABLED | nacos.console.ui.enabled | default : `true` |
|
| NACOS_CONSOLE_UI_ENABLED | nacos.console.ui.enabled | default : `true` |
|
||||||
| NACOS_CORE_PARAM_CHECK_ENABLED | nacos.core.param.check.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 : `` |
|
||||||
|
| NACOS_DEPLOYMENT_TYPE | nacos.deployment.type | default : `merged` support config `server` `console` |
|
||||||
|
|
||||||
## Advanced configuration
|
## Advanced configuration
|
||||||
|
|
||||||
|
|
122
README_ZH.md
122
README_ZH.md
|
@ -1,7 +1,11 @@
|
||||||
# Nacos Docker
|
# Nacos Docker
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
本项目是 [Nacos](https://github.com/alibaba/nacos) Server的docker镜像的build源码,以及Nacos server 在docker的单机和集群的运行例子.
|
本项目是 [Nacos](https://github.com/alibaba/nacos) Server的docker镜像的build源码,以及Nacos server 在docker的单机和集群的运行例子.
|
||||||
|
|
||||||
|
[**English**](README.md)
|
||||||
|
|
||||||
## 注意
|
## 注意
|
||||||
|
|
||||||
从Nacos 2.2.1开始为了系统安全考虑**移除**了以下环境变量的默认值,启动时请自行添加,否则会启动报错.
|
从Nacos 2.2.1开始为了系统安全考虑**移除**了以下环境变量的默认值,启动时请自行添加,否则会启动报错.
|
||||||
|
@ -26,11 +30,52 @@
|
||||||
镜像以后,移除了数据库主从镜像,具体原因请参考[移除主从镜像配置](https://github.com/nacos-group/nacos-docker/wiki/%E7%A7%BB%E9%99%A4%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B8%BB%E4%BB%8E%E9%95%9C%E5%83%8F%E9%85%8D%E7%BD%AE)
|
镜像以后,移除了数据库主从镜像,具体原因请参考[移除主从镜像配置](https://github.com/nacos-group/nacos-docker/wiki/%E7%A7%BB%E9%99%A4%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B8%BB%E4%BB%8E%E9%95%9C%E5%83%8F%E9%85%8D%E7%BD%AE)
|
||||||
* 从Nacos 1.3.1版本开始,数据库存储已经升级到8.0, 并且它向下兼容
|
* 从Nacos 1.3.1版本开始,数据库存储已经升级到8.0, 并且它向下兼容
|
||||||
* 例子演示中使用的数据库是为了方便定制了官方Mysql镜像, 自动初始化的数据库脚本.
|
* 例子演示中使用的数据库是为了方便定制了官方Mysql镜像, 自动初始化的数据库脚本.
|
||||||
* 如果你使用自定义数据库,
|
* 如果你使用自定义数据库, 第一次启动Nacos前需要手动初始化 [数据库脚本](https://github.com/alibaba/nacos/blob/master/distribution/conf/mysql-schema.sql)
|
||||||
第一次启动Nacos前需要手动初始化 [数据库脚本](https://github.com/alibaba/nacos/blob/master/distribution/conf/mysql-schema.sql)
|
|
||||||
|
|
||||||
## 快速开始
|
## 快速开始
|
||||||
|
|
||||||
|
### Nacos v3.x
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker run --name nacos-standalone-derby \
|
||||||
|
-e MODE=standalone \
|
||||||
|
-e NACOS_AUTH_TOKEN=${your_nacos_auth_secret_token} \
|
||||||
|
-e NACOS_AUTH_IDENTITY_KEY=${your_nacos_server_identity_key} \
|
||||||
|
-e NACOS_AUTH_IDENTITY_VALUE=${your_nacos_server_identity_value} \
|
||||||
|
-p 8080:8080 \
|
||||||
|
-p 8848:8848 \
|
||||||
|
-p 9848:9848 \
|
||||||
|
-d nacos/nacos-server:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Nacos v2.x
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker run --name nacos-standalone-derby-v2.5.1 \
|
||||||
|
-e MODE=standalone \
|
||||||
|
-e NACOS_AUTH_ENABLE=true \
|
||||||
|
-e NACOS_AUTH_TOKEN=${your_nacos_auth_secret_token} \
|
||||||
|
-e NACOS_AUTH_IDENTITY_KEY=${your_nacos_server_identity_key} \
|
||||||
|
-e NACOS_AUTH_IDENTITY_VALUE=${your_nacos_server_identity_value} \
|
||||||
|
-p 8848:8848 \
|
||||||
|
-p 9848:9848 \
|
||||||
|
-d nacos/nacos-server:v2.5.1
|
||||||
|
```
|
||||||
|
|
||||||
|
## 其他使用方式
|
||||||
|
|
||||||
|
* 提示: 你需要通过 `example/.env` 中的以下配置来更改 Compose 文件中 [Nacos 镜像版本](https://hub.docker.com/r/nacos/nacos-server/tags)。
|
||||||
|
|
||||||
|
```dotenv
|
||||||
|
NACOS_VERSION=v3.0.3
|
||||||
|
```
|
||||||
|
|
||||||
|
对于使用 Arm 芯片(如 M1/M2/M3 系列)的 Mac 用户,需要在支持 `arm` arch 的版本后添加 `-slim`。
|
||||||
|
|
||||||
|
```dotenv
|
||||||
|
NACOS_VERSION=v3.0.3-slim
|
||||||
|
```
|
||||||
|
|
||||||
打开命令窗口执行:
|
打开命令窗口执行:
|
||||||
|
|
||||||
* Clone project
|
* Clone project
|
||||||
|
@ -40,7 +85,6 @@
|
||||||
cd nacos-docker
|
cd nacos-docker
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
* Standalone Derby
|
* Standalone Derby
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
|
@ -50,11 +94,14 @@
|
||||||
* Standalone Mysql
|
* Standalone Mysql
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
# Using mysql 5.7
|
cd example
|
||||||
docker-compose -f example/standalone-mysql-5.7.yaml up
|
./mysql-init.sh && docker-compose -f standalone-mysql.yaml up
|
||||||
|
```
|
||||||
|
* Standalone Independent Mysql(仅支持 Nacos 3.x 版本)
|
||||||
|
|
||||||
# Using mysql 8
|
```powershell
|
||||||
docker-compose -f example/standalone-mysql-8.yaml up
|
cd example
|
||||||
|
./mysql-init.sh && docker-compose -f standalone-independent-mysql.yaml up
|
||||||
```
|
```
|
||||||
|
|
||||||
* docker单节点部署集群模式
|
* docker单节点部署集群模式
|
||||||
|
@ -63,76 +110,34 @@
|
||||||
docker-compose -f example/cluster-hostname.yaml up
|
docker-compose -f example/cluster-hostname.yaml up
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
* 服务注册示例
|
* 服务注册示例
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
curl -X PUT 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'
|
curl -X POST 'http://127.0.0.1:8848/nacos/v3/client/ns/instance?serviceName=quickstart.test.service&ip=127.0.0.1&port=8080
|
||||||
```
|
```
|
||||||
|
|
||||||
* 服务发现示例
|
* 服务发现示例
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
curl -X GET 'http://127.0.0.1:8848/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName'
|
curl -X GET 'http://127.0.0.1:8848/nacos/v3/client/ns/instance/list?serviceName=quickstart.test.service'
|
||||||
```
|
```
|
||||||
|
|
||||||
* 推送配置示例
|
* 推送配置示例
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld"
|
curl -X POST 'http://127.0.0.1:8848/nacos/v3/auth/user/login' -d 'username=nacos' -d 'password=${your_password}'
|
||||||
|
curl -X POST 'http://127.0.0.1:8848/nacos/v3/admin/cs/config?dataId=quickstart.test.config&groupName=test&content=HelloWorld' -H "accessToken:${your_access_token}"
|
||||||
```
|
```
|
||||||
|
|
||||||
* 获取配置示例
|
* 获取配置示例
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
curl -X GET "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test"
|
curl -X GET 'http://127.0.0.1:8848/nacos/v3/client/cs/config?dataId=quickstart.test.config&groupName=test'
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
* 打开浏览器
|
|
||||||
|
|
||||||
link:http://127.0.0.1:8848/nacos/
|
|
||||||
|
|
||||||
## 其他使用方式
|
|
||||||
|
|
||||||
打开命令窗口执行:
|
|
||||||
|
|
||||||
* Clone 项目 并且进入项目根目录
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
git clone https://github.com/paderlol/nacos-docker.git
|
|
||||||
cd nacos-docker
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
* 单机
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
docker-compose -f standalone.yaml up
|
|
||||||
```
|
|
||||||
|
|
||||||
* 集群
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
docker-compose -f cluster-hostname.yaml up
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
* 注册服务
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
curl -X PUT 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'
|
|
||||||
```
|
|
||||||
|
|
||||||
* 注册配置
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* 访问控制台
|
* 访问控制台
|
||||||
|
|
||||||
浏览器访问:http://127.0.0.1:8848/nacos/
|
浏览器访问:http://127.0.0.1:8080/index.html
|
||||||
|
|
||||||
## 属性配置列表
|
## 属性配置列表
|
||||||
|
|
||||||
|
@ -171,10 +176,13 @@
|
||||||
| NACOS_AUTH_IDENTITY_VALUE | nacos.core.auth.server.identity.value | `注意:该环境变量在Nacos 2.2.1版本中已移除` |
|
| 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/**` |
|
| 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** |
|
| DB_POOL_CONNECTION_TIMEOUT | 数据库连接池超时时间,单位为毫秒 | 默认 : **30000** |
|
||||||
|
|
||||||
| NACOS_CONSOLE_UI_ENABLED | nacos.console.ui.enabled | default : `true` |
|
| NACOS_CONSOLE_UI_ENABLED | nacos.console.ui.enabled | default : `true` |
|
||||||
| NACOS_CORE_PARAM_CHECK_ENABLED | nacos.core.param.check.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 : `` |
|
||||||
|
| NACOS_DEPLOYMENT_TYPE | nacos.deployment.type | default : `merged` 支持配置 `server` `console` |
|
||||||
|
|
||||||
## 高级配置
|
## 高级配置
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ ENV MODE="cluster" \
|
||||||
TOMCAT_ACCESSLOG_ENABLED="false" \
|
TOMCAT_ACCESSLOG_ENABLED="false" \
|
||||||
TIME_ZONE="Asia/Shanghai"
|
TIME_ZONE="Asia/Shanghai"
|
||||||
|
|
||||||
ARG NACOS_VERSION=3.0.0
|
ARG NACOS_VERSION=3.0.3
|
||||||
ARG HOT_FIX_FLAG=""
|
ARG HOT_FIX_FLAG=""
|
||||||
|
|
||||||
WORKDIR $BASE_DIR
|
WORKDIR $BASE_DIR
|
||||||
|
@ -46,4 +46,5 @@ RUN mkdir -p logs \
|
||||||
&& chmod +x bin/docker-startup.sh
|
&& chmod +x bin/docker-startup.sh
|
||||||
|
|
||||||
EXPOSE 8848
|
EXPOSE 8848
|
||||||
|
EXPOSE 9848 8080
|
||||||
ENTRYPOINT ["sh","bin/docker-startup.sh"]
|
ENTRYPOINT ["sh","bin/docker-startup.sh"]
|
|
@ -1,6 +1,6 @@
|
||||||
FROM amd64/buildpack-deps:buster-curl as installer
|
FROM amd64/buildpack-deps:buster-curl as installer
|
||||||
|
|
||||||
ARG NACOS_VERSION=3.0.0
|
ARG NACOS_VERSION=3.0.3
|
||||||
ARG HOT_FIX_FLAG=""
|
ARG HOT_FIX_FLAG=""
|
||||||
|
|
||||||
RUN set -x \
|
RUN set -x \
|
||||||
|
@ -45,4 +45,5 @@ RUN mkdir -p logs \
|
||||||
RUN chmod +x bin/docker-startup.sh
|
RUN chmod +x bin/docker-startup.sh
|
||||||
|
|
||||||
EXPOSE 8848
|
EXPOSE 8848
|
||||||
|
EXPOSE 9848 8080
|
||||||
ENTRYPOINT ["bin/docker-startup.sh"]
|
ENTRYPOINT ["bin/docker-startup.sh"]
|
||||||
|
|
|
@ -92,6 +92,14 @@ if [[ ! -z "${NACOS_AUTH_ENABLE}" ]]; then
|
||||||
JAVA_OPT="${JAVA_OPT} -Dnacos.core.auth.enabled=${NACOS_AUTH_ENABLE}"
|
JAVA_OPT="${JAVA_OPT} -Dnacos.core.auth.enabled=${NACOS_AUTH_ENABLE}"
|
||||||
fi
|
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
|
if [[ -z "${NACOS_AUTH_TOKEN}" ]]; then
|
||||||
echo "env NACOS_AUTH_TOKEN must be set with Base64 String."
|
echo "env NACOS_AUTH_TOKEN must be set with Base64 String."
|
||||||
exit 255
|
exit 255
|
||||||
|
@ -132,7 +140,7 @@ JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"
|
||||||
JAVA_OPT="${JAVA_OPT} --spring.config.additional-location=${CUSTOM_SEARCH_LOCATIONS}"
|
JAVA_OPT="${JAVA_OPT} --spring.config.additional-location=${CUSTOM_SEARCH_LOCATIONS}"
|
||||||
JAVA_OPT="${JAVA_OPT} --spring.config.name=${CUSTOM_SEARCH_NAMES}"
|
JAVA_OPT="${JAVA_OPT} --spring.config.name=${CUSTOM_SEARCH_NAMES}"
|
||||||
JAVA_OPT="${JAVA_OPT} --logging.config=${BASE_DIR}/conf/nacos-logback.xml"
|
JAVA_OPT="${JAVA_OPT} --logging.config=${BASE_DIR}/conf/nacos-logback.xml"
|
||||||
JAVA_OPT="${JAVA_OPT} --server.max-http-header-size=524288"
|
JAVA_OPT="${JAVA_OPT} --server.max-http-request-header-size=524288"
|
||||||
|
|
||||||
echo "Nacos is starting, you can docker logs your container"
|
echo "Nacos is starting, you can docker logs your container"
|
||||||
exec $JAVA ${JAVA_OPT}
|
exec $JAVA ${JAVA_OPT}
|
||||||
|
|
|
@ -194,7 +194,7 @@ server.error.include-message=ALWAYS
|
||||||
### Nacos Console Main port
|
### Nacos Console Main port
|
||||||
nacos.console.port=${NACOS_CONSOLE_PORT:8080}
|
nacos.console.port=${NACOS_CONSOLE_PORT:8080}
|
||||||
### Nacos Server Web context path:
|
### 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 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}
|
nacos.console.remote.server.context-path=${SERVER_SERVLET_CONTEXTPATH:/nacos}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
NACOS_VERSION=v3.0.0
|
NACOS_VERSION=v3.0.3
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
#
|
||||||
|
# Copyright 1999-2023 Alibaba Group Holding Ltd.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
#127.0.0.1:8848
|
||||||
|
host.docker.internal:8848
|
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# 加载 NACOS_VERSION
|
||||||
|
source .env
|
||||||
|
CLEAN_VERSION=${NACOS_VERSION#v}
|
||||||
|
# deal -slim
|
||||||
|
CLEAN_VERSION=${CLEAN_VERSION%-*}
|
||||||
|
|
||||||
|
SCHEMA_URL="https://raw.githubusercontent.com/alibaba/nacos/${CLEAN_VERSION}/distribution/conf/mysql-schema.sql"
|
||||||
|
|
||||||
|
TARGET_DIR="./mysql-init"
|
||||||
|
VERSIONED_FILE="${TARGET_DIR}/${CLEAN_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}"
|
|
@ -29,5 +29,5 @@ services:
|
||||||
container_name: grafana
|
container_name: grafana
|
||||||
image: grafana/grafana:latest
|
image: grafana/grafana:latest
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- "3000:3000"
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
nacos-console:
|
||||||
|
image: nacos/nacos-server:${NACOS_VERSION}
|
||||||
|
container_name: nacos-standalone-console
|
||||||
|
environment:
|
||||||
|
- NACOS_DEPLOYMENT_TYPE=console
|
||||||
|
env_file:
|
||||||
|
- ../env/nacos-standalone-mysql.env
|
||||||
|
volumes:
|
||||||
|
- ./standalone-console-logs/:/home/nacos/logs
|
||||||
|
- ./cluster.conf:/home/nacos/conf/cluster.conf
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
restart: always
|
||||||
|
nacos-server:
|
||||||
|
image: nacos/nacos-server:${NACOS_VERSION}
|
||||||
|
container_name: nacos-standalone-server
|
||||||
|
environment:
|
||||||
|
- NACOS_DEPLOYMENT_TYPE=server
|
||||||
|
env_file:
|
||||||
|
- ../env/nacos-standalone-mysql.env
|
||||||
|
volumes:
|
||||||
|
- ./standalone-server-logs/:/home/nacos/logs
|
||||||
|
ports:
|
||||||
|
- "8848:8848"
|
||||||
|
- "9848:9848"
|
||||||
|
depends_on:
|
||||||
|
mysql:
|
||||||
|
condition: service_healthy
|
||||||
|
restart: always
|
||||||
|
mysql:
|
||||||
|
container_name: mysql
|
||||||
|
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:
|
||||||
|
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 10
|
|
@ -17,14 +17,15 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
mysql:
|
mysql:
|
||||||
container_name: mysql
|
container_name: mysql
|
||||||
build:
|
image: mysql:8.0.30
|
||||||
context: .
|
|
||||||
dockerfile: ./image/mysql/8/Dockerfile
|
|
||||||
image: example/mysql:8.0.30
|
|
||||||
env_file:
|
env_file:
|
||||||
- ../env/mysql.env
|
- ../env/mysql.env
|
||||||
volumes:
|
volumes:
|
||||||
- ./mysql:/var/lib/mysql
|
- ./mysql:/var/lib/mysql
|
||||||
|
- ./mysql-init:/docker-entrypoint-initdb.d/
|
||||||
|
command:
|
||||||
|
--character-set-server=utf8mb4
|
||||||
|
--collation-server=utf8mb4_unicode_ci
|
||||||
ports:
|
ports:
|
||||||
- "3306:3306"
|
- "3306:3306"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
|
Loading…
Reference in New Issue