fix: cross-filesystem friendly move with cp+rm fallback, kill deploy nginx
This commit is contained in:
parent
8f9c0ac10c
commit
1924d5b1df
1 changed files with 7 additions and 3 deletions
|
|
@ -106,11 +106,15 @@ func InstallNode(node state.Node, apiToken, apiHost, labels, mode string) error
|
||||||
return fmt.Errorf("register: %w\n%s", regErr, string(data))
|
return fmt.Errorf("register: %w\n%s", regErr, string(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 8. Move /opt/wallarm → /opt/fw/{name}/wallarm, kill temp nginx
|
// 8. Move /opt/wallarm → instanceDir (copy+delete for cross-fs safety)
|
||||||
exec.Command("pkill", "-f", filepath.Join(DeployTo, "nginx")).Run()
|
exec.Command("pkill", "-9", "-f", filepath.Join(DeployTo, "nginx")).Run()
|
||||||
os.MkdirAll(filepath.Join(BaseDir, node.Name), 0755)
|
os.MkdirAll(filepath.Join(BaseDir, node.Name), 0755)
|
||||||
os.RemoveAll(instanceDir)
|
os.RemoveAll(instanceDir)
|
||||||
os.Rename(DeployTo, instanceDir)
|
if err := os.Rename(DeployTo, instanceDir); err != nil {
|
||||||
|
// Cross-filesystem fallback
|
||||||
|
exec.Command("cp", "-a", DeployTo, instanceDir).Run()
|
||||||
|
os.RemoveAll(DeployTo)
|
||||||
|
}
|
||||||
|
|
||||||
// 9. Patch paths + fix ELF binaries + systemd
|
// 9. Patch paths + fix ELF binaries + systemd
|
||||||
svc := "wallarm-node@" + node.Name
|
svc := "wallarm-node@" + node.Name
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue