# 1、若依官网
https://doc.ruoyi.vip/
# 2、微服务版文档
https://doc.ruoyi.vip/ruoyi-cloud/
# 后端代码
git clone https://gitee.com/y_project/RuoYi-Cloud.git
# 克隆项目
# git clone https://gitee.com/ywbingchuan/RuoYi-Cloud-Vue3.git
git clone https://github.com/yangzongzhuan/RuoYi-Cloud-Vue3.git
# 进入项目目录
cd RuoYi-Cloud-Vue3
# 安装依赖
yarn --registry=https://registry.npmmirror.com
# 启动服务
yarn dev
# 构建测试环境 yarn build:stage
# 构建生产环境 yarn build:prod
# 前端访问地址 http://localhost:80
(1)创建数据库ry-cloud并导入数据脚本ry_2021xxxx.sql(必须),quartz.sql(可选)
(2)创建数据库ry-config并导入数据脚本ry_config_2021xxxx.sql(必须)
(3)配置nacos持久化,修改conf/application.properties文件,增加支持mysql数据源配置
先创建nacos容器:
docker run -d --name nacos2 -p 7848:7848 -p 8848:8848 -p 9848:9848 -p 9849:9849 --env MODE=standalone nacos/nacos-server:v2.2.3
再进入conf目录修改application.properties文件
# db mysql
spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://localhost:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=root
db.password=password
RuoYiGatewayApplication (网关模块 必须)
RuoYiAuthApplication (认证模块 必须)
RuoYiSystemApplication (系统模块 必须)
RuoYiMonitorApplication (监控中心 可选)
RuoYiGenApplication (代码生成 可选)
RuoYiJobApplication (定时任务 可选)
RuoYFileApplication (文件服务 可选)
(1)创建容器命令如下:
docker run -d --name nacos2 -p 7848:7848 -p 8848:8848 -p 9848:9848 -p 9849:9849 --env MODE=standalone nacos/nacos-server:v2.2.3
(2)进入容器,修改
docker exec -it nacos2 bash
vim application.properties
这个需要集成在ruoyi-system项目里面:
(1)第一步是在pom.xml文件中增加依赖
<!-- kafka依赖 -->
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<!-- springdata整合ES-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
(2)第二步,在Nacos上修改yml文件
spring:
elasticsearch:
rest:
uris: http://192.168.80.192:9200
kafka:
bootstrap-servers: 192.168.80.192:9092
producer: #生产者序列化器
retries: 10
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: org.apache.kafka.common.serialization.StringSerializer
ack-mode: manual
consumer: #消费者序列化器
group-id: ${spring.application.name}-test
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
listener:
ack-mode: manual # 消息手动确认模式,防止消息丢失
import { login, logout, getInfo } from '@/api/login'
onMounted(() => {
getInfo().then(res => {
console.log('user', res.user);
})
})