📝 doc.
This commit is contained in:
70
docs/quickstart/dev.md
Normal file
70
docs/quickstart/dev.md
Normal file
@@ -0,0 +1,70 @@
|
||||
### 所需环境
|
||||
|
||||
* JDK 1.8
|
||||
* Mysql 8.0(+)
|
||||
* Redis 5.0.5(+)
|
||||
* Node 16.16.0(+)
|
||||
* Maven 3.5.4(+)
|
||||
|
||||
⚡ maven 推荐使用阿里云 mirror
|
||||
⚡ npm 建议使用淘宝镜像 `npm config set registry https://registry.npmmirror.com/`
|
||||
|
||||
### 配置
|
||||
|
||||
1. 拉取代码
|
||||
|
||||
```
|
||||
# github
|
||||
git clone https://github.com/lijiahangmax/orion-ops-pro
|
||||
# gitee
|
||||
git clone https://gitee.com/lijiahangmax/orion-ops-pro
|
||||
```
|
||||
|
||||
2. 初始化数据库
|
||||
|
||||
```
|
||||
# 执行脚本
|
||||
orion-ops-pro/sql/init-1-schema-databases.sql
|
||||
orion-ops-pro/sql/init-2-schema-tables.sql
|
||||
orion-ops-pro/sql/init-3-data.sql
|
||||
```
|
||||
|
||||
3. 修改后端配置
|
||||
|
||||
```
|
||||
# 修改配置文件 (mysql, redis, secret-key)
|
||||
orion-ops-pro/orion-ops-launch/src/main/resources/application-prod.yaml
|
||||
|
||||
# 进入代码目录
|
||||
cd orion-ops-pro
|
||||
# 编译
|
||||
mvn -U clean install -DskipTests
|
||||
```
|
||||
|
||||
4. 修改前端配置
|
||||
|
||||
```
|
||||
# 进入代码目录
|
||||
cd orion-ops-pro/orion-ops-ui
|
||||
# 下载 pnpm
|
||||
npm i -g pnpm
|
||||
# 下载依赖
|
||||
pnpm i
|
||||
# 运行
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
### 测试访问
|
||||
|
||||
启动前端后会自动打开浏览器 输入
|
||||
账号: `admin`
|
||||
密码: `admin`
|
||||
|
||||
### 文档
|
||||
|
||||
文档只有在 `dev` 环境才可以访问
|
||||
|
||||
- swagger 文档 http://127.0.0.1:9200/doc.html
|
||||
- druid console http://127.0.0.1:9200/druid/index.html
|
||||
- actuator endpoint http://127.0.0.1:9200/actuator
|
||||
- admin console http://127.0.0.1:9200/admin
|
||||
59
docs/quickstart/docker-install.md
Normal file
59
docs/quickstart/docker-install.md
Normal file
@@ -0,0 +1,59 @@
|
||||
### 所需环境
|
||||
|
||||
* Docker 20.10.14+
|
||||
* Docker Compose 2.3.3+
|
||||
|
||||
由于访问 DockerHub 镜像比较慢, 可以修改一下配置加速镜像 /etc/docker/daemon.json, 如果没有此文件可以创建此文件 (Linux系统, Window 和 Mac 直接可以通过 Docker 的
|
||||
Dashboard 修改)
|
||||
|
||||
```json
|
||||
{
|
||||
"registry-mirrors": [
|
||||
"https://registry.docker-cn.com",
|
||||
"https://registry.cn-hangzhou.aliyuncs.com",
|
||||
"https://mirror.ccs.tencentyun.com",
|
||||
"https://docker.mirrors.ustc.edu.cn"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 构建镜像
|
||||
|
||||
```
|
||||
# 进入仓库目录
|
||||
cd orion-ops-pro
|
||||
# 修改 docker-compose.yml (建议修改)
|
||||
# SECRET_KEY 加密秘钥
|
||||
# MYSQL_USER mysql 用户名
|
||||
# MYSQL_PASSWORD mysql 用户密码
|
||||
# MYSQL_ROOT_PASSWORD mysql root 密码
|
||||
# REDIS_PASSWORD redis 密码
|
||||
# 构建
|
||||
docker compose build
|
||||
```
|
||||
|
||||
### 启动
|
||||
|
||||
```
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### 连接 mysql (如果需要在 navicat 中连接)
|
||||
|
||||
```
|
||||
访问 adminer: http://localhost:8081
|
||||
服务器: orion-ops-pro-db
|
||||
用户名: root
|
||||
密码: Data@123456
|
||||
数据库: orion-ops-pro
|
||||
|
||||
点击左侧 SQL命令 输入:
|
||||
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Data@123456';
|
||||
执行 OK
|
||||
```
|
||||
|
||||
### 测试访问
|
||||
|
||||
在浏览器中输入 http://localhost:1081/ 访问
|
||||
账号: admin
|
||||
密码: admin
|
||||
50
docs/quickstart/faq.md
Normal file
50
docs/quickstart/faq.md
Normal file
@@ -0,0 +1,50 @@
|
||||
> ##### 1. 数据误删除怎么办?
|
||||
|
||||
数据库的数据都采用了逻辑删除, 可以将已删除的数据中的 `deleted` 字段改为 `0`
|
||||
如果不知道数据是哪一条, 可以查询用户操作日志, 点击 `参数` 寻找操作的id
|
||||
|
||||
> ##### 2. 是否支持维护 Windows 主机?
|
||||
|
||||
支持, 但是 Windows 的 ssh 命令兼容性不好, 一切需要执行ssh命令的地方都不友好
|
||||
如: 批量执行, 调度任务兼容性非常不友好
|
||||
|
||||
> ##### 3. 执行命令时为什么会找不到环境变量?
|
||||
|
||||
可以在执行命令的第一行设置 `source /etc/profile` 来加载环境变量
|
||||
|
||||
> ##### 4. 命令中途执行失败如何设置中断执行?
|
||||
|
||||
可以在执行命令的第一行设置 `set -e`
|
||||
作用是: 当执行出现意料之外的情况时, 立即退出
|
||||
|
||||
> ##### 5. 在调度任务、应用构建、应用发布 命令执行成功的依据是什么?
|
||||
|
||||
是获取命令的 `exitcode` 判断是否为 `0` 如果非0则代表命令执行失败
|
||||
同理, 在命令的最后一行设置 `exit 1` 结果将会是失败, 可以用此来中断后续流程
|
||||
|
||||
> ##### 6. 为什么使用秘钥认证还是无法连接机器?
|
||||
|
||||
```
|
||||
# 升级 openssh
|
||||
yum update openssh
|
||||
sshd -v (我的版本: OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017)
|
||||
|
||||
# 生成秘钥时添加参数 -m PEM
|
||||
ssh-keygen -t rsa -m PEM
|
||||
chmod 700 ~/.ssh
|
||||
chmod 700 ~/.ssh/authorized_keys
|
||||
|
||||
# 修改 sshd 配置 /etc/ssh/sshd_config
|
||||
PubkeyAuthentication yes
|
||||
RSAAuthentication yes
|
||||
AuthorizedKeysFile .ssh/authorized_keys
|
||||
|
||||
# 重启 sshd 服务
|
||||
service sshd restart
|
||||
```
|
||||
|
||||
<br/>
|
||||
|
||||
⚡ 详细使用请参考操作手册~
|
||||
|
||||
<br/>
|
||||
133
docs/quickstart/install.md
Normal file
133
docs/quickstart/install.md
Normal file
@@ -0,0 +1,133 @@
|
||||
### 所需环境
|
||||
|
||||
* JDK 1.8
|
||||
* Mysql 8.0(+)
|
||||
* Redis 5.0.5(+)
|
||||
* Node 16.16.0(+)
|
||||
* Maven 3.5.4(+)
|
||||
* Nginx
|
||||
|
||||
⚡ maven 推荐使用阿里云 mirror
|
||||
⚡ npm 建议使用淘宝镜像 `npm config set registry https://registry.npmmirror.com/`
|
||||
|
||||
### 构建
|
||||
|
||||
1. 拉取代码
|
||||
|
||||
```
|
||||
# github
|
||||
git clone https://github.com/lijiahangmax/orion-ops-pro
|
||||
# gitee
|
||||
git clone https://gitee.com/lijiahangmax/orion-ops-pro
|
||||
```
|
||||
|
||||
2. 初始化数据库
|
||||
|
||||
```
|
||||
# 执行脚本
|
||||
orion-ops-pro/sql/init-1-schema-databases.sql
|
||||
orion-ops-pro/sql/init-2-schema-tables.sql
|
||||
orion-ops-pro/sql/init-3-data.sql
|
||||
```
|
||||
|
||||
3. 构建后端代码
|
||||
|
||||
```
|
||||
# 修改配置文件 (mysql, redis, secret-key)
|
||||
orion-ops-pro/orion-ops-launch/src/main/resources/application-prod.yaml
|
||||
|
||||
# 进入代码目录
|
||||
cd orion-ops-pro
|
||||
# 编译
|
||||
mvn -U clean install -DskipTests
|
||||
```
|
||||
|
||||
4. 构建前端代码
|
||||
|
||||
```
|
||||
# 进入代码目录
|
||||
cd orion-ops-pro/orion-ops-ui
|
||||
# 下载 pnpm
|
||||
npm i -g pnpm
|
||||
# 下载依赖
|
||||
pnpm i
|
||||
# 编译
|
||||
pnpm build
|
||||
```
|
||||
|
||||
### 修改 nginx 配置
|
||||
|
||||
```
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
client_max_body_size 1024m;
|
||||
|
||||
# 是否启动 gzip 压缩
|
||||
gzip on;
|
||||
# 需要压缩的常见静态资源
|
||||
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
|
||||
# 如果文件大于 1k 就启动压缩
|
||||
gzip_min_length 1k;
|
||||
# 缓冲区
|
||||
gzip_buffers 4 16k;
|
||||
# 压缩的等级
|
||||
gzip_comp_level 2;
|
||||
# access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# web history 模式 404
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /orion/api {
|
||||
proxy_pass http://localhost:9200/orion/api;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /orion/keep-alive {
|
||||
proxy_pass http://localhost:9200/orion/keep-alive;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
### 部署
|
||||
|
||||
```
|
||||
复制 orion-ops-pro/orion-ops-ui 到 /usr/share/nginx/html
|
||||
复制 orion-ops-pro/orion-ops-launch/target/orion-ops-launch.jar 到 /data/orion
|
||||
# 启动后台服务
|
||||
nohup java -jar orion-ops-launch.jar --spring.profiles.active=prod 2>&1 &
|
||||
# 启动 nginx
|
||||
service nginx start
|
||||
```
|
||||
|
||||
### 测试访问
|
||||
|
||||
在浏览器中输入 http://localhost 访问
|
||||
账号: `admin`
|
||||
密码: `admin`
|
||||
Reference in New Issue
Block a user