diff --git a/internal/native/native.go b/internal/native/native.go index 5a40f2b..642f989 100644 --- a/internal/native/native.go +++ b/internal/native/native.go @@ -62,8 +62,12 @@ http { `, nginxDir, nginxDir, nginxDir, port)), 0644) // Start NGINX for this instance - exec.Command(filepath.Join(nginxDir, "sbin", "nginx"), - "-c", nginxConf, "-p", nginxDir).Run() + nginxBin := filepath.Join(nginxDir, "sbin", "nginx") + startCmd := exec.Command(nginxBin, "-c", nginxConf, "-p", nginxDir) + startCmd.Dir = nginxDir + if out, err := startCmd.CombinedOutput(); err != nil { + fmt.Printf("[%s] NGINX start warning: %v\n%s\n", node.Name, err, string(out)) + } fmt.Printf("[%s] NGINX started on port %s\n", node.Name, port) // 2. Download AIO once @@ -76,21 +80,19 @@ http { os.Chmod(installerPath, 0755) } - // 3. Create instance dir + symlink - os.MkdirAll(instanceDir, 0755) - os.Remove(Symlink) - if err := os.Symlink(instanceDir, Symlink); err != nil { - os.RemoveAll(Symlink) - os.Symlink(instanceDir, Symlink) - } - - // 4. Extract AIO to instance + // 3. Extract AIO to instance fmt.Printf("[%s] Extracting...\n", node.Name) cmd := exec.Command("bash", installerPath, "--noexec", "--keep", "--target", instanceDir, "--noprogress", "--accept") if out, err := cmd.CombinedOutput(); err != nil { return fmt.Errorf("extract: %w\n%s", err, string(out)) } + // 4. Patch setup.sh to use instance path (bypasses /opt/wallarm hardcoding) + setupPath := filepath.Join(instanceDir, "setup.sh") + exec.Command("sed", "-i", + fmt.Sprintf("s|/opt/wallarm|%s|g", instanceDir), + setupPath).Run() + // 5. Run setup.sh fmt.Printf("[%s] Running setup...\n", node.Name) cmd = exec.Command("bash", filepath.Join(instanceDir, "setup.sh"),