diff --git a/.ide/.gitignore b/.ide/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..8243c466b03ce6c38af282bd1b6d7010d93b86c7 --- /dev/null +++ b/.ide/.gitignore @@ -0,0 +1,2 @@ +/.temp/ +/.data/ \ No newline at end of file diff --git a/.ide/.ide.yaml b/.ide/.ide.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ad56af8730125a8462f29b8641ad20f519c0b774 --- /dev/null +++ b/.ide/.ide.yaml @@ -0,0 +1,19 @@ +version: smartide/v0.3 +orchestrator: + type: allinone + version: 3 +workspace: + dev-container: + service-name: ruoyi-dev + ports: + tools-webide-idea: 6800 + tools-ssh: 6822 + tools-phpmyadmin: 8090 + apps-ruoyi-ui: 8000 + apps-ruoyi-admin: 8080 + ide-type: jb-projector + volumes: + git-config: true + ssh-key: true + kube-deploy-files: "k8s-deployment.yaml" + docker-compose-file: "docker-compose.yaml" diff --git a/.ide/README.md b/.ide/README.md new file mode 100644 index 0000000000000000000000000000000000000000..beaa83461475f7361a1da5f36555904fd4bffd5c --- /dev/null +++ b/.ide/README.md @@ -0,0 +1,217 @@ +## 使用SmartIDE开发调试若依项目(前端分离版) + +SmartIDE是下一代的云原生IDE,可以帮助你一键启动项目的集成开发环境,直接进入编码调试,免除安装SDK,IDE和其他相关工具的麻烦。 + +我们已经对Ruoyi-Vue进行了SmartIDE适配,可以一键启动包含以下工具的 **标准化全栈开发环境(SFDE - Standard Fullstack Development Environment)**: + +- 完整支持Vue的Node.js开发工具语言包(SDK) +- 完整支持Java语言Spring框架的开发工具语言包(SDK) +- 用户可以选择2种WebIDE来加载项目进行前后端联调,VSCode WebIDE,JetBrains IDE 社区版 WebIDE +- 配置好的中间件,包括:MySQL和Redis服务器环境 +- 数据管理工具PHPMyAdmin用于管理MySQL数据库 + +本文档对如何使用SmartIDE进行Ru o项目的前后端联调进行描述。 + +## 1. 完整操作视频 + +为了便于大家更直观的了解使用SmartIDE开发调试Ruoyi的过程,我们在B站提上提供了视频供大家参考,视频地址如下: + +https://www.bilibili.com/video/BV13L4y1g75S/ + +## 2. 本地模式启动项目 + +使用SmartIDE启动RuoYi的开发调试非常简单,仅需要两个步骤 + +1. 按照 [安装手册](https://smartide.cn/zh/docs/install/) 完成 SmartIDE 本地命令行工具的安装 +2. 使用以下命令一键启动SFDE + +```shell +## SmartIDE是一款跨平台开发工具,您可以在Windows或者MacOS上执行同样的指令 +smartide start https://gitee.com/SmartIDE/RuoYi-Vue.git +``` + +> 注意:第一次启动因为下载容器镜像,需要较长时间,大概需要十分钟。SmartIDE所使用的容器镜像全部托管于阿里云在国内的镜像仓库上,因此一般不会出现无法拉取镜像的情况。如果你的网络过于不稳定,多尝试几次即可。 + +以上命令会在当前目录自动完成代码克隆,拉取开发环境镜像,启动容器,自动开启WebIDE的动作。 + +以上动作完成后,即可看到类似如下的WebIDE窗口,默认情况下将使用JetBrains Projector模式的 **IntelliJ IDEA 社区版** + +> WebIDE的地址是 https://localhost:6800 + +JetBrains Projector是一款基于JetBrains产品的WebIDE,提供通过浏览器操作并与桌面IDE保持一致的操作体验,第一次打开 JetBrains Projector 的时候需要进行简单的初始化操作如下: + +![](images/projector-terms.png) + +在 **Welcome to IntelliJ IDEA** 页面中,点击 **Open** 然后选择 **/home/project** 目录,然后点击 **OK** + +![](images/projector-open.png) + +在以下对话框中选择 **Trust Project** + +![](images/projector-trust.png) + +加载完毕的Web版IntelliJ IDEA如下 + +![](images/projector-idea.png) + +## 3. 远程主机模式启动项目 + +远程主机模式允许你将SmartIDE的开发环境一键部署到一台安装了Docker环境的远程主机上,并远程连接到这台主机进行开发,对于比较复杂的项目来说这样做可以让你扩展本地开发机的能力,实现云端开发体验。 + +使用远程模式也仅需要两个步骤 + +> 注意:远程主机模式下你不必在本地安装Docker环境,只需要安装好SmartIDE的命令行工具即可 + +1. 按照 [Docker & Docker-Compose 安装手册 (Linux服务器)](https://smartide.cn/zh/docs/install/docker-install-linux/) 准备好一台远程主机,建议使用Ubuntu 18.04 LTS以上版本的Linux环境。 +2. 按照以下指令启动项目 + +```shell +# 将远程主机添加到SmartIDE中 +smartide host add --username --password --port + +# 获取主机ID +smartide host list + +# 使用远程主机启动项目 +smartide start --host <主机ID> https://gitee.com/SmartIDE/RuoYi-Vue.git +``` + +## 4. 启动前后端开发调试 + +使用SmartIDE启动环境后,我们即可启动前后端联调操作,为了避免SmartIDE的配置影响RuoYi的默认配置,我们扩展了application.yml中的配置,为SmartIDE提供了单独的日志、MySQL和Redis配置。 + +1. 切换spring配置使用SmartIDE环境 + +如果要使用SmartIDE进行联调,请先打开 **/ruoyi-admin/src/main/resources/application.yml**,将 **spring.profiles.active** 的值设置为 smartide + +```yaml +# Spring配置 +spring: + profiles: + active: smartide +``` + +2. 创建ry-vue数据库 + +> 说明:使用SmartIDE运行开发环境的一个好处就是一键启动所有相关环境,我们已经在你的环境中内置了专门用于RuoYi项目开发的MySQL数据库,并且为了你的操作方便,也提供了PhpMyAdmin这个工具方便你进行数据管理操作。 + +打开SmartIDE内置的PHPMyAdmin工具,地址是:http://localhost:8090 + +- 服务器:ruoyi-db +- 用户名:root +- 密码:password + +![](images/ruoyi-db-login.png) + +点击 **新建** 并输入 **ry-vue** 作为数据库名称,点击 **创建** 按钮 + +![](images/ruoyi-db-create.png) + +然后在这个数据库中依次执行以下两个脚本 + +- sql/ry_20210908.sql +- sql/quartz.sql + +执行完毕之后的状态如下 + +![](images/ruoyi-db-tables.png) + +3. 编译并安装所有RuoYi后端组件,并启动后端调试 + +然后,我们需要打开IDEA内置的terminal,并执行以下指令以确保RuoYi所有模块都已经编译并放入共享组件库中 + +```shell +## 请在RuoYi项目根目录执行 +mvn package +mvn install +``` + +点击 **File | Project Structure** 设置当前项目的JDK版本,环境中已经内置了OpenJDK-11这个版本,如果希望使用其他JDK版本也可以选择 **Add JDK** 自行下载。 + +![](images/ruoyi-idea-jdk.png) + +右键点击 **ruoyi-admin/src/main/java/com.ruoyi/RuoYiApplication.java** 文件,并启动 **Debug** 模式 + +![](images/ruoyi-idea-debug.png) + +注意 Console 中出现 **若依启动成功** 的字样,表示后端应用启动成功。 + +![](images/ruoyi-idea-console.png) + +4. 编译并启动前端项目 + +现在我们可以进入 **ruoyi-ui** 项目,启动前端项目 + +后端启动后,我们可以通过命令启动前端,使用内置的 terminal 运行以下命令以便进入 ruoyi-ui 项目并启动前端服务器 + +```shell +cd ruoyi-ui +npm install +npm run dev +``` + +执行完毕后,检查 terminal 中出现了 App running at 的字样就表示前端项目启动成功了 + +![](images/ruoyi-idea-node.png) + +> 注意:我们的环境运行在容器中,我们将容器内的80端口映射到了你本地的8000端口。 + +现在打开 http://localhost:8000 即可访问若依项目了 + +![](images/ruoyi-idea-ruoyi-ui.png) + +5. 设置断点,进入交互式单步调试状态 + +如果你按照刚才的操作方式用 **Debug** 模式启动了后端项目,那么现在可以在任何位置创建断点,并进入断点调试模式 + +比如,你可以在 **/ruoyi-admin/src/main/java/com.ruoyi/web/controllers/system/SysUserController.java** 的 **第59行** 设置断点,然后进入 **若依管理系统 | 系统管理 | 用户管理** 菜单,即可触发此断点,注意下图中的IDEA已经中断在代码行59. + +![](images/ruoyi-idea-debugging.png) + +其他调试相关的入口如下: + +- 容器内项目目录 /home/project +- WebIDE入口 http://localhost:6800 +- 数据库管理PHPMyAdmin http://localhost:8090 +- 前端应用入口 http://localhost:8000 + +> 注意:如果你本地的以上端口有被占用的情况,SmartIDE会自动在当前端口上增加100,具体转发情况请参考SmartIDE命令的日志输出。 + +## 5. 停止和恢复环境 + +如果需要停止和恢复环境,可以使用SmartIDE的状态管理指令如下 + +```shell +## 获取已经创建好的开发环境列表 +smartide list +## 停止一个开发环境 +smartide stop +## 启动一个开发环境 +smartide start +## 清理一个开发环境 +## 参数说明:-f 强制删除 -y 跳过确认 -p 删除磁盘上的代码库 -i 删除容器镜像 +smartide remove -fypi +``` + +## 6. 技术支持 + +**特别说明:** SmartIDE本身是开源产品,并且对独立开发者提供免费使用授权。 + +大家可以通过以下链接获取SmartIDE的技术支持 + +- 产品官网 https://SmartIDE.cn + - 通过产品官网上的二维码可以加入 [Smart早鸟群] 与其他的 Smart Developer 一起交流 +- 开源首页:SmartIDE采用GitHub和Gitee双通道开源模式(自动同步代码),方便国内开发者访问 + - https://githbu.com/SmartIDE + - https://gitee.com/SmartIDE + + 大家自选以上任意渠道提交Issue,产品组的小伙伴会及时给予反馈。 + + > 如果大家喜欢我们的产品,请给予 Star 支持 + +- B站频道:我们定制组织直播,为大家更新产品开发进展 + - https://space.bilibili.com/1001970523 + + > 如果大家喜欢我们的产品和视频,一定要记得 “三连” + +谢谢你对SmartIDE的支持:Be a Smart Developer,开发从未如此简单。 \ No newline at end of file diff --git a/.ide/docker-compose.yaml b/.ide/docker-compose.yaml new file mode 100644 index 0000000000000000000000000000000000000000..cf6d4df5b7e7569282d56ff684149b08c6d1b743 --- /dev/null +++ b/.ide/docker-compose.yaml @@ -0,0 +1,62 @@ +version: "3" +services: +services: + ruoyi-dev: + image: registry.cn-hangzhou.aliyuncs.com/smartide/smartide-java-v2-jetbrains-idea:2021.2.3-openjdk-11-jdk-2081 + restart: always + environment: + ROOT_PASSWORD: root123 + LOCAL_USER_PASSWORD: root123 + ports: + - 8080:8080 + - 8000:80 + - 6822:22 + - 6800:8887 + volumes: + - .:/home/project + - $HOME/.m2/repository:/home/smartide/.m2/repository + networks: + - ruoyi-dev-network + + ruoyi-db: + image: registry.cn-hangzhou.aliyuncs.com/smartide/mysql:8.0.21 + command: + - --default-authentication-plugin=mysql_native_password + - --character-set-server=utf8mb4 + - --collation-server=utf8mb4_unicode_ci + restart: always + expose: + - 3306 + ports: + - 3306:3306 + environment: + MYSQL_ROOT_PASSWORD: password + volumes: + - './.ide/.data/mysql-data:/var/lib/mysql' + networks: + - ruoyi-dev-network + + ruoyi-phpmyadmin: + image: registry.cn-hangzhou.aliyuncs.com/boathouse/phpmyadmin:5.0.4-apache + restart: always + expose: + - 8090 + ports: + - 8090:80 + environment: + PMA_ARBITRARY: "1" + networks: + - ruoyi-dev-network + + ruoyi-redis: + image: registry.cn-hangzhou.aliyuncs.com/smartide/redis:6.0.6 + restart: always + expose: + - 6379 + ports: + - "6379:6379" + networks: + - ruoyi-dev-network +networks: + ruoyi-dev-network: + external: true \ No newline at end of file diff --git a/.ide/images/projector-idea.png b/.ide/images/projector-idea.png new file mode 100644 index 0000000000000000000000000000000000000000..1b76469b0952ff9f40384f184f0f9aa59ffc2c31 Binary files /dev/null and b/.ide/images/projector-idea.png differ diff --git a/.ide/images/projector-open.png b/.ide/images/projector-open.png new file mode 100644 index 0000000000000000000000000000000000000000..0af2ace95c50c5a92689ead9c6a574db9eece22d Binary files /dev/null and b/.ide/images/projector-open.png differ diff --git a/.ide/images/projector-terms.png b/.ide/images/projector-terms.png new file mode 100644 index 0000000000000000000000000000000000000000..7994e21d3de0e5185e8cb66f6f869ecee37698c1 Binary files /dev/null and b/.ide/images/projector-terms.png differ diff --git a/.ide/images/projector-trust.png b/.ide/images/projector-trust.png new file mode 100644 index 0000000000000000000000000000000000000000..ecd328032005328b440f3d3a3162f7cec704bd3b Binary files /dev/null and b/.ide/images/projector-trust.png differ diff --git a/.ide/images/ruoyi-db-create.png b/.ide/images/ruoyi-db-create.png new file mode 100644 index 0000000000000000000000000000000000000000..a9ef676bd054c81750daf7a19464fa5a69007b79 Binary files /dev/null and b/.ide/images/ruoyi-db-create.png differ diff --git a/.ide/images/ruoyi-db-login.png b/.ide/images/ruoyi-db-login.png new file mode 100644 index 0000000000000000000000000000000000000000..d222a45a05512b0c86df16c6b2f89fe5bba5dd70 Binary files /dev/null and b/.ide/images/ruoyi-db-login.png differ diff --git a/.ide/images/ruoyi-db-tables.png b/.ide/images/ruoyi-db-tables.png new file mode 100644 index 0000000000000000000000000000000000000000..e6a9f87f8b3432758f221ee22a7134ca65a6f224 Binary files /dev/null and b/.ide/images/ruoyi-db-tables.png differ diff --git a/.ide/images/ruoyi-idea-console.png b/.ide/images/ruoyi-idea-console.png new file mode 100644 index 0000000000000000000000000000000000000000..895f3fe49ca3c8f83a17088ced3162794a67ad65 Binary files /dev/null and b/.ide/images/ruoyi-idea-console.png differ diff --git a/.ide/images/ruoyi-idea-debug.png b/.ide/images/ruoyi-idea-debug.png new file mode 100644 index 0000000000000000000000000000000000000000..25b7ea3220b8eb7411b9e114d41c60f9328fd026 Binary files /dev/null and b/.ide/images/ruoyi-idea-debug.png differ diff --git a/.ide/images/ruoyi-idea-debugging.png b/.ide/images/ruoyi-idea-debugging.png new file mode 100644 index 0000000000000000000000000000000000000000..233083dd3a2fd1027f1786c6f63edf60d6611ef8 Binary files /dev/null and b/.ide/images/ruoyi-idea-debugging.png differ diff --git a/.ide/images/ruoyi-idea-jdk.png b/.ide/images/ruoyi-idea-jdk.png new file mode 100644 index 0000000000000000000000000000000000000000..c4b63c0f10716e5fccdd03d30135954cd858c400 Binary files /dev/null and b/.ide/images/ruoyi-idea-jdk.png differ diff --git a/.ide/images/ruoyi-idea-node.png b/.ide/images/ruoyi-idea-node.png new file mode 100644 index 0000000000000000000000000000000000000000..daec94e5632a14b1118dd5b887be544fdd1ae418 Binary files /dev/null and b/.ide/images/ruoyi-idea-node.png differ diff --git a/.ide/images/ruoyi-idea-ruoyi-ui.png b/.ide/images/ruoyi-idea-ruoyi-ui.png new file mode 100644 index 0000000000000000000000000000000000000000..6f5e96418d1b99e209d864508157cee39a2b5aa8 Binary files /dev/null and b/.ide/images/ruoyi-idea-ruoyi-ui.png differ diff --git a/.ide/images/smartide-start-badge.png b/.ide/images/smartide-start-badge.png new file mode 100644 index 0000000000000000000000000000000000000000..6c7e41671e075975b728238e6f55f2ed2efb118b Binary files /dev/null and b/.ide/images/smartide-start-badge.png differ diff --git a/.ide/k8s-deployment.yaml b/.ide/k8s-deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a9ea3128c3a3b76c8851d5e50bd5711ed730b00d --- /dev/null +++ b/.ide/k8s-deployment.yaml @@ -0,0 +1,266 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose -f docker-compose-RuoYi-Vue.yaml convert + labels: + reuoyi.service: ruoyi-db + name: ruoyi-db +spec: + replicas: 1 + selector: + matchLabels: + reuoyi.service: ruoyi-db + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.cmd: kompose -f docker-compose-RuoYi-Vue.yaml convert + labels: + io.kompose.network/ruoyi-dev-network: "true" + reuoyi.service: ruoyi-db + spec: + containers: + - args: + - --default-authentication-plugin=mysql_native_password + - --character-set-server=utf8mb4 + - --collation-server=utf8mb4_unicode_ci + env: + - name: MYSQL_ROOT_PASSWORD + value: "password" + image: registry.cn-hangzhou.aliyuncs.com/smartide/mysql:8.0.21 + name: ruoyi-db + ports: + - containerPort: 3306 + resources: {} + + restartPolicy: Always + +status: {} + +--- + +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.cmd: kompose -f docker-compose-RuoYi-Vue.yaml convert + labels: + reuoyi.service: ruoyi-db + name: ruoyi-db +spec: + ports: + - name: "3306" + port: 3306 + targetPort: 3306 + selector: + reuoyi.service: ruoyi-db +status: + loadBalancer: {} + +--- + +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose -f docker-compose-RuoYi-Vue.yaml convert + labels: + reuoyi.service: ruoyi-dev + name: ruoyi-dev +spec: + replicas: 1 + selector: + matchLabels: + reuoyi.service: ruoyi-dev + strategy: + type: Recreate + template: + metadata: + annotations: + kompose.cmd: kompose -f docker-compose-RuoYi-Vue.yaml convert + labels: + io.kompose.network/ruoyi-dev-network: "true" + reuoyi.service: ruoyi-dev + spec: + containers: + - env: + - name: LOCAL_USER_PASSWORD + value: root123 + - name: ROOT_PASSWORD + value: root123 + image: registry.cn-hangzhou.aliyuncs.com/smartide/smartide-java-v2-jetbrains-idea:2021.2.3-openjdk-11-jdk-2081 + name: ruoyi-dev + ports: + - containerPort: 8080 + - containerPort: 8000 + - containerPort: 6822 + - containerPort: 8887 + resources: + requests: + memory: "3Gi" + cpu: "1500m" + limits: + memory: "8Gi" + cpu: "2000m" + restartPolicy: Always + +status: {} + +--- + +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: ruoyi-dev-network +spec: + ingress: + - from: + - podSelector: + matchLabels: + io.kompose.network/ruoyi-dev-network: "true" + podSelector: + matchLabels: + io.kompose.network/ruoyi-dev-network: "true" + +--- + +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.cmd: kompose -f docker-compose-RuoYi-Vue.yaml convert + labels: + reuoyi.service: ruoyi-dev + name: ruoyi-dev +spec: + ports: + - name: "8000" + port: 8000 + targetPort: 1024 + - name: "8080" + port: 8080 + targetPort: 8080 + - name: "6822" + port: 6822 + targetPort: 22 + - name: "6800" + port: 6800 + targetPort: 8887 + selector: + reuoyi.service: ruoyi-dev +status: + loadBalancer: {} + +--- + +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose -f docker-compose-RuoYi-Vue.yaml convert + labels: + reuoyi.service: ruoyi-phpmyadmin + name: ruoyi-phpmyadmin +spec: + replicas: 1 + selector: + matchLabels: + reuoyi.service: ruoyi-phpmyadmin + strategy: {} + template: + metadata: + annotations: + kompose.cmd: kompose -f docker-compose-RuoYi-Vue.yaml convert + labels: + io.kompose.network/ruoyi-dev-network: "true" + reuoyi.service: ruoyi-phpmyadmin + spec: + containers: + - env: + - name: PMA_ARBITRARY + value: "1" + image: registry.cn-hangzhou.aliyuncs.com/boathouse/phpmyadmin:5.0.4-apache + name: ruoyi-phpmyadmin + ports: + - containerPort: 80 + - containerPort: 8090 + resources: {} + restartPolicy: Always +status: {} + +--- + +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.cmd: kompose -f docker-compose-RuoYi-Vue.yaml convert + labels: + reuoyi.service: ruoyi-phpmyadmin + name: ruoyi-phpmyadmin +spec: + ports: + - name: "8090" + port: 8090 + targetPort: 80 + selector: + reuoyi.service: ruoyi-phpmyadmin +status: + loadBalancer: {} + + +--- + +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose -f docker-compose-RuoYi-Vue.yaml convert + labels: + reuoyi.service: ruoyi-redis + name: ruoyi-redis +spec: + replicas: 1 + selector: + matchLabels: + reuoyi.service: ruoyi-redis + strategy: {} + template: + metadata: + annotations: + kompose.cmd: kompose -f docker-compose-RuoYi-Vue.yaml convert + labels: + io.kompose.network/ruoyi-dev-network: "true" + reuoyi.service: ruoyi-redis + spec: + containers: + - image: registry.cn-hangzhou.aliyuncs.com/smartide/redis:6.0.6 + name: ruoyi-redis + ports: + - containerPort: 6379 + resources: {} + restartPolicy: Always +status: {} + + +--- + +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.cmd: kompose -f docker-compose-RuoYi-Vue.yaml convert + labels: + reuoyi.service: ruoyi-redis + name: ruoyi-redis +spec: + ports: + - name: 6379-tcp + port: 6379 + targetPort: 6379 + selector: + reuoyi.service: ruoyi-redis +status: + loadBalancer: {} \ No newline at end of file diff --git a/.ide/sdk.ide.yaml b/.ide/sdk.ide.yaml new file mode 100644 index 0000000000000000000000000000000000000000..75361be7ec4533efa9166f9da8cf3ac37f7ca267 --- /dev/null +++ b/.ide/sdk.ide.yaml @@ -0,0 +1,75 @@ +version: smartide/v0.1 +orchestrator: + type: docker-compose + version: 3 +workspace: + dev-container: + service-name: ruoyi-dev + ports: + webide: 6800 + ssh: 6822 + ruoyi-ui: 8000 + ruoyi-admin: 8080 + ide-type: sdk-only + volumes: + git-config: true + ssh-key: true + services: + ruoyi-dev: + image: registry.cn-hangzhou.aliyuncs.com/smartide/smartide-java-v2:openjdk-11-jdk + restart: always + environment: + ROOT_PASSWORD: root123 + LOCAL_USER_PASSWORD: root123 + ports: + - 8080:8080 + - 8000:80 + - 6822:22 + volumes: + - .:/home/project + - $HOME/.m2/repository:/home/smartide/.m2/repository + networks: + - ruoyi-dev-network + + ruoyi-db: + image: registry.cn-hangzhou.aliyuncs.com/smartide/mysql:8.0.21 + command: + - --default-authentication-plugin=mysql_native_password + - --character-set-server=utf8mb4 + - --collation-server=utf8mb4_unicode_ci + restart: always + expose: + - 3306 + ports: + - 3306:3306 + environment: + MYSQL_ROOT_PASSWORD: password + volumes: + - './.ide/.data/mysql-data:/var/lib/mysql' + networks: + - ruoyi-dev-network + + ruoyi-phpmyadmin: + image: registry.cn-hangzhou.aliyuncs.com/boathouse/phpmyadmin:5.0.4-apache + restart: always + expose: + - 8090 + ports: + - 8090:80 + environment: + PMA_ARBITRARY: "1" + networks: + - ruoyi-dev-network + + ruoyi-redis: + image: registry.cn-hangzhou.aliyuncs.com/smartide/redis:6.0.6 + restart: always + expose: + - 6379 + ports: + - "6379:6379" + networks: + - ruoyi-dev-network + networks: + ruoyi-dev-network: + external: true \ No newline at end of file diff --git a/.ide/vscode.ide.yaml b/.ide/vscode.ide.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ebbe7ae5ee79612ee0ed7bf1d901129d31659a36 --- /dev/null +++ b/.ide/vscode.ide.yaml @@ -0,0 +1,74 @@ +version: smartide/v0.1 +orchestrator: + type: docker-compose + version: 3 +workspace: + dev-container: + service-name: ruoyi-dev + ports: + webide: 6800 + ssh: 6822 + ruoyi-ui: 8000 + ruoyi-admin: 8080 + ide-type: vscode + volumes: + git-config: true + ssh-key: true + services: + ruoyi-dev: + image: registry.cn-hangzhou.aliyuncs.com/smartide/smartide-java-v2-vscode:2070 + restart: always + environment: + ROOT_PASSWORD: root123 + LOCAL_USER_PASSWORD: root123 + ports: + - 8080:8080 + - 8000:80 + - 6822:22 + - 6800:3000 + volumes: + - .:/home/project + - $HOME/.m2/repository:/home/smartide/.m2/repository + networks: + - ruoyi-dev-network + + ruoyi-db: + image: registry.cn-hangzhou.aliyuncs.com/smartide/mysql:8.0.21 + command: + - --default-authentication-plugin=mysql_native_password + restart: always + expose: + - 3306 + ports: + - 3306:3306 + environment: + MYSQL_ROOT_PASSWORD: password + volumes: + - './.ide/.data/mysql-data:/var/lib/mysql' + networks: + - ruoyi-dev-network + + ruoyi-phpmyadmin: + image: registry.cn-hangzhou.aliyuncs.com/boathouse/phpmyadmin:5.0.4-apache + restart: always + expose: + - 8090 + ports: + - 8090:80 + environment: + PMA_ARBITRARY: "1" + networks: + - ruoyi-dev-network + + ruoyi-redis: + image: registry.cn-hangzhou.aliyuncs.com/smartide/redis:6.0.6 + restart: always + expose: + - 6379 + ports: + - "6379:6379" + networks: + - ruoyi-dev-network + networks: + ruoyi-dev-network: + external: true \ No newline at end of file diff --git a/README.md b/README.md index 07dbeebf987e9406bc9468af997b89654db2251a..ca67f87a371564e999d2c7cec083942a42df7a3b 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,64 @@ * 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)   * 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)   +## 使用 SmartIDE 开发和调试 + +### CLI 本地模式 + +1. **安装** 参考 [安装手册](https://smartide.cn/zh/docs/install/cli/) 完成CLI的本地安装,SmartIDE CLI 支持 Windows/MacOS/Linux 三大主流操作系统。 + +2. **一键启动** 使用以下指令即可启动WebIDE开始开发和调试 + +```shell +## 使用GitHub +smartide start https://github.com/smartide/RuoYi-Vue.git +## 使用Gitee +smartide start https://gitee.com/smartide/RuoYi-Vue.git +``` + +启动后的效果如下 + +![](.ide/images/ruoyi-idea-debugging.png) + +### CLI 远程主机模式 + +远程主机模式允许开发者使用一台Linux主机作为SmartIDE的开发资源,将开发环境一键漫游到这台主机上。开发环境主机可以是位于任何位置的物理机或者虚拟机,无需开放除了SSH端口以外的其他网络端口。 + +主机环境要求:主机上需要需要预装 Docker 环境,请参考 [安装手册](https://smartide.cn/zh/docs/install/docker/linux/)。 + +远程主机模式的启动指令与本地模式保持一致,只需要添加 --host <主机ID> 参数即可。 + +运行以下指令添加主机到 SmartIDE CLI 并启动环境。 + +```shell +## 添加主机 +## 如果采用SSH-KEY认证方式,可以省略 参数 +smartide host add <主机IP或者域名> --username --password --port + +## 执行成功后,CLI会返回 主机ID,也可以使用以下指令查询主机列表 +smartide host list + +## 使用主机模式启动环境 +## 使用GitHub +smartide start --host <主机ID> https://github.com/smartide/RuoYi-Vue.git +## 使用Gitee +smartide start --host <主机ID> https://gitee.com/smartide/RuoYi-Vue.git +``` + +### Server 模式 + +SmartIDE Server 为开发团队提供对开发环境的统一在线管理和访问能力,企业管理者可以通过SmartIDE Server为开发团队提供统一的一致的开发环境,大幅降低开发者花费在搭建环境上的时间消耗,让开发者可以将更多的精力投入到业务需求开发和技术方案改进上。更为重要的是,SmartIDE Server提供了完全受控的开发测试环境,管理者可以通过工作区策略对开发环境进行管理。 + +Server一键启动按钮,点击此按钮即可启动开发调试环境 + +[![smartide start](.ide/images/smartide-start-badge.png)](https://dev.smartide.cn/#/layout/smartide/workspace/details/158) + +- 在线版地址 https://dev.smartide.cn +- Server版快速启动手册 https://smartide.cn/zh/docs/quickstart/server/ + +SmartIDE Server 已经开放内测,请进入 [官网](https://smartide.cn) 扫描页面底部二维码即可申请加入。 + + ## 内置功能 1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 @@ -91,6 +149,33 @@ +## SmartIDE 快速启动 + +### 1. 本地模式: +使用SmartIDE启动RuoYi的开发调试非常简单,仅需要两个步骤 + +1. 按照 [安装手册](https://smartide.cn/zh/docs/install/) 完成 SmartIDE 本地命令行工具的安装 +2. 使用以下命令一键启动SFDE + +```shell +## SmartIDE是一款跨平台开发工具,您可以在Windows或者MacOS上执行同样的指令 +smartide start https://gitee.com/SmartIDE/RuoYi-Vue.git +``` + +### 2. 远程主机模式: +1. 按照 [Docker & Docker-Compose 安装手册 (Linux服务器)](https://smartide.cn/zh/docs/install/docker-install-linux/) 准备好一台远程主机,建议使用Ubuntu 18.04 LTS以上版本的Linux环境。 +2. 按照以下指令启动项目 + +```shell +# 将远程主机添加到SmartIDE中 +smartide host add --username --password --port + +# 获取主机ID +smartide host list + +# 使用远程主机启动项目 +smartide start --host <主机ID> https://gitee.com/SmartIDE/RuoYi-Vue.git +``` ## 若依前后端分离交流群 diff --git a/ruoyi-admin/.vscode/launch.json b/ruoyi-admin/.vscode/launch.json new file mode 100644 index 0000000000000000000000000000000000000000..2c34688d368a00e5b88684c7cb7d37a07e3ba475 --- /dev/null +++ b/ruoyi-admin/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + "configurations": [ + { + "type": "java", + "name": "Spring Boot-RuoYiApplication", + "request": "launch", + "cwd": "${workspaceFolder}", + "console": "internalConsole", + "mainClass": "com.ruoyi.RuoYiApplication", + "projectName": "ruoyi-admin", + "args": "" + } + ] +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml deleted file mode 100644 index 1f098e4077e2d94247bc6cb175fa02f8d64edb85..0000000000000000000000000000000000000000 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ /dev/null @@ -1,57 +0,0 @@ -# 数据源配置 -spring: - datasource: - type: com.alibaba.druid.pool.DruidDataSource - driverClassName: com.mysql.cj.jdbc.Driver - druid: - # 主库数据源 - master: - url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 - username: root - password: password - # 从库数据源 - slave: - # 从数据源开关/默认关闭 - enabled: false - url: - username: - password: - # 初始连接数 - initialSize: 5 - # 最小连接池数量 - minIdle: 10 - # 最大连接池数量 - maxActive: 20 - # 配置获取连接等待超时的时间 - maxWait: 60000 - # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 - timeBetweenEvictionRunsMillis: 60000 - # 配置一个连接在池中最小生存的时间,单位是毫秒 - minEvictableIdleTimeMillis: 300000 - # 配置一个连接在池中最大生存的时间,单位是毫秒 - maxEvictableIdleTimeMillis: 900000 - # 配置检测连接是否有效 - validationQuery: SELECT 1 FROM DUAL - testWhileIdle: true - testOnBorrow: false - testOnReturn: false - webStatFilter: - enabled: true - statViewServlet: - enabled: true - # 设置白名单,不填则允许所有访问 - allow: - url-pattern: /druid/* - # 控制台管理用户名和密码 - login-username: ruoyi - login-password: 123456 - filter: - stat: - enabled: true - # 慢SQL记录 - log-slow-sql: true - slow-sql-millis: 1000 - merge-sql: true - wall: - config: - multi-statement-allow: true \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index ccef2502d20cb333404ff20b0c0b164f6649d507..5c037e9f62d948718f4abdf3f2aaf472409470f0 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -1,3 +1,90 @@ +# Spring配置 +spring: + profiles: + active: smartide + # 资源信息 + messages: + # 国际化资源文件路径 + basename: i18n/messages + # 文件上传 + servlet: + multipart: + # 单个文件大小 + max-file-size: 10MB + # 设置总上传的文件大小 + max-request-size: 20MB + # 服务模块 + devtools: + restart: + # 热部署开关 + enabled: true + # redis 配置 + redis: + # 数据库索引 + database: 0 + # 密码 + password: + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + druid: + # 主库数据源 + master: + # 从库数据源 + slave: + # 从数据源开关/默认关闭 + enabled: false + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 300000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 900000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: ruoyi + login-password: 123456 + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true # 项目相关配置 ruoyi: # 名称 @@ -8,8 +95,6 @@ ruoyi: copyrightYear: 2022 # 实例演示开关 demoEnabled: true - # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) - profile: D:/ruoyi/uploadPath # 获取ip地址开关 addressEnabled: false # 验证码类型 math 数组计算 char 字符验证 @@ -33,78 +118,29 @@ server: # Tomcat启动初始化的线程数,默认值10 min-spare: 100 -# 日志配置 -logging: - level: - com.ruoyi: debug - org.springframework: warn - -# Spring配置 -spring: - # 资源信息 - messages: - # 国际化资源文件路径 - basename: i18n/messages - profiles: - active: druid - # 文件上传 - servlet: - multipart: - # 单个文件大小 - max-file-size: 10MB - # 设置总上传的文件大小 - max-request-size: 20MB - # 服务模块 - devtools: - restart: - # 热部署开关 - enabled: true - # redis 配置 - redis: - # 地址 - host: localhost - # 端口,默认为6379 - port: 6379 - # 数据库索引 - database: 0 - # 密码 - password: - # 连接超时时间 - timeout: 10s - lettuce: - pool: - # 连接池中的最小空闲连接 - min-idle: 0 - # 连接池中的最大空闲连接 - max-idle: 8 - # 连接池的最大数据库连接数 - max-active: 8 - # #连接池最大阻塞等待时间(使用负值表示没有限制) - max-wait: -1ms - # token配置 token: - # 令牌自定义标识 - header: Authorization - # 令牌密钥 - secret: abcdefghijklmnopqrstuvwxyz - # 令牌有效期(默认30分钟) - expireTime: 30 - + # 令牌自定义标识 + header: Authorization + # 令牌密钥 + secret: abcdefghijklmnopqrstuvwxyz + # 令牌有效期(默认30分钟) + expireTime: 30 + # MyBatis配置 mybatis: - # 搜索指定包别名 - typeAliasesPackage: com.ruoyi.**.domain - # 配置mapper的扫描,找到所有的mapper.xml映射文件 - mapperLocations: classpath*:mapper/**/*Mapper.xml - # 加载全局的配置文件 - configLocation: classpath:mybatis/mybatis-config.xml + # 搜索指定包别名 + typeAliasesPackage: com.ruoyi.**.domain + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + # 加载全局的配置文件 + configLocation: classpath:mybatis/mybatis-config.xml # PageHelper分页插件 -pagehelper: +pagehelper: helperDialect: mysql supportMethodsArguments: true - params: count=countSql + params: count=countSql # Swagger配置 swagger: @@ -114,10 +150,66 @@ swagger: pathMapping: /dev-api # 防止XSS攻击 -xss: +xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* + +--- +spring: + config: + activate: + on-profile: druid + # redis 配置 + redis: + # 地址 + host: localhost + # 端口,默认为6379 + port: 6379 + datasource: + druid: + # 主库数据源 + master: + url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: root + password: password + +# 项目相关配置 +ruoyi: + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: D:/ruoyi/uploadPath + +# 日志配置 +logging: + config: classpath:logback-druid.xml + +--- +spring: + config: + activate: + on-profile: smartide + # redis 配置 + redis: + # 地址 + host: ruoyi-redis + # 端口,默认为6379 + port: 6379 + datasource: + druid: + # 主库数据源 + master: + url: jdbc:mysql://ruoyi-db:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: root + password: password + +# 项目相关配置 +ruoyi: + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: /home/smartide/ruoyi/uploadPath + +# 日志配置 +logging: + config: classpath:logback-smartide.xml diff --git a/ruoyi-admin/src/main/resources/logback.xml b/ruoyi-admin/src/main/resources/logback-druid.xml similarity index 95% rename from ruoyi-admin/src/main/resources/logback.xml rename to ruoyi-admin/src/main/resources/logback-druid.xml index d69a5720739777fb1bc9feef127220071296d5ca..52fe1c9b34e2beadaf66bc10093f3ff74cb05478 100644 --- a/ruoyi-admin/src/main/resources/logback.xml +++ b/ruoyi-admin/src/main/resources/logback-druid.xml @@ -1,93 +1,93 @@ - - - - - - - - - - - ${log.pattern} - - - - - - ${log.path}/sys-info.log - - - - ${log.path}/sys-info.%d{yyyy-MM-dd}.log - - 60 - - - ${log.pattern} - - - - INFO - - ACCEPT - - DENY - - - - - ${log.path}/sys-error.log - - - - ${log.path}/sys-error.%d{yyyy-MM-dd}.log - - 60 - - - ${log.pattern} - - - - ERROR - - ACCEPT - - DENY - - - - - - ${log.path}/sys-user.log - - - ${log.path}/sys-user.%d{yyyy-MM-dd}.log - - 60 - - - ${log.pattern} - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/sys-info.log + + + + ${log.path}/sys-info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/sys-error.log + + + + ${log.path}/sys-error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + ${log.path}/sys-user.log + + + ${log.path}/sys-user.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/logback-smartide.xml b/ruoyi-admin/src/main/resources/logback-smartide.xml new file mode 100644 index 0000000000000000000000000000000000000000..9df11ceb5b9abe9da2973682fa1c204874b71e59 --- /dev/null +++ b/ruoyi-admin/src/main/resources/logback-smartide.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/sys-info.log + + + + ${log.path}/sys-info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/sys-error.log + + + + ${log.path}/sys-error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + ${log.path}/sys-user.log + + + ${log.path}/sys-user.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sql/ry_20210908.sql b/sql/ry_20210908.sql index 650238a1a3cb5ce7d11fefe7410b119b65272f30..5835905be101ad3f354b887c980be2813191fb5b 100644 --- a/sql/ry_20210908.sql +++ b/sql/ry_20210908.sql @@ -1,3 +1,12 @@ +DROP DATABASE IF EXISTS `ry-vue`; + +CREATE DATABASE `ry-vue` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +USE `ry-vue`; + -- ---------------------------- -- 1、部门表 -- ----------------------------