前端部署文档.md 2.6 KB
Newer Older
D
dailidong 已提交
1 2
# 前端部署文档

D
dailidong 已提交
3
前端有3种部署方式,分别为自动化部署,手动部署和编译源码部署
G
gongzijian 已提交
4

D
dailidong 已提交
5
## 1、准备工作
D
dailidong 已提交
6
#### 下载安装包
G
gongzijian 已提交
7

journey2018's avatar
journey2018 已提交
8
目前最新安装包版本是1.0.2,下载地址: [码云下载](https://gitee.com/easyscheduler/EasyScheduler/attach_files/)
G
gongzijian 已提交
9

journey2018's avatar
journey2018 已提交
10
下载escheduler-ui-1.0.2.tar.gz后,解压后会产生dist目录,进入dist目录
D
dailidong 已提交
11
> cd dist  
G
gongzijian 已提交
12 13


D
dailidong 已提交
14

D
dailidong 已提交
15 16 17
## 2、部署
以下两种方式任选其一部署即可,推荐自动化部署
### 2.1 自动化部署
D
dailidong 已提交
18

D
dailidong 已提交
19
在前端项目根目录dist下编辑安装文件`vi install(线上环境).sh`(执行时,最好修改install(线上环境).sh为install-ui.sh,跟后端部署区分)
G
gongzijian 已提交
20

G
gongzijian 已提交
21
更改前端访问端口和后端代理接口地址
G
gongzijian 已提交
22 23

```
G
gongzijian 已提交
24 25
# 配置前端访问端口
esc_proxy="8888"
G
gongzijian 已提交
26

G
gongzijian 已提交
27
# 配置代理后端接口
D
dailidong 已提交
28
esc_proxy_port="http://192.168.xx.xx:12345"
G
gongzijian 已提交
29 30
```

D
dailidong 已提交
31
前端自动部署基于linux系统`yum`操作,部署之前请先安装更新`yum`
G
gongzijian 已提交
32

D
dailidong 已提交
33
在前端项目根目录dist下执行`./install(线上环境).sh` 或者改名后的 `./install-ui.sh`
G
gongzijian 已提交
34

G
gongzijian 已提交
35

D
dailidong 已提交
36
### 2.2 手动部署
D
dailidong 已提交
37 38 39 40 41 42

安装epel源 `yum install epel-release -y`

安装Nginx `yum install nginx -y`


D
dailidong 已提交
43
> ####  nginx配置文件地址
D
dailidong 已提交
44
```
D
dailidong 已提交
45
/etc/nginx/conf.d/default.conf
D
dailidong 已提交
46
```
D
dailidong 已提交
47
> ####  配置信息(自行修改)
D
dailidong 已提交
48 49 50 51 52 53 54
```
server {
    listen       8888;# 访问端口
    server_name  localhost;
    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;
    location / {
D
dailidong 已提交
55
        root   /xx/dist; # 上面前端解压的dist目录地址(自行修改)
D
dailidong 已提交
56 57 58
        index  index.html index.html;
    }
    location /escheduler {
D
dailidong 已提交
59
        proxy_pass http://192.168.xx.xx:12345; # 接口地址(自行修改)
D
dailidong 已提交
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header x_real_ipP $remote_addr;
        proxy_set_header remote_addr $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_http_version 1.1;
        proxy_connect_timeout 4s;
        proxy_read_timeout 30s;
        proxy_send_timeout 12s;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    #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   /usr/share/nginx/html;
    }
}
```
> ####  重启Nginx服务
```
systemctl restart nginx
```

D
dailidong 已提交
86
#### nginx命令
D
dailidong 已提交
87

D
dailidong 已提交
88
- 启用 `systemctl enable nginx`
G
gongzijian 已提交
89

D
dailidong 已提交
90
- 重启 `systemctl restart nginx`
G
gongzijian 已提交
91

D
dailidong 已提交
92
- 状态 `systemctl status nginx`
G
gongzijian 已提交
93 94


D
dailidong 已提交
95
## 前端常见问题
D
dailidong 已提交
96 97 98 99 100
####  1. 上传文件大小限制
编辑配置文件 `vi /etc/nginx/nginx.conf`
```
# 更改上传大小
client_max_body_size 1024m
journey2018's avatar
journey2018 已提交
101
```