wallarm/docker/wallarm-docker.sh
admin 1a2a0fbd7b feat: Go binary — preflight, state, tunnel over TLS:443
Single-binary wallarm deployment manager:
- shared/ — system detection, validation, connectivity (port of wallarm-lib.sh)
- preflight/ — mandatory checks on every start (OS, arch, disk, memory, cloud)
- state/ — ~/.wallarm/state.json persistence (nodes, deployment type)
- tunnel/ — reverse SSH tunnel over TLS:443 via Zoraxy edge proxy
- cmd/wallarm/main.go — auto-detect state, route to wizard or dashboard

wallarm-docker.sh wrapper delegates to existing ct-* scripts for now.
2026-08-01 09:25:22 +00:00

91 lines
3 KiB
Bash

#!/bin/bash
# ==============================================================================
# Wallarm Docker Node Manager - Unified single-script manager
# ==============================================================================
# Delegates to the individual docker/* scripts for preflight, deployment,
# reconfiguration, and removal — providing a single entry point matching the
# native/wallarm-native.sh command interface.
#
# Commands:
# --preflight Run preflight checks only (no installation).
# --install Interactive deployment of a Wallarm Docker node.
# --config Reconfigure an existing Docker node.
# --remove Remove a Docker node completely.
# --status Show running Wallarm containers.
# --help|-h Show help.
# ==============================================================================
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Shell script files this wrapper delegates to (must be in the same directory)
CHECK_SCRIPT="${SCRIPT_DIR}/wallarm-ct-check.sh"
DEPLOY_SCRIPT="${SCRIPT_DIR}/wallarm-ct-deploy.sh"
RECONF_SCRIPT="${SCRIPT_DIR}/wallarm-ct-reconfigure.sh"
REMOVE_SCRIPT="${SCRIPT_DIR}/wallarm-ct-uninstall.sh"
show_help() {
cat <<EOF
Usage: $0 COMMAND [OPTIONS]
Commands:
--preflight Run system validation and preflight checks
--install Interactive deployment of a Wallarm Docker node
--config Reconfigure an existing Docker node (proxies, mode)
--remove Uninstall a Wallarm Docker node
--status Show running Wallarm containers
Examples:
$0 --preflight
sudo $0 --install
sudo $0 --config
sudo $0 --remove
EOF
}
# Ensure the delegated script exists
require_script() {
local script="$1"
local name="$2"
if [[ ! -x "$script" ]]; then
echo "!!! $name script not found or not executable: $script" >&2
echo " Run setup.sh first to download all deployment scripts." >&2
exit 1
fi
}
case "${1:-}" in
--preflight)
require_script "$CHECK_SCRIPT" "Preflight (wallarm-ct-check.sh)"
exec "$CHECK_SCRIPT" "${@:2}"
;;
--install)
require_script "$DEPLOY_SCRIPT" "Deploy (wallarm-ct-deploy.sh)"
exec sudo "$DEPLOY_SCRIPT" "${@:2}"
;;
--config)
require_script "$RECONF_SCRIPT" "Reconfigure (wallarm-ct-reconfigure.sh)"
exec sudo "$RECONF_SCRIPT" "${@:2}"
;;
--remove)
require_script "$REMOVE_SCRIPT" "Uninstall (wallarm-ct-uninstall.sh)"
exec sudo "$REMOVE_SCRIPT" "${@:2}"
;;
--status)
echo "Wallarm Docker Nodes:"
if command -v docker >/dev/null 2>&1; then
docker ps --filter "name=wallarm-" \
--format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" 2>/dev/null || true
else
echo " Docker is not installed or not in PATH."
fi
;;
--help|-h)
show_help
;;
*)
show_help
exit 1
;;
esac