diff --git a/cmd/deploy/main.go b/cmd/deploy/main.go index 23f61e2..165d91d 100644 --- a/cmd/deploy/main.go +++ b/cmd/deploy/main.go @@ -201,6 +201,7 @@ WALLARM_REGION=%s return } + fmt.Printf("Installing %d node(s)...\n", len(s.Nodes)) for _, node := range s.Nodes { if err := native.InstallNode(node, s.APIToken, s.APIHost, labels); err != nil { fmt.Fprintf(os.Stderr, "Deployment failed: %v\n", err) diff --git a/internal/native/native.go b/internal/native/native.go index dc1bf3b..60879ae 100644 --- a/internal/native/native.go +++ b/internal/native/native.go @@ -83,30 +83,14 @@ func InstallNode(node state.Node, apiToken, apiHost, labels string) error { exec.Command("bash", filepath.Join(DeployTo, "pick-module.sh")).Run() fmt.Printf("[%s] Registering node...\n", node.Name) - fmt.Printf("[%s] Registering node...\n", node.Name) + fmt.Printf("[%s] Registering node (this may take 30-60s)...\n", node.Name) registerCmd := exec.Command("bash", "-c", fmt.Sprintf("source %s/env.list 2>/dev/null; %s/register-node job:register -token '%s' -host '%s'", DeployTo, DeployTo, apiToken, apiHost)) registerCmd.Dir = DeployTo - - // Run with explicit timeout - type result struct { - out []byte - err error - } - ch := make(chan result, 1) - go func() { - out, err := registerCmd.CombinedOutput() - ch <- result{out, err} - }() - select { - case r := <-ch: - if r.err != nil { - return fmt.Errorf("register: %w\n%s", r.err, string(r.out)) - } - case <-time.After(60 * time.Second): - registerCmd.Process.Kill() - return fmt.Errorf("registration timed out") + out, regErr := registerCmd.CombinedOutput() + if regErr != nil { + return fmt.Errorf("register: %w\n%s", regErr, string(out)) } // 7. Stop our temporary NGINX, start Wallarm via supervisord