在线ide部署
# JKS构建服务器
# 环境
yum install -y gcc make libsecret-devel
1
On Unix
- Python v3.7, v3.8, v3.9, or v3.10
make
- A proper C/C++ compiler toolchain, like GCC (opens new window)
keytar
Currently this library uses libsecret
so you may need to install it before running npm install
.
Depending on your distribution, you will need to run the following command:
- Debian/Ubuntu:
sudo apt-get install libsecret-1-dev
- Red Hat-based:
sudo yum install libsecret-devel
- Arch Linux:
sudo pacman -S libsecret
# 配置
# 脚本部分
cd $WORKSPACE
#正式用
sh deploy.sh
#测试用,可以直接把下面的脚本拷贝过来
1
2
3
4
5
2
3
4
5
deploy.sh
cd yarn
npm config set registry https://registry.npm.taobao.org
# npm install -g node-gyp
npm i
cd ..
#wget https://nodejs.org/dist/v14.20.0/node-v14.20.0-linux-x64.tar.gz
./yarn/node_modules/.bin/yarn config set registry http://registry.npm.taobao.org/
./yarn/node_modules/.bin/yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/
./yarn/node_modules/.bin/yarn
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "38i\\"$'\n''"./src/***/*",' tsconfig.json
sed -i "" "38i\\"$'\n''"./modules/***/*",' tsconfig.json
else
sed -i "38i\\"$'\n''"./src/***/*",' tsconfig.json
sed -i "38i\\"$'\n''"./modules/***/*",' tsconfig.json
fi
./yarn/node_modules/.bin/yarn run build
#上面安装过了不用install时安装过了
# ./yarn/node_modules/.bin/yarn run download:extensions
cp -rf dist dist-node hosted deploy/
#插件部分,要改成到部署服务器端处理;
#if [[ "$OSTYPE" != "darwin"* ]]; then
# mkdir -p /root/.sumi/extensions
# cp -rf extensions /root/.sumi/extensions
#fi
# cd deploy
# rm -rf bdp-ide.tar.gz
# tar zcvf bdp-ide.tar.gz --exclude=node_modules --exclude=tmp --exclude=bdp-ide.tar.gz ./
tar zcvf deploy.tar.gz deploy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 拉取处理
cd /home/xxx/portal/bdp-ide
sh getDeploy.sh
tar zxvf deploy.tar.gz
cd deploy && sh install.sh && sh start.sh
1
2
3
4
2
3
4
# 部署服务器
这个机器上,一定要注意用户权限问题;
# 注意
特别要注意这个服务器的部署跟Docker部署的方式还不一样,不用指定插件按照路径,还要处理,修改部分脚本代码tmp的目录处理,使其支持非root用户下可以部署安装项目;
bdp-ide/scripts/download.js
tmpPath处理;
async function downloadExtension(url, namespace, extensionName) {
const tmpPath = path.join(os.homedir(), os.tmpdir(), 'extension', v4());
xxxx
}
1
2
3
4
2
3
4
bdp-ide/src/node/start-server.ts
extHostIPCSockPath处理
const extHostIPCSockPath = path.join(os.homedir(), os.tmpdir());
let opts: IServerAppOpts = {
use: app.use.bind(app),
processCloseExitThreshold: 5 * 60 * 1000,
terminalPtyCloseThreshold: 5 * 60 * 1000,
staticAllowOrigin: '*',
staticAllowPath: [
workspaceDir,
extensionDir,
'/',
],
extHost: extensionHost,
webSocketHandler:[],
extHostIPCSockPath:extHostIPCSockPath,
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
启动构建时,不在指定插件路径地址:
"build:old": "cross-env EXTENSION_DIR=/root/.sumi/extensions BASE=/ide/ NODE_ENV=production NODE_OPTIONS=--max_old_space_size=5120 npm run compile:browser && cross-env EXTENSION_DIR=/root/.sumi/extensions npm run compile:node && npm run compile:worker-host && npm run compile:ext-host && npm run compile:webview",
"build": "cross-env BASE=/ide/ NODE_ENV=production NODE_OPTIONS=--max_old_space_size=5120 npm run compile:browser && cross-env npm run compile:node && npm run compile:webview"
1
2
2
# 环境
提前准备的环境
yum install -y gcc make libsecret-devel
#安装node14.20
#设置淘宝源
#安装pm2
wget https://nodejs.org/dist/v14.20.0/node-v14.20.0-linux-x64.tar.gz
tar -zxf node-v14.20.0-linux-x64.tar.gz
#以下是用root账户处理
mv node-v14.20.0-linux-x64 /usr/local/nodejs
ln -s /usr/local/nodejs/bin/npm /usr/local/bin/npm
ln -s /usr/local/nodejs/bin/node /usr/local/bin/node
ln -s /usr/local/nodejs/bin/npx /usr/local/bin/
node -v && npm -v
npm config set registry https://registry.npm.taobao.org -g
npm config set electron_mirror https://npm.taobao.org/mirrors/electron -g
sudo npm i -g pm2
ln -s /usr/local/nodejs/bin/pm2 /usr/local/bin/
#普通用户处理
mkdir -p /home/xxxx/portal/bdp-ide
sh install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 获取gz包
getDeploy.sh
#!/bin/sh
sleep 1
ftp -niv <<!
open 10.45.4xx
user xx xxx
binary
cd /var/lib/jenkins/workspace/bdp-ide-dev
lcd /home/xxx/bdp-ide
prompt
get deploy.tar.gz
close
bye
!
sleep 2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
# 依赖安装
install.sh
tar zxvf bdp-ide.tar.gz
npm config set registry https://registry.npm.taobao.org
npm i -g pm2
npm i
sh start.sh
1
2
3
4
5
6
7
2
3
4
5
6
7
# 启动
start.sh
pm2 startOrRestart pm2.json
1
# ngx代理
#user bdpcloud;
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 10240;
}
http {
include mime.types;
default_type application/octet-stream;
server_tokens off;
client_max_body_size 10240M;
#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 100;
fastcgi_connect_timeout 600;
fastcgi_send_timeout 600;
fastcgi_read_timeout 600;
# 开启和关闭gzip模式
gzip on;
# gizp压缩起点,文件大于1k才进行压缩
gzip_min_length 1k;
# gzip 压缩级别,1-9,数字越大压缩的越好,也越占用CPU时间
gzip_comp_level 3;
# 进行压缩的文件类型。
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript ;
# nginx对于静态文件的处理模块,开启后会寻找以.gz结尾的文件,直接返回,不会占用cpu进行压缩,如果找不到则不进行压缩
#gzip_static on
# 是否在http header中添加Vary: Accept-Encoding,建议开启
gzip_vary on;
# 设置压缩所需要的缓冲区大小,以4k为单位,如果文件为7k则申请2*4k的缓冲区
gzip_buffers 2 4k;
# 开启下划线传参
#underscores_in_headers on;
upstream gateway {
server 10.45.xx.xx:9005;
}
upstream gateway_test {
server 10.xx.xx.67:8972 weight=10 max_fails=2 fail_timeout=30s;
server 10.xx.47.67:8974 weight=10 max_fails=2 fail_timeout=30s;
keepalive 400;
}
server {
listen 8559;
server_name localhost;
large_client_header_buffers 4 16k; #header大小
client_max_body_size 300m; #上传文件大小限制
client_body_buffer_size 128k; #缓冲区大小
proxy_connect_timeout 600; #设置与upstream server的连接超时时间
proxy_read_timeout 600; #设置与代理服务器的读超时时间
proxy_send_timeout 600; #发送请求给upstream服务器的超时时间
underscores_in_headers on; #header允许使用带'_'的参数
location /ide/aiFactoryServer {
proxy_pass http://127.0.0.1:9005/aiFactoryServer;
proxy_set_header Host $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;
}
location /ide/datadev {
proxy_pass http://127.0.0.1:9985/datadev;
proxy_set_header Host $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;
}
#这个路径特殊处理,要处理图片资源相关的;单独部署的可以不用考虑完全匹配
location /ide/ {
proxy_pass http://127.0.0.1:8787/ide/;
proxy_set_header Host $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;
}
#soceket部分
location /ide/service {
proxy_pass http://127.0.0.1:8787/service;
proxy_set_header Host $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_set_header X-Real_IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
}
#第三方插件图标相关
location /ide/assets {
proxy_pass http://127.0.0.1:8787/assets;
proxy_set_header Host $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;
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# 相关脚本
# 项目package.json
注意前置安装构建;
"scripts": {
"postinstall:old": "npm run compile:worker-host && npm run compile:ext-host && npm run download:extensions",
"postinstall": "npm run compile:worker-host && npm run compile:ext-host",
"build:old": "cross-env EXTENSION_DIR=/root/.sumi/extensions BASE=/ide/ NODE_ENV=production NODE_OPTIONS=--max_old_space_size=5120 npm run compile:browser && cross-env EXTENSION_DIR=/root/.sumi/extensions npm run compile:node && npm run compile:worker-host && npm run compile:ext-host && npm run compile:webview",
"build": "cross-env EXTENSION_DIR=/root/.sumi/extensions BASE=/ide/ NODE_ENV=production NODE_OPTIONS=--max_old_space_size=5120 npm run compile:browser && cross-env EXTENSION_DIR=/root/.sumi/extensions npm run compile:node && npm run compile:webview",
"compile:browser": "webpack --config ./configs/webpack.browser.config.js",
"compile:node": "webpack --config ./configs/webpack.node.config.js",
"compile:worker-host": "cross-env NODE_ENV=production webpack --config ./configs/webpack.worker-host.config.js",
"compile:ext-host": "cross-env NODE_ENV=production webpack --config ./configs/webpack.ext-host.config.js",
"compile:webview": "cross-env NODE_ENV=production webpack --config ./configs/webpack.webview.config.js",
"start:old": "run-p start:client start:server start:webview",
"start": "run-p start:client start:server",
"start:client": "cross-env NODE_ENV=development webpack-dev-server --config ./configs/webpack.browser.config.js --progress --color --watch",
"start:server": "cross-env EXT_MODE=js KTLOG_SHOW_DEBUG=1 node --inspect=9991 -r ts-node/register -r tsconfig-paths/register ./src/node/index.ts",
"start:webview": "webpack-dev-server --config ./configs/webpack.webview.config.js",
"download:extensions": "node scripts/download.js"
},
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# deploy.sh
#!/usr/bin/env sh
###
# @author: samy
# @email: yessz#foxmail.com
# @time: 2022-08-24 14:29:38
# @modAuthor: samy
# @modTime: 2022-08-24 19:26:48
# @desc:
# Copyright © 2015~2022 BDP FE
###
set -e
cd yarn
npm config set registry https://registry.npm.taobao.org
#npm install -g node-gyp
npm i
cd ..
./yarn/node_modules/.bin/yarn config set registry http://registry.npm.taobao.org/
./yarn/node_modules/.bin/yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/
./yarn/node_modules/.bin/yarn
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "38i\\"$'\n''"./src/***/*",' tsconfig.json
sed -i "" "38i\\"$'\n''"./modules/***/*",' tsconfig.json
else
sed -i "" "38i\\"$'\n''"./src/***/*",' tsconfig.json
sed -i "" "38i\\"$'\n''"./modules/***/*",' tsconfig.json
fi
./yarn/node_modules/.bin/yarn run build
./yarn/node_modules/.bin/yarn run download:extensions
cp -rf dist dist-node hosted deploy/
if [[ "$OSTYPE" != "darwin"* ]]; then
mkdir -p /root/.sumi/extensions
cp -rf extensions /root/.sumi/extensions
fi
cd deploy
tar zcvf bdp-ide.tar.gz --exclude=node_modules --exclude=tmp ./
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# getDeploy.sh
#!/bin/sh
sleep 1
ftp -niv <<!
open 10.45.xx.8
user xx xxx
binary
cd /var/lib/jenkins/workspace/bdp-ide-dev
lcd /home/xxx/portal/bdp-ide
prompt
get deploy.tar.gz
close
bye
!
sleep 2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
# unpackGz.sh
支持离线
切换到子账户,处理文件相关权限;chown xxx:xxx node_modules.tar.gz extensions.tar.gz
#!/bin/sh
#之前压缩备份数据
#tar zcvf ../node_modules.tar.gz node_modules
#tar zcvf ../extensions.tar.gz extensions
#rm -rf deploy/
mv -f deploy/ deploy-bak/
tar zxvf deploy.tar.gz
tar zxvf node_modules.tar.gz -C deploy/
tar zxvf extensions.tar.gz -C deploy/
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
# install.sh
#!/bin/sh
###
# @author: samy
# @email: yessz#foxmail.com
# @time: 2022-08-24 14:28:35
# @modAuthor: samy
# @modTime: 2022-08-24 19:44:42
# @desc:
# Copyright © 2015~2022 BDP FE
###
# 前置环境依赖软件;
#安装node14.20
#设置淘宝源
#安装pm2 npm i -g pm2
#npm config set registry https://registry.npm.taobao.org -g
#npm config set electron_mirror https://npm.taobao.org/mirrors/electron -g
curDir=$(
cd "$(dirname "$0")"
pwd
)
isFirst=false
if [ $1 ]; then
isFirst=$1
fi
if [ $isFirst == true ]; then
npm i
#这部分要root sudo权限处理,后面修改源码后,不用root处理
npm run download:extensions
#cp -rf extensions /root/.sumi/extensions
mkdir -p ~/.sumi/extensions && cp -rf extensions ~/.sumi/extensions
fi
sh start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# start.sh
#!/usr/bin/env sh
###
# @author: samy
# @email: yessz#foxmail.com
# @time: 2022-08-24 14:28:35
# @modAuthor: samy
# @modTime: 2022-08-24 18:22:47
# @desc:
# Copyright © 2015~2022 BDP FE
###
pm2 startOrRestart pm2.json
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# pm2.json
性能配置,设置内存大小处理;
{
"apps" : [{
"name": "bdp-ide",
"script": "dist-node/server/index.js",
"env": {
"EXT_MODE": "js",
"NODE_ENV": "production",
"IDE_SERVER_PORT": 8787,
//"EXTENSION_DIR": "/root/.sumi/extensions"
},
"log_date_format": "YYYY-MM-DD_HH:mm Z",
"merge_logs": true,
"max_restarts" : 3,
"max_memory_restart": "4096M",
"node-args": [
"--max_old_space_size=5120"
]
}]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 启动的package.json
{
"name": "bdp-ide",
"version": "0.1.0",
"main": "index.js",
"scripts": {
"download:extensions": "node scripts/download.js"
},
"dependencies": {
"nsfw": "1.2.7",
"node-pty": "0.9.0",
"spdlog": "0.9.0",
"@opensumi/vscode-ripgrep": "1.4.0",
"keytar": "^7.7.0"
},
"devDependencies": {
"yarn": "^1.22.19",
"rimraf": "^3.0.2",
"mkdirp": "^1.0.4",
"fs-extra": "^10.0.0",
"yauzl": "^2.10.0",
"got": "^11.8.5",
"urllib": "^2.38.0",
"await-event": "^2.1.0",
"uuid": "^8.3.2"
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 门户/ide多服务器部署
主要是转发那一块,要代理设置;
# 子账户下 ngx安装
./configure \
--prefix=/home/xxx/nginx \
--pid-path=/home/xxx/nginx/logs/nginx.pid \
--lock-path=/home/xxx/nginx/logs/nginx.lock \
--error-log-path=/home/xxx/nginx/logs/error.log \
--http-log-path=/home/xxx/nginx/logs/access.log
make && make install
[xxx@host165 nginx]$ ./sbin/nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
vi conf/nginx.conf
#以下常用命令
./sbin/nginx -t
./sbin/nginx -s reload
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# ide部分
165环境下 子账户目录下;先在root中把全局的nginx先停掉;其实也不影响,换端口就可以;
配置
/ide/路径的特殊处理:主要跟之前打包webpack有关;
const base = process.env.BASE||'/';
const ROUTER_BASE =
base.lastIndexOf('/') === base.length - 1 ? base : `${base}/`;
const define = {
ROUTER_BASE: JSON.stringify(`${ROUTER_BASE}`),
};
const isDevelopment =
process.env['NODE_ENV'] === 'development' ||
process.env['NODE_ENV'] === 'dev';
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
ngx配置:
server {
listen 8559;
server_name localhost;
large_client_header_buffers 4 16k; #header大小
client_max_body_size 300m; #上传文件大小限制
client_body_buffer_size 128k; #缓冲区大小
proxy_connect_timeout 600; #设置与upstream server的连接超时时间
proxy_read_timeout 600; #设置与代理服务器的读超时时间
proxy_send_timeout 600; #发送请求给upstream服务器的超时时间
underscores_in_headers on; #header允许使用带'_'的参数
#接口代理部分
location /ide/aiFactoryServer {
proxy_pass http://xxxx.165:9005/aiFactoryServer;
proxy_set_header Host $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;
}
location /ide/datadev {
proxy_pass http://xxxx.165:9985/datadev;
proxy_set_header Host $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;
}
#自己部分【这个有图片资源特殊,要加后缀匹配】
location /ide/ {
proxy_pass http://127.0.0.1:8787/ide/;
proxy_set_header Host $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;
}
location /ide/service {
proxy_pass http://127.0.0.1:8787/service;
proxy_set_header Host $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_set_header X-Real_IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
}
location /ide/assets {
proxy_pass http://127.0.0.1:8787/assets;
proxy_set_header Host $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;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 门户部分
67环境下
server {
listen 8559;
server_name localhost;
large_client_header_buffers 4 16k; #header大小
client_max_body_size 300m; #上传文件大小限制
client_body_buffer_size 128k; #缓冲区大小
proxy_connect_timeout 600; #设置与upstream server的连接超时时间
proxy_read_timeout 600; #设置与代理服务器的读超时时间
proxy_send_timeout 600; #发送请求给upstream服务器的超时时间
underscores_in_headers on; #header允许使用带'_'的参数
#自己部分[不同之处]
location /ide/ {
proxy_pass http://172.xxx.xxx.165:8559/ide/;
proxy_set_header Host $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;
}
location /ide/service {
proxy_pass http://172.xxx.xxx.165:8559/service;
proxy_set_header Host $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_set_header X-Real_IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 容器版本部署
Dockerfile
参考官方配置 (opens new window)
FROM node:14 as builder
# 用户工作空间,用于打包到前端工作空间地址
ENV WORKSPACE_DIR workspace
ENV EXTENSION_DIR extensions
COPY . .
ENV ELECTRON_MIRROR http://npm.taobao.org/mirrors/electron/
RUN mkdir -p ${WORKSPACE_DIR} &&\
mkdir -p ${EXTENSION_DIR}
RUN yarn --ignore-scripts --network-timeout 1000000&& \
yarn run build && \
yarn run download:extensions && \
rm -rf ./node_modules
FROM node:14 as app
ENV WORKSPACE_DIR /workspace
ENV EXTENSION_DIR /root/.sumi/extensions
ENV EXT_MODE js
ENV NODE_ENV production
RUN mkdir -p ${WORKSPACE_DIR} &&\
mkdir -p ${EXTENSION_DIR}
WORKDIR /release
COPY ./configs/docker/productionDependencies.json package.json
RUN yarn --network-timeout 1000000
COPY --from=builder dist dist
COPY --from=builder dist-node dist-node
COPY --from=builder hosted hosted
COPY --from=builder extensions /root/.sumi/extensions
EXPOSE 8000
CMD [ "node", "./dist-node/server/index.js" ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 参考链接
- https://opensumi.com/zh/docs/develop/how-to-contribute
- https://github.com/nodejs/node-gyp#installation
- https://github.com/atom/node-keytar#on-linux
上次更新: 2023/11/17, 05:08:19