feat: expose boss via nginx base path
This commit is contained in:
@@ -45,11 +45,40 @@ if [[ "\$DEPLOY_MODE" != "node" ]]; then
|
||||
fi
|
||||
|
||||
if [[ "\$docker_ok" -eq 1 ]]; then
|
||||
sudo python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
path = Path("/etc/nginx/sites-enabled/hybrid_updates.conf")
|
||||
text = path.read_text()
|
||||
if "location /boss/" not in text:
|
||||
block = """
|
||||
location = /boss {
|
||||
return 302 /boss/;
|
||||
}
|
||||
|
||||
location /boss/ {
|
||||
proxy_pass http://127.0.0.1:43210;
|
||||
proxy_http_version 1.1;
|
||||
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_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_buffering off;
|
||||
}
|
||||
|
||||
"""
|
||||
marker = " location / {\n"
|
||||
text = text.replace(marker, block + marker, 1)
|
||||
path.write_text(text)
|
||||
PY
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
echo "__BOSS_DEPLOY_OK__"
|
||||
echo "mode=docker"
|
||||
sudo docker compose -f compose.cloud.yaml -p boss ps
|
||||
sleep 3
|
||||
curl -fsS http://127.0.0.1:43210/api/health
|
||||
curl -fsS http://127.0.0.1:43210/boss/api/health
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -60,10 +89,39 @@ fi
|
||||
|
||||
npm install
|
||||
npm run build
|
||||
PORT=43210 BOSS_DATA_FILE=.boss-data/cloud-store.json ./scripts/server_start.sh
|
||||
PORT=43210 BOSS_DATA_FILE=.boss-data/cloud-store.json BOSS_BASE_PATH=/boss ./scripts/server_start.sh
|
||||
sudo python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
path = Path("/etc/nginx/sites-enabled/hybrid_updates.conf")
|
||||
text = path.read_text()
|
||||
if "location /boss/" not in text:
|
||||
block = """
|
||||
location = /boss {
|
||||
return 302 /boss/;
|
||||
}
|
||||
|
||||
location /boss/ {
|
||||
proxy_pass http://127.0.0.1:43210;
|
||||
proxy_http_version 1.1;
|
||||
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_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_buffering off;
|
||||
}
|
||||
|
||||
"""
|
||||
marker = " location / {\n"
|
||||
text = text.replace(marker, block + marker, 1)
|
||||
path.write_text(text)
|
||||
PY
|
||||
sudo nginx -t
|
||||
sudo systemctl reload nginx
|
||||
echo "__BOSS_DEPLOY_OK__"
|
||||
echo "mode=node"
|
||||
./scripts/server_status.sh
|
||||
BOSS_BASE_PATH=/boss ./scripts/server_status.sh
|
||||
EOF
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user