-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
92 lines (72 loc) · 2.15 KB
/
start.sh
File metadata and controls
92 lines (72 loc) · 2.15 KB
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
#!/bin/bash
set -e
mkdir -p ~/.openclaw
cp openclaw.json ~/.openclaw/openclaw.json
cat > /etc/nginx/nginx.conf <<EOF
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
map \$http_upgrade \$connection_upgrade {
default upgrade;
'' close;
}
map "\$http_upgrade\$arg_token" \$should_redirect {
default 0;
"" 1;
}
server {
listen 8686;
server_name _;
location = / {
if (\$should_redirect = 1) {
return 302 \$scheme://\$http_host/?token=${ACCESS_TOKEN};
}
proxy_pass http://127.0.0.1:18789/;
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_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection \$connection_upgrade;
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 86400;
proxy_connect_timeout 86400;
}
location / {
proxy_pass http://127.0.0.1:18789/;
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_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection \$connection_upgrade;
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 86400;
proxy_connect_timeout 86400;
}
}
}
EOF
nginx
openclaw gateway --allow-unconfigured \
> openclaw.log 2>&1 &
PID=$!
echo "[openclaw] started, pid=$PID"
for i in {1..120}; do
if curl -sf http://127.0.0.1:18789 >/dev/null; then
echo "[openclaw] service is up"
exit 0
fi
sleep 1
done
echo "[openclaw] startup timeout, last 50 lines of log:"
tail -50 openclaw.log
exit 1