refactor(installer): KISS — remove all flags, just interactive deploy
This commit is contained in:
parent
d29ecf41ef
commit
3b4fd6a84c
2 changed files with 3 additions and 63 deletions
16
README.md
16
README.md
|
|
@ -98,22 +98,8 @@ cd ../app && ./core
|
||||||
|
|
||||||
The server starts on `http://localhost:8080` with:
|
The server starts on `http://localhost:8080` with:
|
||||||
- **Workspace launcher**: `http://localhost:8080/` (OIDC-protected)
|
- **Workspace launcher**: `http://localhost:8080/` (OIDC-protected)
|
||||||
- **Admin panel**: `http://localhost:8080/admin` (bearer token)
|
- **Admin panel**: `http://localhost:8080/admin`
|
||||||
- **Health API**: `http://localhost:8080/api/health`
|
- **Health API**: `http://localhost:8080/api/health`
|
||||||
- **Auth status**: `http://localhost:8080/auth/status`
|
|
||||||
|
|
||||||
### Production Install
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Full install (build → test → deploy → systemd → smoke test)
|
|
||||||
sudo ./install.sh
|
|
||||||
sudo ./install.sh --status
|
|
||||||
sudo ./install.sh --uninstall
|
|
||||||
sudo ./install.sh --build-only # Compile only
|
|
||||||
sudo ./install.sh --skip-build # Install existing binary
|
|
||||||
sudo ./install.sh --config-only # Generate config only
|
|
||||||
sudo ./install.sh --help # Show all options
|
|
||||||
```
|
|
||||||
|
|
||||||
### Run Tests
|
### Run Tests
|
||||||
|
|
||||||
|
|
|
||||||
50
install.sh
50
install.sh
|
|
@ -1,14 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# Next Workspace (NextWks) — Installer
|
# Next Workspace (NextWks) — Installer
|
||||||
#
|
|
||||||
# curl -fsSL https://git.lohmar.co.uk/lexton-it/NextWks/raw/main/install.sh | bash
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
# ./install.sh Full interactive install
|
|
||||||
# ./install.sh --from-env Load answers from .env
|
|
||||||
# ./install.sh --status Check installation health
|
|
||||||
# ./install.sh --uninstall Remove everything
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
@ -92,46 +84,8 @@ fi
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# PARSE FLAGS
|
# PARSE FLAGS
|
||||||
# ============================================================
|
# ============================================================
|
||||||
MODE="install"
|
|
||||||
FROM_ENV=false
|
FROM_ENV=false
|
||||||
for arg in "$@"; do
|
[ "${1:-}" = "--from-env" ] && FROM_ENV=true
|
||||||
case "$arg" in
|
|
||||||
--from-env) FROM_ENV=true ;;
|
|
||||||
--status) MODE="status" ;;
|
|
||||||
--uninstall) MODE="uninstall" ;;
|
|
||||||
--help)
|
|
||||||
head -20 "$0" | grep "^#" | sed 's/^# //; 1s/.*/NextWks Installer/'
|
|
||||||
exit 0 ;;
|
|
||||||
*) error "Unknown: $arg (use --help)"; exit 1 ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# ============================================================
|
|
||||||
# UNINSTALL
|
|
||||||
# ============================================================
|
|
||||||
if [ "$MODE" = "uninstall" ]; then
|
|
||||||
info "Uninstalling Next Workspace..."
|
|
||||||
$SUDO systemctl stop nextwks 2>/dev/null || true
|
|
||||||
$SUDO systemctl disable nextwks 2>/dev/null || true
|
|
||||||
$SUDO rm -f "$SERVICE_FILE"
|
|
||||||
$SUDO systemctl daemon-reload
|
|
||||||
[ -d "$INSTALL_DIR" ] && { $SUDO rm -rf "$INSTALL_DIR"; success "Removed $INSTALL_DIR"; }
|
|
||||||
success "Uninstall complete"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ============================================================
|
|
||||||
# STATUS
|
|
||||||
# ============================================================
|
|
||||||
if [ "$MODE" = "status" ]; then
|
|
||||||
echo ""; header "Next Workspace Status"
|
|
||||||
[ -f "${BIN_DIR}/core" ] && success "✓ Binary: ${BIN_DIR}/core" || warn "✗ Binary: not found"
|
|
||||||
[ -f "$CONFIG_FILE" ] && success "✓ Config: $CONFIG_FILE" || warn "✗ Config: not found"
|
|
||||||
$SUDO systemctl is-active --quiet nextwks 2>/dev/null && success "✓ Service: running" || info " Service: stopped"
|
|
||||||
$SUDO systemctl is-active --quiet authelia 2>/dev/null && success "✓ Authelia: running" || info " Authelia: stopped"
|
|
||||||
command -v curl &>/dev/null && [ "$(curl -s --max-time 2 http://localhost:8080/api/health 2>/dev/null)" = '{"status":"ok"}' ] && success "✓ API: OK" || info " API: not responding"
|
|
||||||
echo ""; exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# INTERACTIVE WIZARD
|
# INTERACTIVE WIZARD
|
||||||
|
|
@ -217,7 +171,7 @@ ENVEOF
|
||||||
success "Settings saved to $ENV_FILE"
|
success "Settings saved to $ENV_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
[ "$MODE" = "install" ] && gather_inputs
|
gather_inputs
|
||||||
|
|
||||||
# Derive domains from URLs (needed even when --from-env)
|
# Derive domains from URLs (needed even when --from-env)
|
||||||
NEXTWKS_DOMAIN=$(echo "$NEXTWKS_URL" | sed 's|https\?://||;s|/.*||')
|
NEXTWKS_DOMAIN=$(echo "$NEXTWKS_URL" | sed 's|https\?://||;s|/.*||')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue