我一开始去若依官网学习,去Gitee上面下载的是RuoYi-Cloud 若依微服务版本 发现是mysql库,按照若依官方文档我运行了起来,没有啥太大的问题,但是我想要oracle版本,又去网上找了找终于在github上面找到了https://github.com/yangzongzhuan/RuoYi-Cloud-Oracle?tab=readme-ov-file 我就clone克隆了下来,和本身mysql版本运行思想是一样的,只是这个项目下面导入的sql是oracle的 创建RY-CLOUD表空间和用户 打开库 右击运行RuoYi-Cloud-Oracle下sql中的
但是nacos配置中心默认用的是mysql,所以还是需要一部分的mysql ry-config库
seata我是没有用
整体过程:
若依官方:https://doc.ruoyi.vip/ruoyi-cloud/document/hjbs.html#%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C
1.IDEA中运行需要注意:
RuoYiGatewayApplication网关服务 端口要是已占用的话,可以改成8079或者其他,前端vue.config.js中也需要修改,本地部署的时候nginx里面的注意写成http://localhost:8079/
RuoYiAuthApplication 认证服务 占用的话可以修改为9199
其他服务启动端口占用的话也需要修改
2.本地部署需要注意:
(1)打jar包,去各个springboot启动类对应的target下把它copy到部署的文件夹中,然后去项目根目录bin下将bat文件也copy到部署的文件夹中,如下图:
(2)确保nacos启动了,遇到出现启动起来之后闪退的情况,可能是mysql数据库没有连接上,重启mysql,再次双击nacos>bin>startup.cmd,之后会有一个nacos cmd的启动窗口,不要不小心关了
(3)分别双击启动run-auth.bat run-gateway.bat run-modules-system.bat 这三个是必须启动的 没有先后顺序 其他的run-modules-file.bat 文件上传 run-modules-gen.bat代码生成 run-modules-job.bat 定时任务 按照需求启动 和在IDEA中运行思想一样
(4)nginx配置:
nginx下载下来之后,修改nginx.conf 中的监听端口为8081(自己想要的端口切记不要端口冲突了)之后双击nginx.exe 闪退 不用担心 访问localhost:8081 会出现nginx的欢迎页面 说明nginx没有问题
之后开始打vue前端包,IDEA中打开Terminal
cd ruoyi-ui
npm run build:prod
打正式环境包
打包之前需要修改的地方有:
然后打包,之后在ruoyi-ui中会生成一个dist的文件夹,将这个放到nginx/html中,然后就可以配置nginx.conf了
#user root;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 8081;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html/dist;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /prod-api/ { #后端访问子路径,项目.env.development中的配置
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://localhost:8080/; #后端访问接口
}
location /dev-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://localhost:8080/;
}
location /profile/ {
proxy_pass http://127.0.0.1:8080/profile/;
}
# 避免actuator暴露
if ($request_uri ~ "/actuator") {
return 403;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
重启nginx
之后就访问:http://localhost:8081/#/login?redirect=%2Findex