Fixing Wget/Curl Command Installer Port
This commit is contained in:
parent
456ac1761b
commit
4d62549a55
|
|
@ -50,6 +50,12 @@ Listen to UDP 10101 for beacon messages broadcast by your SDL Manager.
|
||||||
nc -u -l -k 10101 |jq
|
nc -u -l -k 10101 |jq
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Or to get the install command from the beacon message:
|
||||||
|
|
||||||
|
```
|
||||||
|
nc -u -l -k 10101 | jq -r '.msg.sdl_wkr_install_cmd[]'
|
||||||
|
```
|
||||||
|
|
||||||
> NOTE: CTRL-C to exit `nc`. You cannot run `nc` on port 10101 in parallel with the sdl-wkr. So run it once to get the install command. Tnen install sdl-wkr.
|
> NOTE: CTRL-C to exit `nc`. You cannot run `nc` on port 10101 in parallel with the sdl-wkr. So run it once to get the install command. Tnen install sdl-wkr.
|
||||||
|
|
||||||
Run the **curl** or **wget** command provided by SDL Manager UDP beacon to install SDL Worker locally.
|
Run the **curl** or **wget** command provided by SDL Manager UDP beacon to install SDL Worker locally.
|
||||||
|
|
|
||||||
|
|
@ -352,6 +352,7 @@ function publishStatus(client, topic) {
|
||||||
//get ip addr
|
//get ip addr
|
||||||
const interfaces = os.networkInterfaces();
|
const interfaces = os.networkInterfaces();
|
||||||
let ip_addr = null;
|
let ip_addr = null;
|
||||||
|
let web_port = config.modules.web.port;
|
||||||
|
|
||||||
for (const [iface, addrs] of Object.entries(interfaces)) {
|
for (const [iface, addrs] of Object.entries(interfaces)) {
|
||||||
for (const addr of addrs) {
|
for (const addr of addrs) {
|
||||||
|
|
@ -385,7 +386,7 @@ function publishStatus(client, topic) {
|
||||||
sdl: {
|
sdl: {
|
||||||
version: config.package.version,
|
version: config.package.version,
|
||||||
uptime: getUptimeDHMS(),
|
uptime: getUptimeDHMS(),
|
||||||
update_cmd: `curl -s http://${ip_addr}:${config.modules.web.port}/dist/install-sdl-wkr.sh | bash -s ${ip_addr}`
|
update_cmd: `curl -s http://${ip_addr}:${config.modules.web.port}/dist/install-sdl-wkr.sh | bash -s ${ip_addr}:${web_port}`,
|
||||||
},
|
},
|
||||||
cluster: config.cluster,
|
cluster: config.cluster,
|
||||||
resources: updatedState.meta.stats.resources, // ✅ Add cluster resources
|
resources: updatedState.meta.stats.resources, // ✅ Add cluster resources
|
||||||
|
|
@ -591,8 +592,8 @@ function startUdpBeacon() {
|
||||||
web_ui_url: `http://${addr.address}:${config.modules.web.port}`,
|
web_ui_url: `http://${addr.address}:${config.modules.web.port}`,
|
||||||
},
|
},
|
||||||
sdl_wkr_install_cmd: {
|
sdl_wkr_install_cmd: {
|
||||||
curl: `curl -s http://${addr.address}:${config.modules.web.port}/dist/install-sdl-wkr.sh | bash -s ${addr.address}`,
|
curl: `curl -s http://${addr.address}:${config.modules.web.port}/dist/install-sdl-wkr.sh | bash -s ${addr.address}:${config.modules.web.port}`,
|
||||||
wget: `wget -O - http://${addr.address}:${config.modules.web.port}/dist/install-sdl-wkr.sh | bash -s ${addr.address}`
|
wget: `wget -O - http://${addr.address}:${config.modules.web.port}/dist/install-sdl-wkr.sh | bash -s ${addr.address}:${config.modules.web.port}`,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# install-sdl-wkr.sh - Script to install SDL Worker
|
# install-sdl-wkr.sh - Script to install SDL Worker
|
||||||
# Usage: curl -s http://<SDL_MGR_IP>:8081/dist/install-sdl-wkr.sh | bash -s <SDL_MGR_IP>
|
# Usage: curl -s http://<SDL_MGR_IP>:<SDL_MGR_PORT>/dist/install-sdl-wkr.sh | bash -s <SDL_MGR_IP>:<SDL_MGR_PORT>
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
@ -79,11 +79,11 @@ install_nodejs() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
NODE_VER=$(curl -s http://${SDL_MGR_IP}:8081/api/config | jq -r '.nodejs.version')
|
NODE_VER=$(curl -s http://${SDL_MGR_IP}:${SDL_MGR_PORT}/api/config | jq -r '.nodejs.version')
|
||||||
NODE_DIR="${SDL_HOME}/nodejs"
|
NODE_DIR="${SDL_HOME}/nodejs"
|
||||||
NODE_VER_BASE="node-${NODE_VER}-${OS_PLATFORM}-${OS_ARCH}"
|
NODE_VER_BASE="node-${NODE_VER}-${OS_PLATFORM}-${OS_ARCH}"
|
||||||
NODE_FILE="node-${NODE_VER}-${OS_PLATFORM}-${OS_ARCH}.${EXT}"
|
NODE_FILE="node-${NODE_VER}-${OS_PLATFORM}-${OS_ARCH}.${EXT}"
|
||||||
NODE_URL="http://${SDL_MGR_IP}:8081/dist/${NODE_FILE}"
|
NODE_URL="http://${SDL_MGR_IP}:${SDL_MGR_PORT}/dist/${NODE_FILE}"
|
||||||
|
|
||||||
|
|
||||||
#echo "NodeJS Version: ${NODE_VER}"
|
#echo "NodeJS Version: ${NODE_VER}"
|
||||||
|
|
@ -138,16 +138,18 @@ if [ -z "$1" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SDL_MGR_IP=$1
|
ARG1=$1 # SDL_MGR_IP:PORT
|
||||||
|
SDL_MGR_IP=$(echo "$ARG1" | cut -d ':' -f 1)
|
||||||
|
SDL_MGR_PORT=$(echo "$ARG1" | cut -d ':' -f 2)
|
||||||
|
|
||||||
# SDL_HOME=$(curl -s http://${SDL_MGR_IP}:8081/api/config | jq -r '.dirs.sdlhome')
|
# SDL_HOME=$(curl -s http://${SDL_MGR_IP}:${SDL_MGR_PORT}/api/config | jq -r '.dirs.sdlhome')
|
||||||
SDL_HOME=$HOME/.sdl
|
SDL_HOME=$HOME/.sdl
|
||||||
|
|
||||||
|
|
||||||
SDL_VER=$(curl -s http://${SDL_MGR_IP}:8081/api/config | jq -r '.package.version')
|
SDL_VER=$(curl -s http://${SDL_MGR_IP}:${SDL_MGR_PORT}/api/config | jq -r '.package.version')
|
||||||
SDL_DESC=$(curl -s http://${SDL_MGR_IP}:8081/api/config | jq -r '.package.description')
|
SDL_DESC=$(curl -s http://${SDL_MGR_IP}:${SDL_MGR_PORT}/api/config | jq -r '.package.description')
|
||||||
# SDL_ABBR=$(curl -s http://${SDL_MGR_IP}:8081/api/config | jq -r '.package.abbr')
|
# SDL_ABBR=$(curl -s http://${SDL_MGR_IP}:${SDL_MGR_PORT}/api/config | jq -r '.package.abbr')
|
||||||
SDL_COPYRT=$(curl -s http://${SDL_MGR_IP}:8081/api/config | jq -r '.package.copyright')
|
SDL_COPYRT=$(curl -s http://${SDL_MGR_IP}:${SDL_MGR_PORT}/api/config | jq -r '.package.copyright')
|
||||||
|
|
||||||
echo "###############################################"
|
echo "###############################################"
|
||||||
# echo "${SDL_DESC} (${SDL_ABBR})"
|
# echo "${SDL_DESC} (${SDL_ABBR})"
|
||||||
|
|
@ -160,7 +162,7 @@ echo ""
|
||||||
|
|
||||||
TMP_DIR="${SDL_HOME}/tmp"
|
TMP_DIR="${SDL_HOME}/tmp"
|
||||||
SDL_WKR_DIR="${SDL_HOME}/sdl-wkr"
|
SDL_WKR_DIR="${SDL_HOME}/sdl-wkr"
|
||||||
SDL_WKR_VERSION=$(curl -s http://${SDL_MGR_IP}:8081/api/config | jq -r '.package.version')
|
SDL_WKR_VERSION=$(curl -s http://${SDL_MGR_IP}:${SDL_MGR_PORT}/api/config | jq -r '.package.version')
|
||||||
SDL_WKR_TGZ="sdl-wkr_${SDL_WKR_VERSION}.tgz"
|
SDL_WKR_TGZ="sdl-wkr_${SDL_WKR_VERSION}.tgz"
|
||||||
SDL_CONF_DIR="${SDL_HOME}/conf"
|
SDL_CONF_DIR="${SDL_HOME}/conf"
|
||||||
SLD_LOGS_DIR="${SDL_HOME}/logs"
|
SLD_LOGS_DIR="${SDL_HOME}/logs"
|
||||||
|
|
@ -177,8 +179,8 @@ mkdir -p "${TMP_DIR}"
|
||||||
|
|
||||||
|
|
||||||
# Download the latest sdl-wkr version to TMP_DIR
|
# Download the latest sdl-wkr version to TMP_DIR
|
||||||
WKR_TGZ_URL="http://${SDL_MGR_IP}:8081/dist/${SDL_WKR_TGZ}"
|
WKR_TGZ_URL="http://${SDL_MGR_IP}:${SDL_MGR_PORT}/dist/${SDL_WKR_TGZ}"
|
||||||
WKR_TGZ_SHA256_URL="http://${SDL_MGR_IP}:8081/dist/${SDL_WKR_TGZ}.sha256"
|
WKR_TGZ_SHA256_URL="http://${SDL_MGR_IP}:${SDL_MGR_PORT}/dist/${SDL_WKR_TGZ}.sha256"
|
||||||
|
|
||||||
curl -sSL --fail "${WKR_TGZ_URL}" -o "${TMP_DIR}/${SDL_WKR_TGZ}" || { echo "Failed to download sdl-wkr"; exit 1; }
|
curl -sSL --fail "${WKR_TGZ_URL}" -o "${TMP_DIR}/${SDL_WKR_TGZ}" || { echo "Failed to download sdl-wkr"; exit 1; }
|
||||||
curl -sSL --fail "${WKR_TGZ_SHA256_URL}" -o "${TMP_DIR}/${SDL_WKR_TGZ}.sha256" || { echo "Failed to download sdl-wkr SHA256"; exit 1; }
|
curl -sSL --fail "${WKR_TGZ_SHA256_URL}" -o "${TMP_DIR}/${SDL_WKR_TGZ}.sha256" || { echo "Failed to download sdl-wkr SHA256"; exit 1; }
|
||||||
|
|
@ -214,7 +216,7 @@ cp "$SDL_WKR_DIR/current/scripts/sdl-wkr.service" ~/.config/systemd/user/
|
||||||
|
|
||||||
|
|
||||||
# Install Node.js idempotently
|
# Install Node.js idempotently
|
||||||
NODE_VER=$(curl -s http://${SDL_MGR_IP}:8081/api/config | jq -r '.nodejs.version')
|
NODE_VER=$(curl -s http://${SDL_MGR_IP}:${SDL_MGR_PORT}/api/config | jq -r '.nodejs.version')
|
||||||
NODE_DIR="${SDL_HOME}/nodejs"
|
NODE_DIR="${SDL_HOME}/nodejs"
|
||||||
NODE_BIN="${NODE_DIR}/current/bin/node"
|
NODE_BIN="${NODE_DIR}/current/bin/node"
|
||||||
NPM_BIN="${NODE_DIR}/current/bin/npm"
|
NPM_BIN="${NODE_DIR}/current/bin/npm"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue