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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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