feat: cloud region selection in native script, rename deploy script

- wallarm-native.sh: added cloud region (US/EU) selection step during
  --install. Preflight now saves reachability to US_CLOUD_REACHABLE/
  EU_CLOUD_REACHABLE globals, select_cloud_region() prompts user,
  API_HOST passed through to env file and installer.
- wallarm-ct-deploy.sh renamed to wallarm-docker.sh (reflects Docker
  binary usage, leaves room for podman variant).
- setup.sh: updated next-steps reference for renamed script.
This commit is contained in:
admin 2026-08-01 08:58:50 +00:00
parent 0ee73f5af3
commit 62ddaaa9c5
3 changed files with 20 additions and 5 deletions

View file

@ -44,6 +44,12 @@ INSTALLER_URL="${WALLARM_INSTALLER_URL:-${INSTALLER_BASE_URL}/wallarm-native-nod
EU_DATA_NODES=("api.wallarm.com" "node-data0.eu1.wallarm.com" "node-data1.eu1.wallarm.com") EU_DATA_NODES=("api.wallarm.com" "node-data0.eu1.wallarm.com" "node-data1.eu1.wallarm.com")
US_DATA_NODES=("us1.api.wallarm.com" "node-data0.us1.wallarm.com" "node-data1.us1.wallarm.com") US_DATA_NODES=("us1.api.wallarm.com" "node-data0.us1.wallarm.com" "node-data1.us1.wallarm.com")
# Cloud region selection (populated by preflight, used by select_cloud_region)
US_CLOUD_REACHABLE="false"
EU_CLOUD_REACHABLE="false"
CLOUD_REGION=""
API_HOST=""
# --- Helper functions --- # --- Helper functions ---
log() { echo ">>> $*"; } log() { echo ">>> $*"; }
err() { echo "!!! $*" >&2; } err() { echo "!!! $*" >&2; }
@ -87,12 +93,14 @@ EOF
write_env_file() { write_env_file() {
local node_name="$1" local node_name="$1"
local api_token="$2" local api_token="$2"
local labels="$3" local api_host="$3"
local labels="$4"
local config_path="${NODES_DIR}/${node_name}/etc/go-node.yaml" local config_path="${NODES_DIR}/${node_name}/etc/go-node.yaml"
local env_file="${NODES_DIR}/${node_name}/env" local env_file="${NODES_DIR}/${node_name}/env"
cat > "${env_file}" <<EOF cat > "${env_file}" <<EOF
WALLARM_API_TOKEN=${api_token} WALLARM_API_TOKEN=${api_token}
WALLARM_API_HOST=${api_host}
WALLARM_LABELS=${labels} WALLARM_LABELS=${labels}
WALLARM_CONFIG_PATH=${config_path} WALLARM_CONFIG_PATH=${config_path}
EOF EOF
@ -152,6 +160,8 @@ run_preflight() {
local us eu local us eu
us=$(test_cloud_endpoints "US" "${US_DATA_NODES[@]}") us=$(test_cloud_endpoints "US" "${US_DATA_NODES[@]}")
eu=$(test_cloud_endpoints "EU" "${EU_DATA_NODES[@]}") eu=$(test_cloud_endpoints "EU" "${EU_DATA_NODES[@]}")
US_CLOUD_REACHABLE="$us"
EU_CLOUD_REACHABLE="$eu"
if [[ "$us" != "true" && "$eu" != "true" ]]; then if [[ "$us" != "true" && "$eu" != "true" ]]; then
err "Preflight failed: no Wallarm cloud region reachable (US/EU)." err "Preflight failed: no Wallarm cloud region reachable (US/EU)."
failed=1 failed=1
@ -203,7 +213,8 @@ install_single_node() {
local node_name="$1" local node_name="$1"
local listen_address="$2" local listen_address="$2"
local api_token="$3" local api_token="$3"
local labels="${4:-group=${node_name}}" local api_host="$4"
local labels="${5:-group=${node_name}}"
local work_dir="${NODES_DIR}/${node_name}" local work_dir="${NODES_DIR}/${node_name}"
local installer_path="${work_dir}/wallarm-native-node-aio.sh" local installer_path="${work_dir}/wallarm-native-node-aio.sh"
@ -230,11 +241,12 @@ EOF
fi fi
# 3. Write environment file (used by systemd and manual scripts) # 3. Write environment file (used by systemd and manual scripts)
write_env_file "${node_name}" "${api_token}" "${labels}" write_env_file "${node_name}" "${api_token}" "${api_host}" "${labels}"
# 4. Run installer # 4. Run installer
cd "${work_dir}" || return 1 cd "${work_dir}" || return 1
if WALLARM_API_TOKEN="${api_token}" \ if WALLARM_API_TOKEN="${api_token}" \
WALLARM_API_HOST="${api_host}" \
WALLARM_LABELS="${labels}" \ WALLARM_LABELS="${labels}" \
WALLARM_CONFIG_PATH="${work_dir}/etc/go-node.yaml" \ WALLARM_CONFIG_PATH="${work_dir}/etc/go-node.yaml" \
./wallarm-native-node-aio.sh install \ ./wallarm-native-node-aio.sh install \
@ -278,6 +290,9 @@ cmd_install() {
exit 1 exit 1
fi fi
# Select Wallarm cloud region (US/EU)
select_cloud_region
echo "" echo ""
echo "Enter each node's name and listening address (format: name IP:Port)" echo "Enter each node's name and listening address (format: name IP:Port)"
echo "Example: node1 0.0.0.0:8081" echo "Example: node1 0.0.0.0:8081"
@ -324,7 +339,7 @@ cmd_install() {
declare -a INSTALL_PIDS=() declare -a INSTALL_PIDS=()
for i in "${!NODE_NAMES[@]}"; do for i in "${!NODE_NAMES[@]}"; do
install_single_node "${NODE_NAMES[$i]}" "${NODE_ADDRESSES[$i]}" "$WALLARM_API_TOKEN" & install_single_node "${NODE_NAMES[$i]}" "${NODE_ADDRESSES[$i]}" "$WALLARM_API_TOKEN" "$API_HOST" &
INSTALL_PIDS+=($!) INSTALL_PIDS+=($!)
done done

View file

@ -169,7 +169,7 @@ for deploy_type in "${DEPLOY_TYPES[@]}"; do
docker) docker)
echo -e "${CYAN}Docker deployment next steps:${NC}" echo -e "${CYAN}Docker deployment next steps:${NC}"
echo -e " 1. Run the preflight check: ${YELLOW}./deploy/wallarm-ct-check.sh${NC}" echo -e " 1. Run the preflight check: ${YELLOW}./deploy/wallarm-ct-check.sh${NC}"
echo -e " 2. Deploy a Wallarm node: ${YELLOW}./deploy/wallarm-ct-deploy.sh${NC}" echo -e " 2. Deploy a Wallarm node: ${YELLOW}./deploy/wallarm-docker.sh${NC}"
echo -e " 3. Reconfigure existing node: ${YELLOW}./deploy/wallarm-ct-reconfigure.sh${NC}" echo -e " 3. Reconfigure existing node: ${YELLOW}./deploy/wallarm-ct-reconfigure.sh${NC}"
echo -e " 4. Uninstall a node: ${YELLOW}./deploy/wallarm-ct-uninstall.sh${NC}" echo -e " 4. Uninstall a node: ${YELLOW}./deploy/wallarm-ct-uninstall.sh${NC}"
echo echo