From a6359beb61df339cf4ea69e7cb2ecfc5090c1a48 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 1 Aug 2026 21:15:21 +0000 Subject: [PATCH] fix: remove supervisord start (blocks forever with -n), use state for skip check --- internal/native/native.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/internal/native/native.go b/internal/native/native.go index f53f729..9fc81ae 100644 --- a/internal/native/native.go +++ b/internal/native/native.go @@ -82,9 +82,18 @@ func InstallNode(node state.Node, apiToken, apiHost, labels string) error { fmt.Printf("[%s] Configuring NGINX module...\n", node.Name) exec.Command("bash", filepath.Join(DeployTo, "pick-module.sh")).Run() - // 6. Register node (skip if already registered from previous run) - nodeYaml := filepath.Join(DeployTo, "etc", "wallarm", "node.yaml") - if _, err := os.Stat(nodeYaml); err == nil { + // 6. Register node — skip if this node was previously deployed + existingState, _ := state.Load() + alreadyRegistered := false + if existingState != nil { + for _, n := range existingState.Nodes { + if n.Name == node.Name { + alreadyRegistered = true + break + } + } + } + if alreadyRegistered { fmt.Printf("[%s] Already registered, skipping.\n", node.Name) } else { fmt.Printf("[%s] Registering node (this may take 30-60s)...\n", node.Name) @@ -124,14 +133,7 @@ func InstallNode(node state.Node, apiToken, apiHost, labels string) error { } } - // 7. Stop our temporary NGINX, start Wallarm via supervisord - exec.Command("pkill", "-f", filepath.Join(DeployTo, "nginx")).Run() - supervisorCmd := exec.Command("bash", filepath.Join(DeployTo, "supervisord.sh"), "start") - supervisorCmd.Dir = DeployTo - supervisorCmd.Run() - fmt.Printf("[%s] Services started.\n", node.Name) - - // 8. Move /opt/wallarm → /opt/fw/{name}/wallarm + // 7. Move /opt/wallarm → /opt/fw/{name}/wallarm os.MkdirAll(filepath.Join(BaseDir, node.Name), 0755) os.RemoveAll(instanceDir) os.Rename(DeployTo, instanceDir)