update 优化 docker 部署方式 使用 host 模式简化部署流程 降低使用成本

feature/model
疯狂的狮子li 2 years ago
parent 15d5eb858c
commit 6c1e146bc1

@ -411,8 +411,6 @@
<!-- 环境标识,需要与配置文件的名称相对应 -->
<profiles.active>local</profiles.active>
<logging.level>debug</logging.level>
<knife4j.production>false</knife4j.production>
<endpoints.include>'*'</endpoints.include>
</properties>
</profile>
<profile>
@ -421,8 +419,6 @@
<!-- 环境标识,需要与配置文件的名称相对应 -->
<profiles.active>dev</profiles.active>
<logging.level>debug</logging.level>
<knife4j.production>false</knife4j.production>
<endpoints.include>'*'</endpoints.include>
</properties>
<activation>
<!-- 默认环境 -->
@ -434,8 +430,6 @@
<properties>
<profiles.active>prod</profiles.active>
<logging.level>warn</logging.level>
<knife4j.production>true</knife4j.production>
<endpoints.include>health, info, logfile</endpoints.include>
</properties>
</profile>
</profiles>

@ -8,8 +8,10 @@ RUN mkdir -p /ruoyi/server/temp
WORKDIR /ruoyi/server
EXPOSE 8080
ENV SERVER_PORT=8080
EXPOSE ${SERVER_PORT}
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:
# 增加客户端开关
enabled: true
url: http://172.30.0.90:9090/admin
url: http://localhost:9090/admin
instance:
service-host-type: IP
username: ruoyi
@ -16,7 +16,7 @@ xxl.job:
# 执行器开关
enabled: true
# 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。
admin-addresses: http://172.30.0.92:9100/xxl-job-admin
admin-addresses: http://localhost:9100/xxl-job-admin
# 执行器通讯TOKEN非空时启用
access-token: xxl-job
executor:
@ -51,7 +51,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# 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
password: root
# 从库数据源
@ -63,19 +63,19 @@ spring:
password:
# oracle:
# driverClassName: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@//172.30.0.36:1521/XE
# url: jdbc:oracle:thin:@//localhost:1521/XE
# username: ROOT
# password: root
# druid:
# validationQuery: SELECT 1 FROM DUAL
# postgres:
# 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
# password: root
# sqlserver:
# 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
# password: root
druid:
@ -128,7 +128,7 @@ spring.datasource.druid:
spring:
redis:
# 地址
host: 172.30.0.48
host: localhost
# 端口默认为6379
port: 6379
# 数据库索引

@ -258,9 +258,9 @@ management:
endpoints:
web:
exposure:
# 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
# 生产环境不建议放开所有 根据项目需求放开即可
include: @endpoints.include@
include: '*'
endpoint:
health:
show-details: ALWAYS
logfile:
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:
endpoints:
web:
# Actuator 提供的 API 接口的根目录。默认为 /actuator
base-path: /actuator
exposure:
# 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
# 生产环境不建议放开所有 根据项目需求放开即可
include: @endpoints.include@
include: '*'
endpoint:
health:
show-details: ALWAYS
logfile:
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,17 +1,13 @@
--- # 监控配置
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
spring.boot.admin.client:
# 增加客户端开关
enabled: true
# 设置 Spring Boot Admin Server 地址
url: http://localhost:9090/admin
instance:
service-host-type: IP
username: ruoyi
password: 123456
--- # 数据库配置
spring:

@ -1,17 +1,13 @@
--- # 监控配置
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
spring.boot.admin.client:
# 增加客户端开关
enabled: true
# 设置 Spring Boot Admin Server 地址
url: http://localhost:9090/admin
instance:
service-host-type: IP
username: ruoyi
password: 123456
--- # 数据库配置
spring:

@ -37,13 +37,11 @@ management:
enabled: false
endpoints:
web:
# Actuator 提供的 API 接口的根目录。默认为 /actuator
base-path: /actuator
exposure:
# 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
# 生产环境不建议放开所有 根据项目需求放开即可
include: @endpoints.include@
include: '*'
endpoint:
health:
show-details: ALWAYS
logfile:
external-file: ./logs/ruoyi-xxl-job-admin.log

