fix: use correct meganode.wallarm.com installer URL

- Updated from deprecated repo.wallarm.com to meganode.wallarm.com/6.12/
- Installer URL: wallarm-6.12.7.x86_64-glibc.sh
- Override with WALLARM_INSTALLER_URL env var
- Pipes token+region via stdin to skip interactive prompts
- Preflight checks meganode.wallarm.com reachability
This commit is contained in:
admin 2026-08-01 15:24:03 +00:00
parent d0ad1c5243
commit b1c596ccf2
2 changed files with 22 additions and 22 deletions

View file

@ -12,17 +12,23 @@ import (
"git.sechpoint.app/customer-engineering/wallarm/internal/state"
)
// Constants matching the bash script
// Constants
const (
BaseDir = "/opt/wallarm"
NodesDir = BaseDir + "/nodes"
SystemdTemplate = "/etc/systemd/system/wallarm-node@.service"
InstallerBaseURL = "https://repo.wallarm.com/linux/wallarm-native-node/latest/all-in-one"
InstallerArch = "x86_64"
BaseDir = "/opt/wallarm"
NodesDir = BaseDir + "/nodes"
SystemdTemplate = "/etc/systemd/system/wallarm-node@.service"
)
// InstallerURL returns the all-in-one installer URL.
var InstallerURL = fmt.Sprintf("%s/wallarm-native-node-aio-%s-latest.sh", InstallerBaseURL, InstallerArch)
// installerURL returns the correct native node installer for the current architecture.
// Override with WALLARM_INSTALLER_URL env var to pin a specific version.
func installerURL() string {
if u := os.Getenv("WALLARM_INSTALLER_URL"); u != "" {
return u
}
arch := "x86_64"
suffix := "glibc"
return fmt.Sprintf("https://meganode.wallarm.com/6.12/wallarm-6.12.7.%s-%s.sh", arch, suffix)
}
// InstallNode deploys a single native Wallarm node.
// node: node metadata, apiToken: Wallarm API token, apiHost: cloud API host, labels: optional node labels.
@ -59,13 +65,10 @@ connector:
}
// 3. Download installer if missing
installerURL := InstallerURL
if u := os.Getenv("WALLARM_INSTALLER_URL"); u != "" {
installerURL = u
}
url := installerURL()
if _, err := os.Stat(installerPath); os.IsNotExist(err) {
fmt.Printf("[%s] Downloading installer...\n", node.Name)
cmd := exec.Command("curl", "-fsSL", "-o", installerPath, installerURL)
fmt.Printf("[%s] Downloading installer from meganode.wallarm.com...\n", node.Name)
cmd := exec.Command("curl", "-fsSL", "-o", installerPath, url)
if out, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("download installer: %w\n%s", err, string(out))
}
@ -85,20 +88,17 @@ WALLARM_CONFIG_PATH=%s
return fmt.Errorf("write env: %w", err)
}
// 5. Run the all-in-one installer
// 5. Run the meganode installer (piped token + region to avoid interactive prompts)
fmt.Printf("[%s] Running Wallarm installer...\n", node.Name)
installCmd := exec.Command(installerPath, "install",
"--", "--config-dir", filepath.Join(workDir, "etc"),
"--", "--log-dir", filepath.Join(workDir, "var", "log"),
"--", "--pid-dir", filepath.Join(workDir, "var", "run"),
)
installCmd := exec.Command(installerPath)
installCmd.Dir = workDir
installCmd.Env = append(os.Environ(),
"WALLARM_API_TOKEN="+apiToken,
"WALLARM_API_HOST="+apiHost,
"WALLARM_LABELS="+labels,
"WALLARM_CONFIG_PATH="+configPath,
)
// Pipe token and region as stdin to skip interactive prompts
installCmd.Stdin = strings.NewReader(apiToken + "\n" + apiHost + "\n")
logFile, err := os.Create(filepath.Join(workDir, "install.log"))
if err == nil {

View file

@ -88,7 +88,7 @@ func Run() Result {
}
// 6. Installer reachability
installerOk := shared.HTTPHead("https://repo.wallarm.com")
installerOk := shared.HTTPHead("https://meganode.wallarm.com/6.12/")
r.Checks = append(r.Checks, Check{
Name: "installer_reachable", Passed: installerOk,
Detail: "repo.wallarm.com",