fix: add Symlink constant, create /opt/wallarm → instance after move

This commit is contained in:
admin 2026-08-02 05:56:53 +00:00
parent 08653eca9d
commit 6f5c281089

View file

@ -13,7 +13,8 @@ import (
const (
BaseDir = "/opt/fw"
DeployTo = "/opt/wallarm" // setup.sh hardcodes this, deploy here then move
DeployTo = "/opt/wallarm"
Symlink = "/opt/wallarm"
)
func installerURL() string {
@ -133,15 +134,17 @@ func InstallNode(node state.Node, apiToken, apiHost, labels string) error {
}
}
// 7. Move /opt/wallarm → /opt/fw/{name}/wallarm
// 8. Move /opt/wallarm → /opt/fw/{name}/wallarm
os.MkdirAll(filepath.Join(BaseDir, node.Name), 0755)
os.RemoveAll(instanceDir)
os.Rename(DeployTo, instanceDir)
// 8. Patch hardcoded /opt/wallarm paths
patchPaths(instanceDir)
// 9. Create symlink so ELF binaries find their interpreter
os.Remove(Symlink)
os.Symlink(instanceDir, Symlink)
// 9. Set up systemd service
// 10. Patch paths + systemd
patchPaths(instanceDir)
GenerateSystemdTemplate()
svc := "wallarm-node@" + node.Name
exec.Command("systemctl", "enable", svc).Run()