refactor: move everything under /opt/wallarm/
- deploy.sh installs to /opt/wallarm/wallarm (not ~/deploy/)
- state.json at /opt/wallarm/state.json (not ~/.wallarm/)
- instances under /opt/wallarm/{name}/
- .env will live at /opt/wallarm/.env for global defaults
- Single tree, no home directory clutter
This commit is contained in:
parent
f5919b4c85
commit
e2c0f5af08
3 changed files with 25 additions and 24 deletions
|
|
@ -179,7 +179,13 @@ WALLARM_REGION=%s
|
|||
}
|
||||
|
||||
fmt.Println()
|
||||
fmt.Println("✅ Deployment complete! Run 'wallarm' again for the dashboard.")
|
||||
fmt.Println("✅ Deployment complete!")
|
||||
fmt.Println()
|
||||
fmt.Printf(" Binary: /opt/wallarm/wallarm\n")
|
||||
fmt.Printf(" Instance: %s\n", instanceDir)
|
||||
fmt.Printf(" State: /opt/wallarm/state.json\n")
|
||||
fmt.Println()
|
||||
fmt.Println("Run 'sudo /opt/wallarm/wallarm' for the dashboard.")
|
||||
}
|
||||
func runTunnelFlow() {
|
||||
fmt.Println()
|
||||
|
|
|
|||
26
deploy.sh
26
deploy.sh
|
|
@ -1,14 +1,14 @@
|
|||
#!/bin/bash
|
||||
# ==============================================================================
|
||||
# Wallarm Deployment — Source-based Bootstrap
|
||||
# Wallarm Deployment — Single Binary Bootstrap
|
||||
# ==============================================================================
|
||||
# Clones the repository and builds the wallarm binary from source.
|
||||
# One command to get started:
|
||||
# Clones the repository, builds the wallarm binary, and installs it to
|
||||
# /opt/wallarm/. One command to get started:
|
||||
#
|
||||
# curl -fsSL ".../deploy.sh" | bash
|
||||
# sudo ./deploy/wallarm
|
||||
# sudo /opt/wallarm/wallarm
|
||||
#
|
||||
# Requires: git, go (auto-installed if missing on apt/yum systems)
|
||||
# All deployments live under /opt/wallarm/ — binary, config, instances, state.
|
||||
# ==============================================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
|
@ -21,7 +21,7 @@ RED='\033[0;31m'
|
|||
NC='\033[0m'
|
||||
|
||||
REPO_URL="https://git.sechpoint.app/customer-engineering/wallarm.git"
|
||||
DEPLOY_DIR="${HOME:-/root}/deploy"
|
||||
WALLARM_DIR="/opt/wallarm"
|
||||
BUILD_DIR="/tmp/wallarm-build-$$"
|
||||
|
||||
cleanup() { rm -rf "$BUILD_DIR"; }
|
||||
|
|
@ -76,15 +76,15 @@ if command -v upx >/dev/null 2>&1; then
|
|||
fi
|
||||
|
||||
# ── Install ───────────────────────────────────────────────────────────
|
||||
mkdir -p "$DEPLOY_DIR"
|
||||
cp wallarm "$DEPLOY_DIR/wallarm"
|
||||
chmod +x "$DEPLOY_DIR/wallarm"
|
||||
mkdir -p "$WALLARM_DIR"
|
||||
cp wallarm "$WALLARM_DIR/wallarm"
|
||||
chmod +x "$WALLARM_DIR/wallarm"
|
||||
|
||||
echo
|
||||
echo -e "${GREEN}${BOLD}Ready!${NC}"
|
||||
echo
|
||||
echo -e " ${CYAN}sudo ${DEPLOY_DIR}/wallarm${NC} — Start the TUI"
|
||||
echo -e " ${CYAN}${DEPLOY_DIR}/wallarm --help${NC} — Show all commands"
|
||||
echo -e " ${CYAN}${DEPLOY_DIR}/wallarm --tunnel${NC} — Start remote tunnel"
|
||||
echo -e " ${CYAN}sudo ${WALLARM_DIR}/wallarm${NC} — Start the TUI"
|
||||
echo -e " ${CYAN}${WALLARM_DIR}/wallarm --help${NC} — Show all commands"
|
||||
echo -e " ${CYAN}${WALLARM_DIR}/wallarm --tunnel${NC} — Start remote tunnel"
|
||||
echo
|
||||
ls -lh "$DEPLOY_DIR/wallarm"
|
||||
ls -lh "$WALLARM_DIR/wallarm"
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// StateDir is where wallarm stores its state.
|
||||
const StateDir = ".wallarm"
|
||||
// StateDir is where wallarm stores its state (under /opt/wallarm/).
|
||||
const StateDir = "/opt/wallarm"
|
||||
|
||||
// State represents the persistent deployment state.
|
||||
type State struct {
|
||||
|
|
@ -34,11 +33,7 @@ type Node struct {
|
|||
|
||||
// Path returns the full path to the state file.
|
||||
func Path() string {
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
home = "/root"
|
||||
}
|
||||
return filepath.Join(home, StateDir, "state.json")
|
||||
return StateDir + "/state.json"
|
||||
}
|
||||
|
||||
// Load reads and parses the state file. Returns nil if the file doesn't exist.
|
||||
|
|
@ -58,10 +53,10 @@ func Load() (*State, error) {
|
|||
return &s, nil
|
||||
}
|
||||
|
||||
// Save writes the state to disk, creating directories as needed.
|
||||
// Save writes the state to /opt/wallarm/state.json.
|
||||
func Save(s *State) error {
|
||||
p := Path()
|
||||
if err := os.MkdirAll(filepath.Dir(p), 0700); err != nil {
|
||||
if err := os.MkdirAll(StateDir, 0755); err != nil {
|
||||
return fmt.Errorf("create state dir: %w", err)
|
||||
}
|
||||
data, err := json.MarshalIndent(s, "", " ")
|
||||
|
|
|
|||
Loading…
Reference in a new issue