From b1c596ccf2463dbf178df3a0b7f1c0b487cee952 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 1 Aug 2026 15:24:03 +0000 Subject: [PATCH] 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 --- internal/native/native.go | 42 ++++++++++++++++----------------- internal/preflight/preflight.go | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/internal/native/native.go b/internal/native/native.go index abd9ec0..f229f51 100644 --- a/internal/native/native.go +++ b/internal/native/native.go @@ -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 { diff --git a/internal/preflight/preflight.go b/internal/preflight/preflight.go index 316816b..d02bcdd 100644 --- a/internal/preflight/preflight.go +++ b/internal/preflight/preflight.go @@ -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",