update 优化 docker 部署方式 使用 host 模式简化部署流程 降低使用成本
This commit is contained in:
parent
15d5eb858c
commit
6c1e146bc1
6
pom.xml
6
pom.xml
@ -411,8 +411,6 @@
|
|||||||
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
||||||
<profiles.active>local</profiles.active>
|
<profiles.active>local</profiles.active>
|
||||||
<logging.level>debug</logging.level>
|
<logging.level>debug</logging.level>
|
||||||
<knife4j.production>false</knife4j.production>
|
|
||||||
<endpoints.include>'*'</endpoints.include>
|
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
@ -421,8 +419,6 @@
|
|||||||
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
<!-- 环境标识,需要与配置文件的名称相对应 -->
|
||||||
<profiles.active>dev</profiles.active>
|
<profiles.active>dev</profiles.active>
|
||||||
<logging.level>debug</logging.level>
|
<logging.level>debug</logging.level>
|
||||||
<knife4j.production>false</knife4j.production>
|
|
||||||
<endpoints.include>'*'</endpoints.include>
|
|
||||||
</properties>
|
</properties>
|
||||||
<activation>
|
<activation>
|
||||||
<!-- 默认环境 -->
|
<!-- 默认环境 -->
|
||||||
@ -434,8 +430,6 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<profiles.active>prod</profiles.active>
|
<profiles.active>prod</profiles.active>
|
||||||
<logging.level>warn</logging.level>
|
<logging.level>warn</logging.level>
|
||||||
<knife4j.production>true</knife4j.production>
|
|
||||||
<endpoints.include>health, info, logfile</endpoints.include>
|
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
|
@ -8,8 +8,10 @@ RUN mkdir -p /ruoyi/server/temp
|
|||||||
|
|
||||||
WORKDIR /ruoyi/server
|
WORKDIR /ruoyi/server
|
||||||
|
|
||||||
EXPOSE 8080
|
ENV SERVER_PORT=8080
|
||||||
|
|
||||||
|
EXPOSE ${SERVER_PORT}
|
||||||
|
|
||||||
ADD ./target/ruoyi-admin.jar ./app.jar
|
ADD ./target/ruoyi-admin.jar ./app.jar
|
||||||
|
|
||||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
|
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dserver.port=${SERVER_PORT}","-jar", "app.jar"]
|
||||||
|
@ -5,7 +5,7 @@ spring.servlet.multipart.location: /ruoyi/server/temp
|
|||||||
spring.boot.admin.client:
|
spring.boot.admin.client:
|
||||||
# 增加客户端开关
|
# 增加客户端开关
|
||||||
enabled: true
|
enabled: true
|
||||||
url: http://172.30.0.90:9090/admin
|
url: http://localhost:9090/admin
|
||||||
instance:
|
instance:
|
||||||
service-host-type: IP
|
service-host-type: IP
|
||||||
username: ruoyi
|
username: ruoyi
|
||||||
@ -16,7 +16,7 @@ xxl.job:
|
|||||||
# 执行器开关
|
# 执行器开关
|
||||||
enabled: true
|
enabled: true
|
||||||
# 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。
|
# 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。
|
||||||
admin-addresses: http://172.30.0.92:9100/xxl-job-admin
|
admin-addresses: http://localhost:9100/xxl-job-admin
|
||||||
# 执行器通讯TOKEN:非空时启用
|
# 执行器通讯TOKEN:非空时启用
|
||||||
access-token: xxl-job
|
access-token: xxl-job
|
||||||
executor:
|
executor:
|
||||||
@ -51,7 +51,7 @@ spring:
|
|||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||||
url: jdbc:mysql://172.30.0.36:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
@ -63,19 +63,19 @@ spring:
|
|||||||
password:
|
password:
|
||||||
# oracle:
|
# oracle:
|
||||||
# driverClassName: oracle.jdbc.OracleDriver
|
# driverClassName: oracle.jdbc.OracleDriver
|
||||||
# url: jdbc:oracle:thin:@//172.30.0.36:1521/XE
|
# url: jdbc:oracle:thin:@//localhost:1521/XE
|
||||||
# username: ROOT
|
# username: ROOT
|
||||||
# password: root
|
# password: root
|
||||||
# druid:
|
# druid:
|
||||||
# validationQuery: SELECT 1 FROM DUAL
|
# validationQuery: SELECT 1 FROM DUAL
|
||||||
# postgres:
|
# postgres:
|
||||||
# driverClassName: org.postgresql.Driver
|
# driverClassName: org.postgresql.Driver
|
||||||
# url: jdbc:postgresql://172.30.0.36:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||||
# username: root
|
# username: root
|
||||||
# password: root
|
# password: root
|
||||||
# sqlserver:
|
# sqlserver:
|
||||||
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
# url: jdbc:sqlserver://172.30.0.36:1433;DatabaseName=tempdb;SelectMethod=cursor;rewriteBatchedStatements=true
|
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;rewriteBatchedStatements=true
|
||||||
# username: SA
|
# username: SA
|
||||||
# password: root
|
# password: root
|
||||||
druid:
|
druid:
|
||||||
@ -128,7 +128,7 @@ spring.datasource.druid:
|
|||||||
spring:
|
spring:
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: 172.30.0.48
|
host: localhost
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
|
@ -258,9 +258,9 @@ management:
|
|||||||
endpoints:
|
endpoints:
|
||||||
web:
|
web:
|
||||||
exposure:
|
exposure:
|
||||||
# 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
include: '*'
|
||||||
# 生产环境不建议放开所有 根据项目需求放开即可
|
|
||||||
include: @endpoints.include@
|
|
||||||
endpoint:
|
endpoint:
|
||||||
|
health:
|
||||||
|
show-details: ALWAYS
|
||||||
logfile:
|
logfile:
|
||||||
external-file: ./logs/sys-console.log
|
external-file: ./logs/sys-console.log
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
--- # 监控配置
|
|
||||||
spring:
|
|
||||||
boot:
|
|
||||||
admin:
|
|
||||||
# Spring Boot Admin Client 客户端的相关配置
|
|
||||||
client:
|
|
||||||
# 增加客户端开关
|
|
||||||
enabled: true
|
|
||||||
# 设置 Spring Boot Admin Server 地址
|
|
||||||
url: http://localhost:9090/admin
|
|
||||||
instance:
|
|
||||||
service-host-type: IP
|
|
||||||
username: ruoyi
|
|
||||||
password: 123456
|
|
@ -1,14 +0,0 @@
|
|||||||
--- # 监控配置
|
|
||||||
spring:
|
|
||||||
boot:
|
|
||||||
admin:
|
|
||||||
# Spring Boot Admin Client 客户端的相关配置
|
|
||||||
client:
|
|
||||||
# 增加客户端开关
|
|
||||||
enabled: true
|
|
||||||
# 设置 Spring Boot Admin Server 地址
|
|
||||||
url: http://172.30.0.90:9090/admin
|
|
||||||
instance:
|
|
||||||
service-host-type: IP
|
|
||||||
username: ruoyi
|
|
||||||
password: 123456
|
|
@ -22,12 +22,21 @@ spring:
|
|||||||
management:
|
management:
|
||||||
endpoints:
|
endpoints:
|
||||||
web:
|
web:
|
||||||
# Actuator 提供的 API 接口的根目录。默认为 /actuator
|
|
||||||
base-path: /actuator
|
|
||||||
exposure:
|
exposure:
|
||||||
# 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
include: '*'
|
||||||
# 生产环境不建议放开所有 根据项目需求放开即可
|
|
||||||
include: @endpoints.include@
|
|
||||||
endpoint:
|
endpoint:
|
||||||
|
health:
|
||||||
|
show-details: ALWAYS
|
||||||
logfile:
|
logfile:
|
||||||
external-file: ./logs/ruoyi-monitor-admin.log
|
external-file: ./logs/ruoyi-monitor-admin.log
|
||||||
|
|
||||||
|
--- # 监控配置
|
||||||
|
spring.boot.admin.client:
|
||||||
|
# 增加客户端开关
|
||||||
|
enabled: true
|
||||||
|
# 设置 Spring Boot Admin Server 地址
|
||||||
|
url: http://localhost:9090/admin
|
||||||
|
instance:
|
||||||
|
service-host-type: IP
|
||||||
|
username: ruoyi
|
||||||
|
password: 123456
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
--- # 监控配置
|
--- # 监控配置
|
||||||
spring:
|
spring.boot.admin.client:
|
||||||
boot:
|
|
||||||
admin:
|
|
||||||
# Spring Boot Admin Client 客户端的相关配置
|
|
||||||
client:
|
|
||||||
# 增加客户端开关
|
# 增加客户端开关
|
||||||
enabled: true
|
enabled: true
|
||||||
# 设置 Spring Boot Admin Server 地址
|
# 设置 Spring Boot Admin Server 地址
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
--- # 监控配置
|
--- # 监控配置
|
||||||
spring:
|
spring.boot.admin.client:
|
||||||
boot:
|
|
||||||
admin:
|
|
||||||
# Spring Boot Admin Client 客户端的相关配置
|
|
||||||
client:
|
|
||||||
# 增加客户端开关
|
# 增加客户端开关
|
||||||
enabled: true
|
enabled: true
|
||||||
# 设置 Spring Boot Admin Server 地址
|
# 设置 Spring Boot Admin Server 地址
|
||||||
url: http://172.30.0.90:9090/admin
|
url: http://localhost:9090/admin
|
||||||
instance:
|
instance:
|
||||||
service-host-type: IP
|
service-host-type: IP
|
||||||
username: ruoyi
|
username: ruoyi
|
||||||
|
@ -37,13 +37,11 @@ management:
|
|||||||
enabled: false
|
enabled: false
|
||||||
endpoints:
|
endpoints:
|
||||||
web:
|
web:
|
||||||
# Actuator 提供的 API 接口的根目录。默认为 /actuator
|
|
||||||
base-path: /actuator
|
|
||||||
exposure:
|
exposure:
|
||||||
# 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
|
include: '*'
|
||||||
# 生产环境不建议放开所有 根据项目需求放开即可
|
|
||||||
include: @endpoints.include@
|
|
||||||
endpoint:
|
endpoint:
|
||||||
|
health:
|
||||||
|
show-details: ALWAYS
|
||||||
logfile:
|
logfile:
|
||||||
external-file: ./logs/ruoyi-xxl-job-admin.log
|
external-file: ./logs/ruoyi-xxl-job-admin.log
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
# 数据挂载
|
# 数据挂载
|
||||||
- "/docker/oracle/data:/u01/app/oracle"
|
- "/docker/oracle/data:/u01/app/oracle"
|
||||||
restart: always
|
network_mode: "host"
|
||||||
|
|
||||||
# 此镜像仅用于测试 正式环境需自行安装数据库
|
# 此镜像仅用于测试 正式环境需自行安装数据库
|
||||||
sqlserver:
|
sqlserver:
|
||||||
@ -32,7 +32,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
# 数据挂载
|
# 数据挂载
|
||||||
- "/docker/sqlserver/data:/var/opt/mssql"
|
- "/docker/sqlserver/data:/var/opt/mssql"
|
||||||
restart: always
|
network_mode: "host"
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:14.2
|
image: postgres:14.2
|
||||||
@ -45,7 +45,7 @@ services:
|
|||||||
- "5432:5432"
|
- "5432:5432"
|
||||||
volumes:
|
volumes:
|
||||||
- /docker/postgres/data:/var/lib/postgresql/data
|
- /docker/postgres/data:/var/lib/postgresql/data
|
||||||
restart: always
|
network_mode: "host"
|
||||||
|
|
||||||
postgres13:
|
postgres13:
|
||||||
image: postgres:13.6
|
image: postgres:13.6
|
||||||
@ -58,4 +58,4 @@ services:
|
|||||||
- "5433:5432"
|
- "5433:5432"
|
||||||
volumes:
|
volumes:
|
||||||
- /docker/postgres13/data:/var/lib/postgresql/data
|
- /docker/postgres13/data:/var/lib/postgresql/data
|
||||||
restart: always
|
network_mode: "host"
|
||||||
|
@ -26,10 +26,7 @@ services:
|
|||||||
--explicit_defaults_for_timestamp=true
|
--explicit_defaults_for_timestamp=true
|
||||||
--lower_case_table_names=1
|
--lower_case_table_names=1
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
network_mode: "host"
|
||||||
networks:
|
|
||||||
ruoyi_net:
|
|
||||||
ipv4_address: 172.30.0.36
|
|
||||||
|
|
||||||
nginx-web:
|
nginx-web:
|
||||||
image: nginx:1.21.6
|
image: nginx:1.21.6
|
||||||
@ -50,9 +47,7 @@ services:
|
|||||||
# 日志目录
|
# 日志目录
|
||||||
- /docker/nginx/log:/var/log/nginx
|
- /docker/nginx/log:/var/log/nginx
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
network_mode: "host"
|
||||||
networks:
|
|
||||||
- ruoyi_net
|
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:6.2.7
|
image: redis:6.2.7
|
||||||
@ -69,10 +64,7 @@ services:
|
|||||||
- /docker/redis/data/:/redis/data/:rw
|
- /docker/redis/data/:/redis/data/:rw
|
||||||
command: "redis-server /redis/config/redis.conf"
|
command: "redis-server /redis/config/redis.conf"
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
network_mode: "host"
|
||||||
networks:
|
|
||||||
ruoyi_net:
|
|
||||||
ipv4_address: 172.30.0.48
|
|
||||||
|
|
||||||
minio:
|
minio:
|
||||||
image: minio/minio:RELEASE.2022-05-26T05-48-41Z
|
image: minio/minio:RELEASE.2022-05-26T05-48-41Z
|
||||||
@ -104,10 +96,7 @@ services:
|
|||||||
- /docker/minio/config:/root/.minio/
|
- /docker/minio/config:/root/.minio/
|
||||||
command: server --address ':9000' --console-address ':9001' /data # 指定容器中的目录 /data
|
command: server --address ':9000' --console-address ':9001' /data # 指定容器中的目录 /data
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
network_mode: "host"
|
||||||
networks:
|
|
||||||
ruoyi_net:
|
|
||||||
ipv4_address: 172.30.0.54
|
|
||||||
|
|
||||||
ruoyi-server1:
|
ruoyi-server1:
|
||||||
image: ruoyi/ruoyi-server:4.2.0
|
image: ruoyi/ruoyi-server:4.2.0
|
||||||
@ -115,14 +104,12 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
# 时区上海
|
# 时区上海
|
||||||
TZ: Asia/Shanghai
|
TZ: Asia/Shanghai
|
||||||
|
SERVER_PORT: 8080
|
||||||
volumes:
|
volumes:
|
||||||
# 配置文件
|
# 配置文件
|
||||||
- /docker/server1/logs/:/ruoyi/server/logs/
|
- /docker/server1/logs/:/ruoyi/server/logs/
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
network_mode: "host"
|
||||||
networks:
|
|
||||||
ruoyi_net:
|
|
||||||
ipv4_address: 172.30.0.60
|
|
||||||
|
|
||||||
ruoyi-server2:
|
ruoyi-server2:
|
||||||
image: "ruoyi/ruoyi-server:4.2.0"
|
image: "ruoyi/ruoyi-server:4.2.0"
|
||||||
@ -130,14 +117,12 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
# 时区上海
|
# 时区上海
|
||||||
TZ: Asia/Shanghai
|
TZ: Asia/Shanghai
|
||||||
|
SERVER_PORT: 8081
|
||||||
volumes:
|
volumes:
|
||||||
# 配置文件
|
# 配置文件
|
||||||
- /docker/server2/logs/:/ruoyi/server/logs/
|
- /docker/server2/logs/:/ruoyi/server/logs/
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
network_mode: "host"
|
||||||
networks:
|
|
||||||
ruoyi_net:
|
|
||||||
ipv4_address: 172.30.0.61
|
|
||||||
|
|
||||||
ruoyi-monitor-admin:
|
ruoyi-monitor-admin:
|
||||||
image: ruoyi/ruoyi-monitor-admin:4.2.0
|
image: ruoyi/ruoyi-monitor-admin:4.2.0
|
||||||
@ -149,10 +134,7 @@ services:
|
|||||||
# 配置文件
|
# 配置文件
|
||||||
- /docker/monitor/logs/:/ruoyi/monitor/logs
|
- /docker/monitor/logs/:/ruoyi/monitor/logs
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
network_mode: "host"
|
||||||
networks:
|
|
||||||
ruoyi_net:
|
|
||||||
ipv4_address: 172.30.0.90
|
|
||||||
|
|
||||||
ruoyi-xxl-job-admin:
|
ruoyi-xxl-job-admin:
|
||||||
image: ruoyi/ruoyi-xxl-job-admin:4.2.0
|
image: ruoyi/ruoyi-xxl-job-admin:4.2.0
|
||||||
@ -164,14 +146,4 @@ services:
|
|||||||
# 配置文件
|
# 配置文件
|
||||||
- /docker/xxljob/logs/:/ruoyi/xxljob/logs
|
- /docker/xxljob/logs/:/ruoyi/xxljob/logs
|
||||||
privileged: true
|
privileged: true
|
||||||
restart: always
|
network_mode: "host"
|
||||||
networks:
|
|
||||||
ruoyi_net:
|
|
||||||
ipv4_address: 172.30.0.92
|
|
||||||
|
|
||||||
networks:
|
|
||||||
ruoyi_net:
|
|
||||||
driver: bridge
|
|
||||||
ipam:
|
|
||||||
config:
|
|
||||||
- subnet: 172.30.0.0/16
|
|
||||||
|
@ -23,16 +23,16 @@ http {
|
|||||||
|
|
||||||
upstream server {
|
upstream server {
|
||||||
ip_hash;
|
ip_hash;
|
||||||
server 172.30.0.60:8080;
|
server 127.0.0.1:8080;
|
||||||
server 172.30.0.61:8080;
|
server 127.0.0.1:8081;
|
||||||
}
|
}
|
||||||
|
|
||||||
upstream monitor-admin {
|
upstream monitor-admin {
|
||||||
server 172.30.0.90:9090;
|
server 127.0.0.1:9090;
|
||||||
}
|
}
|
||||||
|
|
||||||
upstream xxljob-admin {
|
upstream xxljob-admin {
|
||||||
server 172.30.0.92:9100;
|
server 127.0.0.1:9100;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user