2
0

feat: docker environment enhancement, support modify .env to fix in prodution env

This commit is contained in:
simonzhangsz
2024-12-13 21:28:24 +08:00
parent 476631b74b
commit e7644ea1f0
12 changed files with 93 additions and 45 deletions

7
docker/.env Normal file
View File

@@ -0,0 +1,7 @@
MYSQL_ROOT_PASSWORD=123456
MYSQL_DATABASE=wfc_system_db
MYSQL_USER=mysql
MYSQL_PASSWORD=
NACOS_SERVER_ADDR=192.168.2.248:8848
NACOS_NAME_SPACE=wfc-test
GATEWAY_ADDR=192.168.2.248:8080

View File

@@ -6,7 +6,8 @@ services:
context: ./nacos
environment:
- MODE=standalone
- NACOS_SERVER_ADDR=192.168.13.128
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
volumes:
- ./nacos/logs/:/home/nacos/logs
- ./nacos/conf/application.properties:/home/nacos/conf/application.properties
@@ -24,6 +25,7 @@ services:
ports:
- "3306:3306"
volumes:
- ./mysql/db:/docker-entrypoint-initdb.d # 挂载 SQL 文件
- ./mysql/conf:/etc/mysql/conf.d
- ./mysql/logs:/logs
- ./mysql/data:/var/lib/mysql
@@ -58,10 +60,15 @@ services:
dockerfile: dockerfile
ports:
- "8080:8080"
volumes:
- ./wfc/gateway/jar/wfc-gateway.jar:/home/wfc/wfc-gateway.jar
depends_on:
- wfc-redis
links:
- wfc-redis
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
wfc-auth:
container_name: wfc-auth
build:
@@ -69,10 +76,15 @@ services:
dockerfile: dockerfile
ports:
- "9200:9200"
volumes:
- ./wfc/auth/jar/wfc-auth.jar:/home/wfc/wfc-auth.jar
depends_on:
- wfc-redis
links:
- wfc-redis
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
wfc-modules-system:
container_name: wfc-modules-system
build:
@@ -80,12 +92,17 @@ services:
dockerfile: dockerfile
ports:
- "9201:9201"
volumes:
- ./wfc/modules/system/jar/wfc-modules-system.jar:/home/wfc/wfc-modules-system.jar
depends_on:
- wfc-redis
- wfc-mysql
links:
- wfc-redis
- wfc-mysql
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
wfc-modules-user:
container_name: wfc-modules-user
build:
@@ -93,12 +110,17 @@ services:
dockerfile: dockerfile
ports:
- "9204:9204"
volumes:
- ./wfc/modules/user/jar/wfc-modules-user.jar:/home/wfc/wfc-modules-user.jar
depends_on:
- wfc-redis
- wfc-mysql
links:
- wfc-redis
- wfc-mysql
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
wfc-modules-gen:
container_name: wfc-modules-gen
build:
@@ -106,10 +128,15 @@ services:
dockerfile: dockerfile
ports:
- "9202:9202"
volumes:
- ./wfc/modules/gen/jar/wfc-modules-gen.jar:/home/wfc/wfc-modules-gen.jar
depends_on:
- wfc-mysql
links:
- wfc-mysql
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
wfc-modules-job:
container_name: wfc-modules-job
build:
@@ -117,10 +144,15 @@ services:
dockerfile: dockerfile
ports:
- "9203:9203"
volumes:
- ./wfc/modules/job/jar/wfc-modules-job.jar:/home/wfc/wfc-modules-job.jar
depends_on:
- wfc-mysql
links:
- wfc-mysql
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
wfc-modules-file:
container_name: wfc-modules-file
build:
@@ -129,7 +161,11 @@ services:
ports:
- "9300:9300"
volumes:
- ./wfc/uploadPath:/home/wfc/uploadPath
- ./wfc/modules/file/jar/wfc-modules-file.jar:/home/wfc/wfc-modules-file.jar
- ./wfc/upload:/home/wfc/upload
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
wfc-modules-payment:
container_name: wfc-modules-payment
build:
@@ -137,10 +173,15 @@ services:
dockerfile: dockerfile
ports:
- "9306:9306"
volumes:
- ./wfc/modules/payment/jar/wfc-modules-payment.jar:/home/wfc/wfc-modules-payment.jar
depends_on:
- wfc-mysql
links:
- wfc-mysql
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
wfc-visual-monitor:
container_name: wfc-visual-monitor
build:
@@ -148,7 +189,11 @@ services:
dockerfile: dockerfile
ports:
- "9100:9100"
volumes:
- ./wfc/visual/monitor/jar/wfc-visual-monitor.jar:/home/wfc/wfc-visual-monitor.jar
environment:
- NACOS_SERVER_ADDR=${NACOS_SERVER_ADDR}
- NACOS_NAME_SPACE=${NACOS_NAME_SPACE}
wfc-nginx:
container_name: wfc-nginx
image: nginx

View File

@@ -452,7 +452,7 @@
<properties>
<!--当前环境-->
<profileName>prod</profileName>
<nacosServerAddr>192.168.2.248:8848</nacosServerAddr>
<nacosServerAddr>${NACOS_SERVER_ADDR}</nacosServerAddr>
<nacosNamespace>wfc-prod</nacosNamespace>
</properties>
</profile>

View File

@@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
config:
# 配置中心地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
# 配置文件格式
file-extension: yml
# 共享配置

View File

@@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
config:
# 配置中心地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
# 配置文件格式
file-extension: yml
# 共享配置
@@ -35,7 +35,7 @@ spring:
datasource:
ds1:
nacos:
server-addr: '@nacosServerAddr@'
server-addr: ${NACOS_SERVER_ADDR}
dataId: sentinel-wfc-gateway
groupId: DEFAULT_GROUP
data-type: json

View File

@@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
config:
# 配置中心地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
# 配置文件格式
file-extension: yml
# 共享配置

View File

@@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
config:
# 配置中心地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
# 配置文件格式
file-extension: yml
# 共享配置

View File

@@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
config:
# 配置中心地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
# 配置文件格式
file-extension: yml
# 共享配置

View File

@@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
config:
# 配置中心地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
# 配置文件格式
file-extension: yml
# 共享配置

View File

@@ -14,16 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
# server-addr: '@nacosServerAddr@'
# namespace: '@nacosNamespace@'
server-addr: ${nacos.server.ip}
namespace: ${nacosNamespace}
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
config:
# 配置中心地址
# server-addr: '@nacosServerAddr@'
# namespace: '@nacosNamespace@'
server-addr: ${nacos.server.ip}
namespace: ${nacosNamespace}
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
# 配置文件格式
file-extension: yml
# 共享配置

View File

@@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
config:
# 配置中心地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
# 配置文件格式
file-extension: yml
# 共享配置

View File

@@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
config:
# 配置中心地址
server-addr: '@nacosServerAddr@'
namespace: '@nacosNamespace@'
server-addr: ${NACOS_SERVER_ADDR}
namespace: ${NACOS_NAME_SPACE}
# 配置文件格式
file-extension: yml
# 共享配置