fix: patch setup.sh /opt/wallarm paths instead of symlink
This commit is contained in:
parent
bb45f8606d
commit
9cf6a2a66b
1 changed files with 13 additions and 11 deletions
|
|
@ -62,8 +62,12 @@ http {
|
||||||
`, nginxDir, nginxDir, nginxDir, port)), 0644)
|
`, nginxDir, nginxDir, nginxDir, port)), 0644)
|
||||||
|
|
||||||
// Start NGINX for this instance
|
// Start NGINX for this instance
|
||||||
exec.Command(filepath.Join(nginxDir, "sbin", "nginx"),
|
nginxBin := filepath.Join(nginxDir, "sbin", "nginx")
|
||||||
"-c", nginxConf, "-p", nginxDir).Run()
|
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)
|
fmt.Printf("[%s] NGINX started on port %s\n", node.Name, port)
|
||||||
|
|
||||||
// 2. Download AIO once
|
// 2. Download AIO once
|
||||||
|
|
@ -76,21 +80,19 @@ http {
|
||||||
os.Chmod(installerPath, 0755)
|
os.Chmod(installerPath, 0755)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Create instance dir + symlink
|
// 3. Extract AIO to instance
|
||||||
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
|
|
||||||
fmt.Printf("[%s] Extracting...\n", node.Name)
|
fmt.Printf("[%s] Extracting...\n", node.Name)
|
||||||
cmd := exec.Command("bash", installerPath, "--noexec", "--keep", "--target", instanceDir, "--noprogress", "--accept")
|
cmd := exec.Command("bash", installerPath, "--noexec", "--keep", "--target", instanceDir, "--noprogress", "--accept")
|
||||||
if out, err := cmd.CombinedOutput(); err != nil {
|
if out, err := cmd.CombinedOutput(); err != nil {
|
||||||
return fmt.Errorf("extract: %w\n%s", err, string(out))
|
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
|
// 5. Run setup.sh
|
||||||
fmt.Printf("[%s] Running setup...\n", node.Name)
|
fmt.Printf("[%s] Running setup...\n", node.Name)
|
||||||
cmd = exec.Command("bash", filepath.Join(instanceDir, "setup.sh"),
|
cmd = exec.Command("bash", filepath.Join(instanceDir, "setup.sh"),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue