Skip to content

Commit 9863420

Browse files
committed
Modify the deployment document
1 parent b07f9dc commit 9863420

File tree

3 files changed

+231
-18
lines changed

3 files changed

+231
-18
lines changed

config.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Configuring front-end ports
2+
scriptis_port="8088"
3+
4+
# URL of the backend linkis gateway
5+
linkis_url="http://localhost:20401"
6+
7+
# Scriptis ip address
8+
scriptis_ipaddr=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}')

docs/zh_CN/ch1/前台部署文档.md

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,38 @@ Scriptis是基于Linkis开发的数据分析工具,部署Scriptis前需要先
22

33
## 1、准备工作
44

5-
### (1)点击release 选择对应的安装包进行下载
6-
7-
### (2)解压 下载的安装包
5+
    
6+
1. 点击release 选择对应的安装包进行下载
7+
2. 将下载下来的安装包在安装目录进行解压:unzip wedatasphere-scriptis-0.5.0-dist.zip
88

99
## 2、部署
10-
### (1)安装Nginx
10+
    分为两种部署方式,自动化部署和手动部署
1111

12-
sudo yum install nginx -y
12+
### 2.1 自动化部署
13+
    进入前端目录```wedatasphere-scriptis``` 在该目录下编辑 ```vi config.sh ```
14+
更改前端端口和后端接口地址,后端接口地址为linkis的gateway地址
15+
```$xslt
16+
# Configuring front-end ports
17+
scriptis_port="8088"
1318
14-
### (2)创建Nginx配置文件(文件名可自行修改)
19+
# URL of the backend linkis gateway
20+
linkis_url="http://localhost:20401"
1521
16-
sudo vi /etc/nginx/conf.d/scriptis.conf
22+
# Scriptis ip address
23+
scriptis_ipaddr=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}')
24+
```
25+
26+
修改完后在该目录下执行:```sudo sh install.sh > install.log 2>&1```
27+
28+
执行完后可以直接通过在谷歌浏览器访问:```http://scriptis_ipaddr:scriptis_port``` 其中scriptis_port为config.sh里面配置的端口,scriptis_ipaddr为安装机器的IP
29+
30+
如果访问失败:可以通过查看 install.log的日志查看哪一步出错
1731

18-
### (3)修改保存上面创建的配置文件
32+
### 2.2 手动部署
33+
1.安装Nginx:```sudo yum install nginx -y```
1934

35+
2.修改配置文件:sudo vi /etc/nginx/conf.d/scriptis.conf
36+
添加如下内容:
2037
```
2138
server {
2239
listen 8080;# 访问端口
@@ -57,29 +74,26 @@ server {
5774
}
5875
5976
```
60-
### 3.启动服务
6177

62-
sudo systemctl restart nginx
78+
3.将前端包拷贝到对应的目录:```/appcom/Install/scriptis/ROOT; # 前端包解压的目录 ```
6379

64-
### 4.常见问题
80+
4.启动服务```sudo systemctl restart nginx```
6581

66-
#### (1)上传文件大小限制
82+
5.执行完后可以直接通过在谷歌浏览器访问:```http://nginx_ip:nginx_port```
6783

68-
sudo vi /etc/nginx/nginx.conf
84+
## 3、常见问题
6985

86+
(1)上传文件大小限制
87+
sudo vi /etc/nginx/nginx.conf
7088
更改上传大小
71-
7289
```
7390
client_max_body_size 200m
7491
```
7592

76-
77-
#### (2)接口超时
93+
(2)接口超时
7894

7995
sudo vi /etc/nginx/conf.d/scriptis.conf
80-
8196
更改接口超时时间
82-
8397
```
8498
proxy_read_timeout 600s
8599
```

install.sh

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
#!/bin/bash
2+
3+
# 当前路径
4+
workDir=$(cd `dirname $0`; pwd)
5+
6+
7+
echo "Scriptis front-end deployment script"
8+
9+
source $workDir/config.sh
10+
# 前端放置目录,默认为解压目录
11+
scriptis_basepath=$workDir
12+
13+
#To be compatible with MacOS and Linux
14+
if [[ "$OSTYPE" == "darwin"* ]]; then
15+
# Mac OSX
16+
echo "scriptis install not support Mac OSX operating system"
17+
exit 1
18+
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
19+
# linux
20+
echo "linux"
21+
elif [[ "$OSTYPE" == "cygwin" ]]; then
22+
# POSIX compatibility layer and Linux environment emulation for Windows
23+
echo "scriptis not support Windows operating system"
24+
exit 1
25+
elif [[ "$OSTYPE" == "msys" ]]; then
26+
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
27+
echo "scriptis not support Windows operating system"
28+
exit 1
29+
elif [[ "$OSTYPE" == "win32" ]]; then
30+
echo "scriptis not support Windows operating system"
31+
exit 1
32+
elif [[ "$OSTYPE" == "freebsd"* ]]; then
33+
# ...
34+
echo "freebsd"
35+
else
36+
# Unknown.
37+
echo "Operating system unknown, please tell us(submit issue) for better service"
38+
exit 1
39+
fi
40+
41+
# 区分版本
42+
version=`cat /etc/redhat-release|sed -r 's/.* ([0-9]+)\..*/\1/'`
43+
44+
45+
echo "========================================================================配置信息======================================================================="
46+
47+
echo "前端访问端口:${scriptis_port}"
48+
echo "后端Linkis的地址:${linkis_url}"
49+
echo "静态文件地址:${scriptis_basepath}/dist"
50+
echo "当前路径:${workDir}"
51+
echo "本机ip:${scriptis_ipaddr}"
52+
53+
echo "========================================================================配置信息======================================================================="
54+
echo ""
55+
56+
57+
# 创建文件并配置nginx
58+
scriptiConf(){
59+
60+
s_host='$host'
61+
s_remote_addr='$remote_addr'
62+
s_proxy_add_x_forwarded_for='$proxy_add_x_forwarded_for'
63+
s_http_upgrade='$http_upgrade'
64+
echo "
65+
server {
66+
listen $scriptis_port;# 访问端口
67+
server_name localhost;
68+
#charset koi8-r;
69+
#access_log /var/log/nginx/host.access.log main;
70+
location / {
71+
root ${scriptis_basepath}/dist; # 静态文件目录
72+
index index.html index.html;
73+
}
74+
location /ws {
75+
proxy_pass $linkis_url;#后端Linkis的地址
76+
proxy_http_version 1.1;
77+
proxy_set_header Upgrade $s_http_upgrade;
78+
proxy_set_header Connection "upgrade";
79+
}
80+
81+
location /api {
82+
proxy_pass $linkis_url; #后端Linkis的地址
83+
proxy_set_header Host $s_host;
84+
proxy_set_header X-Real-IP $s_remote_addr;
85+
proxy_set_header x_real_ipP $s_remote_addr;
86+
proxy_set_header remote_addr $s_remote_addr;
87+
proxy_set_header X-Forwarded-For $s_proxy_add_x_forwarded_for;
88+
proxy_http_version 1.1;
89+
proxy_connect_timeout 4s;
90+
proxy_read_timeout 600s;
91+
proxy_send_timeout 12s;
92+
proxy_set_header Upgrade $s_http_upgrade;
93+
proxy_set_header Connection upgrade;
94+
}
95+
96+
#error_page 404 /404.html;
97+
# redirect server error pages to the static page /50x.html
98+
#
99+
error_page 500 502 503 504 /50x.html;
100+
location = /50x.html {
101+
root /usr/share/nginx/html;
102+
}
103+
}
104+
" > /etc/nginx/conf.d/scriptis.conf
105+
106+
}
107+
108+
109+
centos7(){
110+
# nginx是否安装
111+
#sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
112+
sudo yum install -y nginx
113+
echo "nginx 安装成功"
114+
115+
# 配置nginx
116+
scriptiConf
117+
118+
# 解决 0.0.0.0:8888 问题
119+
yum -y install policycoreutils-python
120+
semanage port -a -t http_port_t -p tcp $scriptis_port
121+
122+
# 开放前端访问端口
123+
firewall-cmd --zone=public --add-port=$scriptis_port/tcp --permanent
124+
125+
# 重启防火墙
126+
firewall-cmd --reload
127+
128+
# 启动nginx
129+
systemctl restart nginx
130+
131+
# 调整SELinux的参数
132+
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
133+
# 临时生效
134+
setenforce 0
135+
136+
}
137+
138+
139+
centos6(){
140+
# yum
141+
S_basearch='$basearch'
142+
S_releasever='$releasever'
143+
echo "
144+
[nginx]
145+
name=nginx repo
146+
baseurl=http://nginx.org/packages/centos/$E_releasever/$S_basearch/
147+
gpgcheck=0
148+
enabled=1
149+
" >> /etc/yum.repos.d/nginx.repo
150+
151+
# install nginx
152+
yum install nginx -y
153+
154+
# 配置nginx
155+
scriptiConf
156+
157+
# 防火墙
158+
S_iptables=`lsof -i:$scriptis_port | wc -l`
159+
if [ "$S_iptables" -gt "0" ];then
160+
# 已开启端口防火墙重启
161+
service iptables restart
162+
else
163+
# 未开启防火墙添加端口再重启
164+
iptables -I INPUT 5 -i eth0 -p tcp --dport $scriptis_port -m state --state NEW,ESTABLISHED -j ACCEPT
165+
service iptables save
166+
service iptables restart
167+
fi
168+
169+
# start
170+
/etc/init.d/nginx start
171+
172+
# 调整SELinux的参数
173+
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
174+
175+
# 临时生效
176+
setenforce 0
177+
178+
}
179+
180+
# centos 6
181+
if [[ $version -eq 6 ]]; then
182+
centos6
183+
fi
184+
185+
# centos 7
186+
if [[ $version -eq 7 ]]; then
187+
centos7
188+
fi
189+
190+
191+
echo "请浏览器访问:http://${scriptis_ipaddr}:${scriptis_port}"

0 commit comments

Comments
 (0)