fix remote ubuntu server
This commit is contained in:
@@ -1422,7 +1422,9 @@ app.get('/install-agent.sh', (req, res) => {
|
||||
baseUrl,
|
||||
...publicApiCorsOrigins.filter((origin) => origin !== '*'),
|
||||
'http://localhost:3000',
|
||||
'http://127.0.0.1:3000'
|
||||
'http://127.0.0.1:3000',
|
||||
'http://localhost:8080',
|
||||
'http://127.0.0.1:8080'
|
||||
])).join(',');
|
||||
res.type('text/x-shellscript').send(`#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
@@ -1434,6 +1436,8 @@ AGENT_ENV="/etc/local-installer-agent/agent.env"
|
||||
PACKAGE_HOST="$(printf '%s' "$PACKAGE_BASE_URL" | sed -E 's#^[a-zA-Z][a-zA-Z0-9+.-]*://([^/:]+).*$#\\1#')"
|
||||
PACKAGE_REGISTRY="$(printf '%s' "$PACKAGE_BASE_URL" | sed -E 's#^[a-zA-Z][a-zA-Z0-9+.-]*://([^/]+).*$#\\1#')"
|
||||
TMP_DEB="/tmp/local-installer-agent.deb"
|
||||
AGENT_BIND_HOST="\${AGENT_HOST:-0.0.0.0}"
|
||||
AGENT_BIND_PORT="\${AGENT_PORT:-5010}"
|
||||
|
||||
set_agent_env() {
|
||||
KEY="$1"
|
||||
@@ -1455,6 +1459,8 @@ apt install -y "$TMP_DEB"
|
||||
echo "Configuring Local Installer Agent..."
|
||||
mkdir -p /etc/local-installer-agent
|
||||
touch "$AGENT_ENV"
|
||||
set_agent_env AGENT_HOST "$AGENT_BIND_HOST"
|
||||
set_agent_env AGENT_PORT "$AGENT_BIND_PORT"
|
||||
set_agent_env ROBOT_PACKAGE_BASE_URL "$PACKAGE_BASE_URL"
|
||||
set_agent_env ALLOWED_ORIGINS "${escapeShellDoubleQuoted(agentAllowedOrigins)}"
|
||||
set_agent_env ALLOWED_DOWNLOAD_HOSTS "$PACKAGE_HOST,localhost,127.0.0.1"
|
||||
@@ -1468,7 +1474,7 @@ systemctl restart local-installer-agent
|
||||
|
||||
echo "Checking Agent..."
|
||||
for attempt in $(seq 1 20); do
|
||||
if curl -fsSL http://127.0.0.1:5010/health; then
|
||||
if curl -fsSL "http://127.0.0.1:$AGENT_BIND_PORT/health"; then
|
||||
echo ""
|
||||
echo "Local Installer Agent installed successfully."
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user