diff --git a/pom.xml b/pom.xml index c5ed42bd..f49ba5aa 100644 --- a/pom.xml +++ b/pom.xml @@ -411,8 +411,6 @@ local debug - false - '*' @@ -421,8 +419,6 @@ dev debug - false - '*' @@ -434,8 +430,6 @@ prod warn - true - health, info, logfile diff --git a/ruoyi-admin/Dockerfile b/ruoyi-admin/Dockerfile index 1bbd2ccf..7bb2b0d0 100644 --- a/ruoyi-admin/Dockerfile +++ b/ruoyi-admin/Dockerfile @@ -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"] diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml index def5f166..a42f4ad5 100644 --- a/ruoyi-admin/src/main/resources/application-prod.yml +++ b/ruoyi-admin/src/main/resources/application-prod.yml @@ -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 # 数据库索引 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 27482ac0..25940efa 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -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 diff --git a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application-dev.yml b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application-dev.yml deleted file mode 100644 index 0b10bbd7..00000000 --- a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application-dev.yml +++ /dev/null @@ -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 diff --git a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application-prod.yml b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application-prod.yml deleted file mode 100644 index 2e020390..00000000 --- a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application-prod.yml +++ /dev/null @@ -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 diff --git a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml index 128a6f98..22ef1abf 100644 --- a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml +++ b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml @@ -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 diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml index 09ed519f..fa04b568 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml @@ -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: diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-prod.yml b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-prod.yml index 401f60af..cd4057b3 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-prod.yml +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-prod.yml @@ -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: diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application.yml b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application.yml index 20227208..d4fda939 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application.yml +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application.yml @@ -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 diff --git a/script/docker/database.yml b/script/docker/database.yml index 7a70b31d..0368fd27 100644 --- a/script/docker/database.yml +++ b/script/docker/database.yml @@ -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" diff --git a/script/docker/docker-compose.yml b/script/docker/docker-compose.yml index 3dcdf32c..41f97e42 100644 --- a/script/docker/docker-compose.yml +++ b/script/docker/docker-compose.yml @@ -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" diff --git a/script/docker/nginx/nginx.conf b/script/docker/nginx/nginx.conf index ecf71955..e9630aaf 100644 --- a/script/docker/nginx/nginx.conf +++ b/script/docker/nginx/nginx.conf @@ -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 {