Update install.sh
This commit is contained in:
56
install.sh
56
install.sh
@@ -150,6 +150,62 @@ if [ -z "$ORCH_ADDR" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Normalize orchestrator address
|
||||||
|
# -----------------------------
|
||||||
|
|
||||||
|
normalize_orch_addr() {
|
||||||
|
local input="$1"
|
||||||
|
local scheme=""
|
||||||
|
local rest=""
|
||||||
|
local hostport=""
|
||||||
|
local path=""
|
||||||
|
|
||||||
|
# Extract scheme if present
|
||||||
|
if [[ "$input" =~ ^(https?://)(.*)$ ]]; then
|
||||||
|
scheme="${BASH_REMATCH[1]}"
|
||||||
|
rest="${BASH_REMATCH[2]}"
|
||||||
|
else
|
||||||
|
rest="$input"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split host[:port] and path
|
||||||
|
if [[ "$rest" =~ ^([^/]+)(/.*)?$ ]]; then
|
||||||
|
hostport="${BASH_REMATCH[1]}"
|
||||||
|
path="${BASH_REMATCH[2]:-}"
|
||||||
|
else
|
||||||
|
hostport="$rest"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split host and port
|
||||||
|
local host="$hostport"
|
||||||
|
local port=""
|
||||||
|
|
||||||
|
if [[ "$hostport" =~ ^(.+):([0-9]+)$ ]]; then
|
||||||
|
host="${BASH_REMATCH[1]}"
|
||||||
|
port="${BASH_REMATCH[2]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Strip -krkn suffix from the hostname label only
|
||||||
|
# e.g. krkn-krkn.example.com -> krkn.example.com
|
||||||
|
# The conductor servers on the primary host at port 65535
|
||||||
|
# The -krkn is for the krkns service not the orechstra conductor
|
||||||
|
# foo-krkn -> foo
|
||||||
|
host="$(echo "$host" | sed -E 's/-krkn(\.|$)/\1/')"
|
||||||
|
|
||||||
|
# If no port, add default
|
||||||
|
if [ -z "$port" ]; then
|
||||||
|
port="65535"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${scheme}${host}:${port}${path}"
|
||||||
|
}
|
||||||
|
|
||||||
|
ORCH_ADDR="$(normalize_orch_addr "$ORCH_ADDR")"
|
||||||
|
|
||||||
|
log "Normalized orchestrator address: ${ORCH_ADDR}"
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_WORKER_ID="$(hostname)"
|
DEFAULT_WORKER_ID="$(hostname)"
|
||||||
read -rp "Worker ID [${DEFAULT_WORKER_ID}]: " WORKER_ID < /dev/tty
|
read -rp "Worker ID [${DEFAULT_WORKER_ID}]: " WORKER_ID < /dev/tty
|
||||||
WORKER_ID="${WORKER_ID:-$DEFAULT_WORKER_ID}"
|
WORKER_ID="${WORKER_ID:-$DEFAULT_WORKER_ID}"
|
||||||
|
|||||||
Reference in New Issue
Block a user