Upload 3 files
Browse files- apps.conf +68 -0
- nginx.conf +45 -0
- start_server.sh +57 -0
apps.conf
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
upstream codeServer {
|
2 |
+
server 0.0.0.0:7860;
|
3 |
+
}
|
4 |
+
|
5 |
+
|
6 |
+
upstream n8nServer {
|
7 |
+
server 0.0.0.0:5678;
|
8 |
+
}
|
9 |
+
|
10 |
+
|
11 |
+
map $http_upgrade $connection_upgrade {
|
12 |
+
default keep-alive;
|
13 |
+
'websocket' upgrade;
|
14 |
+
}
|
15 |
+
|
16 |
+
server {
|
17 |
+
listen 5700;
|
18 |
+
listen [::]:5700;
|
19 |
+
ssl_session_timeout 5m;
|
20 |
+
|
21 |
+
location / {
|
22 |
+
proxy_pass http://n8nServer/;
|
23 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
24 |
+
proxy_set_header Host $http_host;
|
25 |
+
proxy_set_header X-NginX-Proxy true;
|
26 |
+
proxy_http_version 1.1;
|
27 |
+
proxy_set_header Upgrade $http_upgrade;
|
28 |
+
proxy_set_header Connection "upgrade";
|
29 |
+
proxy_set_header X-Real-IP $remote_addr;
|
30 |
+
proxy_buffering off;
|
31 |
+
proxy_redirect default;
|
32 |
+
proxy_connect_timeout 1800;
|
33 |
+
proxy_send_timeout 1800;
|
34 |
+
proxy_read_timeout 1800;
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
location /coder/ {
|
39 |
+
proxy_pass http://codeServer/;
|
40 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
41 |
+
proxy_set_header Host $http_host;
|
42 |
+
proxy_set_header X-NginX-Proxy true;
|
43 |
+
proxy_http_version 1.1;
|
44 |
+
proxy_set_header Upgrade $http_upgrade;
|
45 |
+
proxy_set_header Connection "upgrade";
|
46 |
+
proxy_set_header X-Real-IP $remote_addr;
|
47 |
+
proxy_buffering off;
|
48 |
+
proxy_redirect default;
|
49 |
+
proxy_connect_timeout 1800;
|
50 |
+
proxy_send_timeout 1800;
|
51 |
+
proxy_read_timeout 1800;
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
gzip on;
|
56 |
+
gzip_static on;
|
57 |
+
gzip_types text/plain application/json application/javascript application/x-javascript text/css application/xml text/javascript;
|
58 |
+
gzip_proxied any;
|
59 |
+
gzip_vary on;
|
60 |
+
gzip_comp_level 6;
|
61 |
+
gzip_buffers 16 8k;
|
62 |
+
gzip_http_version 1.0;
|
63 |
+
|
64 |
+
|
65 |
+
location ~ .*\.(html)$ {
|
66 |
+
add_header Cache-Control no-cache;
|
67 |
+
}
|
68 |
+
}
|
nginx.conf
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
user root;
|
2 |
+
worker_processes auto;
|
3 |
+
pcre_jit on;
|
4 |
+
error_log /var/log/nginx/error.log warn;
|
5 |
+
include /etc/nginx/modules/*.conf;
|
6 |
+
|
7 |
+
events {
|
8 |
+
worker_connections 1024;
|
9 |
+
}
|
10 |
+
|
11 |
+
http {
|
12 |
+
include /etc/nginx/mime.types;
|
13 |
+
default_type application/octet-stream;
|
14 |
+
|
15 |
+
server_tokens off;
|
16 |
+
|
17 |
+
client_max_body_size 4096m;
|
18 |
+
client_body_buffer_size 20m;
|
19 |
+
|
20 |
+
keepalive_timeout 65;
|
21 |
+
|
22 |
+
sendfile on;
|
23 |
+
|
24 |
+
tcp_nodelay on;
|
25 |
+
|
26 |
+
ssl_prefer_server_ciphers on;
|
27 |
+
|
28 |
+
ssl_session_cache shared:SSL:2m;
|
29 |
+
|
30 |
+
gzip on;
|
31 |
+
gzip_static on;
|
32 |
+
gzip_types text/plain application/json application/javascript application/x-javascript text/css application/xml text/javascript;
|
33 |
+
gzip_proxied any;
|
34 |
+
gzip_vary on;
|
35 |
+
gzip_comp_level 6;
|
36 |
+
gzip_buffers 16 8k;
|
37 |
+
gzip_http_version 1.0;
|
38 |
+
|
39 |
+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
40 |
+
'$status $body_bytes_sent "$http_referer" '
|
41 |
+
'"$http_user_agent" "$http_x_forwarded_for"';
|
42 |
+
|
43 |
+
access_log /var/log/nginx/access.log main;
|
44 |
+
include /etc/nginx/conf.d/*.conf;
|
45 |
+
}
|
start_server.sh
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
echo -e "======================写入rclone配置========================\n"
|
4 |
+
echo "$RCLONE_CONF" > ~/.config/rclone/rclone.conf
|
5 |
+
|
6 |
+
if [ -n "$RCLONE_CONF" ]; then
|
7 |
+
echo -e "##########恢复n8n备份############"
|
8 |
+
# 指定远程文件夹路径,格式为 remote:path
|
9 |
+
REMOTE_FOLDER="huggingface:/n8n"
|
10 |
+
|
11 |
+
# 使用 rclone ls 命令列出文件夹内容,将输出和错误分别捕获
|
12 |
+
OUTPUT=$(rclone ls "$REMOTE_FOLDER" 2>&1)
|
13 |
+
|
14 |
+
# 获取 rclone 命令的退出状态码
|
15 |
+
EXIT_CODE=$?
|
16 |
+
|
17 |
+
# 判断退出状态码
|
18 |
+
if [ $EXIT_CODE -eq 0 ]; then
|
19 |
+
# rclone 命令成功执行,检查文件夹是否为空
|
20 |
+
if [ -z "$OUTPUT" ]; then
|
21 |
+
#为空不处理
|
22 |
+
#rclone sync --interactive /ql $REMOTE_FOLDER
|
23 |
+
echo "初次安装"
|
24 |
+
else
|
25 |
+
#echo "文件夹不为空"
|
26 |
+
rclone sync $REMOTE_FOLDER /home/coder/.n8n
|
27 |
+
fi
|
28 |
+
elif [[ "$OUTPUT" == *"directory not found"* ]]; then
|
29 |
+
echo "错误:文件夹不存在"
|
30 |
+
else
|
31 |
+
echo "错误:$OUTPUT"
|
32 |
+
fi
|
33 |
+
else
|
34 |
+
echo "没有检测到Rclone配置信息"
|
35 |
+
fi
|
36 |
+
|
37 |
+
mkdir /etc/nginx/conf.d
|
38 |
+
mkdir /run/nginx
|
39 |
+
cp -fv /home/coder/apps.conf /etc/nginx/conf.d
|
40 |
+
cp -fv /home/coder/nginx.conf /etc/nginx/nginx.conf
|
41 |
+
|
42 |
+
echo -e "======================启动nginx========================\n"
|
43 |
+
nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf
|
44 |
+
echo -e "nginx启动成功...\n"
|
45 |
+
|
46 |
+
echo -e "======================启动pm2服务========================\n"
|
47 |
+
pm2 start n8n
|
48 |
+
pm2 startup
|
49 |
+
pm2 save
|
50 |
+
|
51 |
+
export PASSWORD=$ADMIN_PASSWORD
|
52 |
+
code-server --bind-addr 0.0.0.0:7860 --port 7860
|
53 |
+
|
54 |
+
tail -f /dev/null
|
55 |
+
|
56 |
+
exec "$@"
|
57 |
+
|