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 ( const (
BaseDir = "/opt/fw" BaseDir = "/opt/fw"
DeployTo = "/opt/wallarm" // setup.sh hardcodes this, deploy here then move DeployTo = "/opt/wallarm"
Symlink = "/opt/wallarm"
) )
func installerURL() string { 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.MkdirAll(filepath.Join(BaseDir, node.Name), 0755)
os.RemoveAll(instanceDir) os.RemoveAll(instanceDir)
os.Rename(DeployTo, instanceDir) os.Rename(DeployTo, instanceDir)
// 8. Patch hardcoded /opt/wallarm paths // 9. Create symlink so ELF binaries find their interpreter
patchPaths(instanceDir) os.Remove(Symlink)
os.Symlink(instanceDir, Symlink)
// 9. Set up systemd service // 10. Patch paths + systemd
patchPaths(instanceDir)
GenerateSystemdTemplate() GenerateSystemdTemplate()
svc := "wallarm-node@" + node.Name svc := "wallarm-node@" + node.Name
exec.Command("systemctl", "enable", svc).Run() exec.Command("systemctl", "enable", svc).Run()