diff --git a/docker/deploy.sh b/docker/deploy.sh new file mode 100644 index 0000000..916d8e7 --- /dev/null +++ b/docker/deploy.sh @@ -0,0 +1,65 @@ +#!/bin/sh + +# 使用说明,用来提示输入参数 +usage() { + echo "Usage: sh 执行脚本.sh [port|base|modules|stop|rm]" + exit 1 +} + +# 开启所需端口 +port(){ + firewall-cmd --add-port=80/tcp --permanent + firewall-cmd --add-port=8080/tcp --permanent + firewall-cmd --add-port=8848/tcp --permanent + firewall-cmd --add-port=6379/tcp --permanent + firewall-cmd --add-port=3306/tcp --permanent + firewall-cmd --add-port=9100/tcp --permanent + firewall-cmd --add-port=9200/tcp --permanent + firewall-cmd --add-port=9201/tcp --permanent + firewall-cmd --add-port=9202/tcp --permanent + firewall-cmd --add-port=9203/tcp --permanent + firewall-cmd --add-port=9300/tcp --permanent + service firewalld restart +} + +# 启动基础环境(必须) +base(){ + docker-compose up -d ruoyi-mysql ruoyi-redis ruoyi-nacos ruoyi-nginx +} + +# 启动程序模块(必须) +modules(){ + docker-compose up -d ruoyi-gateway ruoyi-auth ruoyi-modules-system +} + +# 关闭所有环境/模块 +stop(){ + docker-compose stop +} + +# 删除所有环境/模块 +rm(){ + docker-compose rm +} + +# 根据输入参数,选择执行对应方法,不输入则执行使用说明 +case "$1" in +"port") + port +;; +"base") + base +;; +"modules") + modules +;; +"stop") + stop +;; +"rm") + rm +;; +*) + usage +;; +esac diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..babe485 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,138 @@ +version : '3' +services: + ruoyi-nacos: + container_name: ruoyi-nacos + image: nacos/nacos-server + build: + context: ./nacos + environment: + - MODE=standalone + volumes: + - ./nacos/logs/:/home/nacos/logs + - ./nacos/conf/application.properties:/home/nacos/conf/application.properties + ports: + - "8848:8848" + depends_on: + - ruoyi-mysql + ruoyi-mysql: + container_name: ruoyi-mysql + image: mysql:5.7 + build: + context: ./mysql + ports: + - "3306:3306" + volumes: + - ./mysql/conf:/etc/mysql/conf.d + - ./mysql/logs:/logs + - ./mysql/data:/var/lib/mysql + command: [ + 'mysqld', + '--innodb-buffer-pool-size=80M', + '--character-set-server=utf8mb4', + '--collation-server=utf8mb4_unicode_ci', + '--default-time-zone=+8:00', + '--lower-case-table-names=1' + ] + environment: + MYSQL_DATABASE: 'ry-cloud' + MYSQL_ROOT_PASSWORD: password + ruoyi-redis: + container_name: ruoyi-redis + image: redis + build: + context: ./redis + ports: + - "6379:6379" + volumes: + - ./redis/conf/redis.conf:/home/ruoyi/redis/redis.conf + - ./redis/data:/data + command: redis-server /home/ruoyi/redis/redis.conf + ruoyi-nginx: + container_name: ruoyi-nginx + image: nginx + build: + context: ./nginx + ports: + - "80:80" + volumes: + - ./nginx/html/dist:/home/ruoyi/projects/ruoyi-ui + - ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf + - ./nginx/logs:/var/log/nginx + - ./nginx/conf.d:/etc/nginx/conf.d + depends_on: + - ruoyi-gateway + links: + - ruoyi-gateway + ruoyi-gateway: + container_name: ruoyi-gateway + build: + context: ./ruoyi/gateway + dockerfile: dockerfile + ports: + - "8080:8080" + depends_on: + - ruoyi-redis + links: + - ruoyi-redis + ruoyi-auth: + container_name: ruoyi-auth + build: + context: ./ruoyi/auth + dockerfile: dockerfile + ports: + - "9200:9200" + depends_on: + - ruoyi-redis + links: + - ruoyi-redis + ruoyi-modules-system: + container_name: ruoyi-modules-system + build: + context: ./ruoyi/modules/system + dockerfile: dockerfile + ports: + - "9201:9201" + depends_on: + - ruoyi-redis + - ruoyi-mysql + links: + - ruoyi-redis + - ruoyi-mysql + ruoyi-modules-gen: + container_name: ruoyi-modules-gen + build: + context: ./ruoyi/modules/gen + dockerfile: dockerfile + ports: + - "9202:9202" + depends_on: + - ruoyi-mysql + links: + - ruoyi-mysql + ruoyi-modules-job: + container_name: ruoyi-modules-job + build: + context: ./ruoyi/modules/job + dockerfile: dockerfile + ports: + - "9203:9203" + depends_on: + - ruoyi-mysql + links: + - ruoyi-mysql + ruoyi-modules-file: + container_name: ruoyi-modules-file + build: + context: ./ruoyi/modules/file + dockerfile: dockerfile + ports: + - "9300:9300" + volumes: + - ./ruoyi/uploadPath:/home/ruoyi/uploadPath + ruoyi-visual-monitor: + container_name: ruoyi-visual-monitor + build: + context: ./ruoyi/visual/monitor + dockerfile: dockerfile + ports: + - "9100:9100" diff --git a/docker/mysql/dockerfile b/docker/mysql/dockerfile new file mode 100644 index 0000000..b35dc5f --- /dev/null +++ b/docker/mysql/dockerfile @@ -0,0 +1,7 @@ +# 基础镜像 +FROM mysql:5.7 +# author +MAINTAINER ruoyi + +# 执行sql脚本 +ADD ./db/*.sql /docker-entrypoint-initdb.d/ diff --git a/docker/nacos/conf/application.properties b/docker/nacos/conf/application.properties new file mode 100644 index 0000000..e0034a9 --- /dev/null +++ b/docker/nacos/conf/application.properties @@ -0,0 +1,32 @@ +spring.datasource.platform=mysql +db.num=1 +db.url.0=jdbc:mysql://ruoyi-mysql:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC +db.user=root +db.password=password + +nacos.naming.empty-service.auto-clean=true +nacos.naming.empty-service.clean.initial-delay-ms=50000 +nacos.naming.empty-service.clean.period-time-ms=30000 + +management.endpoints.web.exposure.include=* + +management.metrics.export.elastic.enabled=false +management.metrics.export.influx.enabled=false + +server.tomcat.accesslog.enabled=true +server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i + +server.tomcat.basedir= + +nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/** + +nacos.core.auth.system.type=nacos +nacos.core.auth.enabled=false +nacos.core.auth.default.token.expire.seconds=18000 +nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789 +nacos.core.auth.caching.enabled=true +nacos.core.auth.enable.userAgentAuthWhite=false +nacos.core.auth.server.identity.key=serverIdentity +nacos.core.auth.server.identity.value=security + +nacos.istio.mcp.server.enabled=false diff --git a/docker/nacos/dockerfile b/docker/nacos/dockerfile new file mode 100644 index 0000000..a9f72d9 --- /dev/null +++ b/docker/nacos/dockerfile @@ -0,0 +1,7 @@ +# 基础镜像 +FROM nacos/nacos-server +# author +MAINTAINER ruoyi + +# 复制conf文件到路径 +COPY ./conf/application.properties /home/nacos/conf/application.properties diff --git a/docker/nginx/conf/nginx.conf b/docker/nginx/conf/nginx.conf new file mode 100644 index 0000000..56bf0ca --- /dev/null +++ b/docker/nginx/conf/nginx.conf @@ -0,0 +1,36 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + server_name localhost; + + location / { + root /home/ruoyi/projects/ruoyi-ui; + try_files $uri $uri/ /index.html; + index index.html index.htm; + } + + location /prod-api/{ + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header REMOTE-HOST $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://ruoyi-gateway:8080/; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + } +}# requirepass 123456 \ No newline at end of file diff --git a/docker/nginx/dockerfile b/docker/nginx/dockerfile new file mode 100644 index 0000000..e0025b1 --- /dev/null +++ b/docker/nginx/dockerfile @@ -0,0 +1,15 @@ +# 基础镜像 +FROM nginx +# author +MAINTAINER ruoyi + +# 挂载目录 +VOLUME /home/ruoyi/projects/ruoyi-ui +# 创建目录 +RUN mkdir -p /home/ruoyi/projects/ruoyi-ui +# 指定路径 +WORKDIR /home/ruoyi/projects/ruoyi-ui +# 复制conf文件到路径 +COPY ./conf/nginx.conf /etc/nginx/nginx.conf +# 复制html文件到路径 +COPY ./html/dist /home/ruoyi/projects/ruoyi-ui diff --git a/docker/redis/conf/redis.conf b/docker/redis/conf/redis.conf new file mode 100644 index 0000000..d762d65 --- /dev/null +++ b/docker/redis/conf/redis.conf @@ -0,0 +1 @@ +# requirepass 123456 \ No newline at end of file diff --git a/docker/redis/dockerfile b/docker/redis/dockerfile new file mode 100644 index 0000000..dd7eaa8 --- /dev/null +++ b/docker/redis/dockerfile @@ -0,0 +1,13 @@ +# 基础镜像 +FROM redis +# author +MAINTAINER ruoyi + +# 挂载目录 +VOLUME /home/ruoyi/redis +# 创建目录 +RUN mkdir -p /home/ruoyi/redis +# 指定路径 +WORKDIR /home/ruoyi/redis +# 复制conf文件到路径 +COPY ./conf/redis.conf /home/ruoyi/redis/redis.conf diff --git a/docker/ruoyi/auth/dockerfile b/docker/ruoyi/auth/dockerfile new file mode 100644 index 0000000..01e777f --- /dev/null +++ b/docker/ruoyi/auth/dockerfile @@ -0,0 +1,15 @@ +# 基础镜像 +FROM openjdk:8-jre +# author +MAINTAINER ruoyi + +# 挂载目录 +VOLUME /home/ruoyi +# 创建目录 +RUN mkdir -p /home/ruoyi +# 指定路径 +WORKDIR /home/ruoyi +# 复制jar文件到路径 +COPY ./jar/ruoyi-auth.jar /home/ruoyi/ruoyi-auth.jar +# 启动认证服务 +ENTRYPOINT ["java","-jar","ruoyi-auth.jar"] \ No newline at end of file diff --git a/docker/ruoyi/gateway/dockerfile b/docker/ruoyi/gateway/dockerfile new file mode 100644 index 0000000..016fdce --- /dev/null +++ b/docker/ruoyi/gateway/dockerfile @@ -0,0 +1,15 @@ +# 基础镜像 +FROM openjdk:8-jre +# author +MAINTAINER ruoyi + +# 挂载目录 +VOLUME /home/ruoyi +# 创建目录 +RUN mkdir -p /home/ruoyi +# 指定路径 +WORKDIR /home/ruoyi +# 复制jar文件到路径 +COPY ./jar/ruoyi-gateway.jar /home/ruoyi/ruoyi-gateway.jar +# 启动网关服务 +ENTRYPOINT ["java","-jar","ruoyi-gateway.jar"] \ No newline at end of file diff --git a/docker/ruoyi/modules/file/dockerfile b/docker/ruoyi/modules/file/dockerfile new file mode 100644 index 0000000..7178d13 --- /dev/null +++ b/docker/ruoyi/modules/file/dockerfile @@ -0,0 +1,15 @@ +# 基础镜像 +FROM openjdk:8-jre +# author +MAINTAINER ruoyi + +# 挂载目录 +VOLUME /home/ruoyi +# 创建目录 +RUN mkdir -p /home/ruoyi +# 指定路径 +WORKDIR /home/ruoyi +# 复制jar文件到路径 +COPY ./jar/ruoyi-modules-file.jar /home/ruoyi/ruoyi-modules-file.jar +# 启动文件服务 +ENTRYPOINT ["java","-jar","ruoyi-modules-file.jar"] \ No newline at end of file diff --git a/docker/ruoyi/modules/gen/dockerfile b/docker/ruoyi/modules/gen/dockerfile new file mode 100644 index 0000000..def260d --- /dev/null +++ b/docker/ruoyi/modules/gen/dockerfile @@ -0,0 +1,15 @@ +# 基础镜像 +FROM openjdk:8-jre +# author +MAINTAINER ruoyi + +# 挂载目录 +VOLUME /home/ruoyi +# 创建目录 +RUN mkdir -p /home/ruoyi +# 指定路径 +WORKDIR /home/ruoyi +# 复制jar文件到路径 +COPY ./jar/ruoyi-modules-gen.jar /home/ruoyi/ruoyi-modules-gen.jar +# 启动代码生成服务 +ENTRYPOINT ["java","-jar","ruoyi-modules-gen.jar"] \ No newline at end of file diff --git a/docker/ruoyi/modules/job/dockerfile b/docker/ruoyi/modules/job/dockerfile new file mode 100644 index 0000000..100ecae --- /dev/null +++ b/docker/ruoyi/modules/job/dockerfile @@ -0,0 +1,15 @@ +# 基础镜像 +FROM openjdk:8-jre +# author +MAINTAINER ruoyi + +# 挂载目录 +VOLUME /home/ruoyi +# 创建目录 +RUN mkdir -p /home/ruoyi +# 指定路径 +WORKDIR /home/ruoyi +# 复制jar文件到路径 +COPY ./jar/ruoyi-modules-job.jar /home/ruoyi/ruoyi-modules-job.jar +# 启动定时任务服务 +ENTRYPOINT ["java","-jar","ruoyi-modules-job.jar"] \ No newline at end of file diff --git a/docker/ruoyi/modules/system/dockerfile b/docker/ruoyi/modules/system/dockerfile new file mode 100644 index 0000000..ced23b2 --- /dev/null +++ b/docker/ruoyi/modules/system/dockerfile @@ -0,0 +1,15 @@ +# 基础镜像 +FROM openjdk:8-jre +# author +MAINTAINER ruoyi + +# 挂载目录 +VOLUME /home/ruoyi +# 创建目录 +RUN mkdir -p /home/ruoyi +# 指定路径 +WORKDIR /home/ruoyi +# 复制jar文件到路径 +COPY ./jar/ruoyi-modules-system.jar /home/ruoyi/ruoyi-modules-system.jar +# 启动系统服务 +ENTRYPOINT ["java","-jar","ruoyi-modules-system.jar"] \ No newline at end of file diff --git a/docker/ruoyi/visual/monitor/dockerfile b/docker/ruoyi/visual/monitor/dockerfile new file mode 100644 index 0000000..ea9370a --- /dev/null +++ b/docker/ruoyi/visual/monitor/dockerfile @@ -0,0 +1,15 @@ +# 基础镜像 +FROM openjdk:8-jre +# author +MAINTAINER ruoyi + +# 挂载目录 +VOLUME /home/ruoyi +# 创建目录 +RUN mkdir -p /home/ruoyi +# 指定路径 +WORKDIR /home/ruoyi +# 复制jar文件到路径 +COPY ./jar/ruoyi-visual-monitor.jar /home/ruoyi/ruoyi-visual-monitor.jar +# 启动系统服务 +ENTRYPOINT ["java","-jar","ruoyi-visual-monitor.jar"] \ No newline at end of file diff --git a/pom.xml b/pom.xml index 8bde059..fb5e1ef 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 2020.0.2 2021.1 2.0.1 - 2.4.1 + 2.4.1 2.1.4 2.9.2 1.5.24 diff --git a/sql/ry_seata_20210128.sql b/sql/ry_seata_20210128.sql index 4662eb2..80aeeff 100644 --- a/sql/ry_seata_20210128.sql +++ b/sql/ry_seata_20210128.sql @@ -1,3 +1,12 @@ +DROP DATABASE IF EXISTS `ry-seata`; + +CREATE DATABASE `ry-seata` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +USE `ry-seata`; + -- -------------------------------- The script used when storeMode is 'db' -------------------------------- -- the table to store GlobalSession data CREATE TABLE IF NOT EXISTS `global_table`