@ -16,7 +16,7 @@ services:
volumes:
# 数据挂载
- "/docker/oracle/data:/u01/app/oracle"
restart: always
network_mode: "host"
# 此镜像仅用于测试 正式环境需自行安装数据库
sqlserver:
@ -32,7 +32,7 @@ services:
volumes:
# 数据挂载
- "/docker/sqlserver/data:/var/opt/mssql"
restart: always
network_mode: "host"
postgres:
image: postgres:14.2
@ -45,7 +45,7 @@ services:
- "5432:5432"
volumes:
- /docker/postgres/data:/var/lib/postgresql/data
restart: always
network_mode: "host"
postgres13:
image: postgres:13.6
@ -58,4 +58,4 @@ services:
- "5433:5432"
volumes:
- /docker/postgres13/data:/var/lib/postgresql/data
restart: always
network_mode: "host"

@ -26,10 +26,7 @@ services:
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
privileged: true
restart: always
networks:
ruoyi_net:
ipv4_address: 172.30.0.36
network_mode: "host"
nginx-web:
image: nginx:1.21.6
@ -50,9 +47,7 @@ services:
# 日志目录
- /docker/nginx/log:/var/log/nginx
privileged: true
restart: always
networks:
- ruoyi_net
network_mode: "host"
redis:
image: redis:6.2.7
@ -69,10 +64,7 @@ services:
- /docker/redis/data/:/redis/data/:rw
command: "redis-server /redis/config/redis.conf"
privileged: true
restart: always
networks:
ruoyi_net:
ipv4_address: 172.30.0.48
network_mode: "host"
minio:
image: minio/minio:RELEASE.2022-05-26T05-48-41Z
@ -104,10 +96,7 @@ services:
- /docker/minio/config:/root/.minio/
command: server --address ':9000' --console-address ':9001' /data # 指定容器中的目录 /data
privileged: true
restart: always
networks:
ruoyi_net:
ipv4_address: 172.30.0.54
network_mode: "host"
ruoyi-server1:
image: ruoyi/ruoyi-server:4.2.0
@ -115,14 +104,12 @@ services:
environment:
# 时区上海
TZ: Asia/Shanghai
SERVER_PORT: 8080
volumes:
# 配置文件
- /docker/server1/logs/:/ruoyi/server/logs/
privileged: true
restart: always
networks:
ruoyi_net:
ipv4_address: 172.30.0.60
network_mode: "host"
ruoyi-server2:
image: "ruoyi/ruoyi-server:4.2.0"
@ -130,14 +117,12 @@ services:
environment:
# 时区上海
TZ: Asia/Shanghai
SERVER_PORT: 8081
volumes:
# 配置文件
- /docker/server2/logs/:/ruoyi/server/logs/
privileged: true
restart: always
networks:
ruoyi_net:
ipv4_address: 172.30.0.61
network_mode: "host"
ruoyi-monitor-admin:
image: ruoyi/ruoyi-monitor-admin:4.2.0
@ -149,10 +134,7 @@ services:
# 配置文件
- /docker/monitor/logs/:/ruoyi/monitor/logs
privileged: true
restart: always
networks:
ruoyi_net:
ipv4_address: 172.30.0.90
network_mode: "host"
ruoyi-xxl-job-admin:
image: ruoyi/ruoyi-xxl-job-admin:4.2.0
@ -164,14 +146,4 @@ services:
# 配置文件
- /docker/xxljob/logs/:/ruoyi/xxljob/logs
privileged: true
restart: always
networks:
ruoyi_net:
ipv4_address: 172.30.0.92
networks:
ruoyi_net:
driver: bridge
ipam:
config:
- subnet: 172.30.0.0/16
network_mode: "host"

@ -23,16 +23,16 @@ http {
upstream server {
ip_hash;
server 172.30.0.60:8080;
server 172.30.0.61:8080;
server 127.0.0.1:8080;
server 127.0.0.1:8081;
}
upstream monitor-admin {
server 172.30.0.90:9090;
server 127.0.0.1:9090;
}
upstream xxljob-admin {
server 172.30.0.92:9100;
server 127.0.0.1:9100;
}
server {

Loading…
Cancel
Save