2026-05-18 13:27:06 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
# get.sh — One-line bootstrapper for Triton Manage Server.
|
|
|
|
|
#
|
2026-05-21 23:28:09 +08:00
|
|
|
# Downloads the installer to /opt/triton-manageserver (Linux) or
|
|
|
|
|
# ~/.local/share/triton-manageserver (macOS), installs Podman if needed,
|
2026-05-18 13:27:06 +08:00
|
|
|
# then hands off to install.sh.
|
|
|
|
|
#
|
|
|
|
|
# Usage:
|
|
|
|
|
# curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh | sudo bash
|
|
|
|
|
#
|
|
|
|
|
# Pass flags through to install.sh:
|
|
|
|
|
# curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh \
|
|
|
|
|
# | sudo bash -s -- --gateway-hostname manage.example.com --manage-host-ip 10.0.0.5
|
2026-05-19 19:11:35 +08:00
|
|
|
#
|
2026-05-19 19:19:57 +08:00
|
|
|
# Upgrade (pull latest image, run DB migrations, keep data):
|
|
|
|
|
# curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh \
|
|
|
|
|
# | sudo bash -s -- --upgrade
|
|
|
|
|
#
|
|
|
|
|
# Upgrade to a specific image tag:
|
|
|
|
|
# curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh \
|
2026-05-31 12:41:05 +08:00
|
|
|
# | sudo bash -s -- --upgrade --image forgejo.primatekun.tech/primatekuntech/triton-manage-server:1.2.0
|
2026-05-19 19:19:57 +08:00
|
|
|
#
|
2026-05-19 19:11:35 +08:00
|
|
|
# Uninstall (stop containers, keep data):
|
|
|
|
|
# curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh \
|
|
|
|
|
# | sudo bash -s -- --uninstall
|
|
|
|
|
#
|
|
|
|
|
# Uninstall and delete all data (irreversible):
|
|
|
|
|
# curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh \
|
|
|
|
|
# | sudo bash -s -- --uninstall --purge-data
|
2026-05-18 13:27:06 +08:00
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
REPO_BASE="https://raw.githubusercontent.com/primatekuntech/triton-install/main/manage-server"
|
|
|
|
|
INSTALLER_FILES=(install.sh upgrade.sh uninstall.sh compose.yaml env.template)
|
|
|
|
|
|
|
|
|
|
# ── colour helpers ────────────────────────────────────────────────────────
|
|
|
|
|
BOLD='\033[1m'; CYAN='\033[1;96m'; GREEN='\033[1;32m'
|
|
|
|
|
YELLOW='\033[1;33m'; RED='\033[1;91m'; RESET='\033[0m'
|
|
|
|
|
info() { printf "${CYAN} •${RESET} %s\n" "$*"; }
|
|
|
|
|
ok() { printf "${GREEN} ✓${RESET} %s\n" "$*"; }
|
|
|
|
|
warn() { printf "${YELLOW} !${RESET} %s\n" "$*"; }
|
|
|
|
|
die() { printf "\n${RED} ✗ error:${RESET} %s\n\n" "$*" >&2; exit 1; }
|
|
|
|
|
banner() { printf "\n${BOLD}%s${RESET}\n\n" "$*"; }
|
|
|
|
|
|
2026-05-19 19:11:35 +08:00
|
|
|
# ── arg pre-scan (before any output) ─────────────────────────────────────
|
|
|
|
|
UNINSTALL=0
|
2026-05-19 19:19:57 +08:00
|
|
|
UPGRADE=0
|
2026-05-19 19:11:35 +08:00
|
|
|
PASSTHROUGH=()
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
|
case "$arg" in
|
|
|
|
|
--uninstall) UNINSTALL=1 ;;
|
2026-05-19 19:19:57 +08:00
|
|
|
--upgrade) UPGRADE=1 ;;
|
2026-05-19 19:11:35 +08:00
|
|
|
*) PASSTHROUGH+=("$arg") ;;
|
|
|
|
|
esac
|
|
|
|
|
done
|
|
|
|
|
|
2026-05-18 13:27:06 +08:00
|
|
|
# ── OS detection ──────────────────────────────────────────────────────────
|
|
|
|
|
case "$(uname -s)" in
|
|
|
|
|
Linux) PLATFORM=linux ;;
|
|
|
|
|
Darwin) PLATFORM=macos ;;
|
|
|
|
|
*) die "unsupported OS: $(uname -s)" ;;
|
|
|
|
|
esac
|
|
|
|
|
|
2026-05-19 19:11:35 +08:00
|
|
|
# ── install directory ─────────────────────────────────────────────────────
|
|
|
|
|
if [[ "$PLATFORM" == "linux" ]]; then
|
2026-05-21 23:28:09 +08:00
|
|
|
INSTALL_DIR="/opt/triton-manageserver"
|
2026-05-19 19:11:35 +08:00
|
|
|
else
|
2026-05-21 23:28:09 +08:00
|
|
|
INSTALL_DIR="${HOME}/.local/share/triton-manageserver"
|
2026-05-19 19:11:35 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# ── uninstall shortcut ────────────────────────────────────────────────────
|
|
|
|
|
if [[ $UNINSTALL -eq 1 ]]; then
|
|
|
|
|
banner "▶ Triton Manage Server — Uninstaller"
|
|
|
|
|
info "platform: $PLATFORM"
|
|
|
|
|
if [[ "$PLATFORM" == "linux" && $EUID -ne 0 ]]; then
|
|
|
|
|
die "run as root on Linux:\n\n curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh | sudo bash -s -- --uninstall"
|
|
|
|
|
fi
|
2026-05-19 19:58:02 +08:00
|
|
|
[[ -d "$INSTALL_DIR" ]] \
|
2026-05-19 19:11:35 +08:00
|
|
|
|| die "Triton Manage Server does not appear to be installed (${INSTALL_DIR} not found)"
|
2026-05-19 19:58:02 +08:00
|
|
|
info "refreshing installer files..."
|
|
|
|
|
for f in "${INSTALLER_FILES[@]}"; do
|
|
|
|
|
curl -fsSL "${REPO_BASE}/${f}" -o "${INSTALL_DIR}/${f}"
|
|
|
|
|
done
|
|
|
|
|
chmod +x "${INSTALL_DIR}/install.sh" "${INSTALL_DIR}/upgrade.sh" "${INSTALL_DIR}/uninstall.sh"
|
|
|
|
|
ok "installer files refreshed"
|
|
|
|
|
echo ""
|
2026-05-19 19:11:35 +08:00
|
|
|
exec bash "${INSTALL_DIR}/uninstall.sh" "${PASSTHROUGH[@]}"
|
|
|
|
|
fi
|
|
|
|
|
|
2026-05-19 19:19:57 +08:00
|
|
|
# ── upgrade shortcut ──────────────────────────────────────────────────────
|
|
|
|
|
if [[ $UPGRADE -eq 1 ]]; then
|
|
|
|
|
banner "▶ Triton Manage Server — Upgrade"
|
|
|
|
|
info "platform: $PLATFORM"
|
|
|
|
|
if [[ "$PLATFORM" == "linux" && $EUID -ne 0 ]]; then
|
|
|
|
|
die "run as root on Linux:\n\n curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh | sudo bash -s -- --upgrade"
|
|
|
|
|
fi
|
|
|
|
|
[[ -d "$INSTALL_DIR" ]] \
|
|
|
|
|
|| die "Triton Manage Server does not appear to be installed (${INSTALL_DIR} not found)"
|
|
|
|
|
info "refreshing installer files..."
|
|
|
|
|
for f in "${INSTALLER_FILES[@]}"; do
|
|
|
|
|
curl -fsSL "${REPO_BASE}/${f}" -o "${INSTALL_DIR}/${f}"
|
|
|
|
|
done
|
|
|
|
|
chmod +x "${INSTALL_DIR}/install.sh" "${INSTALL_DIR}/upgrade.sh" "${INSTALL_DIR}/uninstall.sh"
|
|
|
|
|
ok "installer files refreshed"
|
|
|
|
|
echo ""
|
|
|
|
|
exec bash "${INSTALL_DIR}/upgrade.sh" "${PASSTHROUGH[@]}"
|
|
|
|
|
fi
|
|
|
|
|
|
2026-05-18 13:27:06 +08:00
|
|
|
banner "▶ Triton Manage Server — Installer"
|
|
|
|
|
info "platform: $PLATFORM"
|
|
|
|
|
|
|
|
|
|
# ── root check ────────────────────────────────────────────────────────────
|
|
|
|
|
if [[ "$PLATFORM" == "linux" && $EUID -ne 0 ]]; then
|
|
|
|
|
die "run as root on Linux:\n\n curl -fsSL https://raw.githubusercontent.com/primatekuntech/triton-install/main/get.sh | sudo bash"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# ── runtime detection ─────────────────────────────────────────────────────
|
|
|
|
|
has_podman() { command -v podman >/dev/null 2>&1; }
|
|
|
|
|
has_docker() { command -v docker >/dev/null 2>&1; }
|
|
|
|
|
has_compose() {
|
|
|
|
|
command -v podman-compose >/dev/null 2>&1 ||
|
|
|
|
|
{ has_podman && podman compose version >/dev/null 2>&1; } ||
|
|
|
|
|
{ has_docker && docker compose version >/dev/null 2>&1; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# ── podman installation ───────────────────────────────────────────────────
|
|
|
|
|
install_podman_compose_pip() {
|
|
|
|
|
if command -v pip3 >/dev/null 2>&1; then
|
|
|
|
|
warn "podman-compose not in package manager — trying pip3..."
|
|
|
|
|
pip3 install --quiet podman-compose
|
|
|
|
|
ok "podman-compose installed via pip3"
|
|
|
|
|
else
|
|
|
|
|
die "podman-compose not available. Install it manually: pip3 install podman-compose"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
install_podman_linux() {
|
|
|
|
|
if command -v apt-get >/dev/null 2>&1; then
|
|
|
|
|
info "installing podman via apt..."
|
|
|
|
|
apt-get update -qq
|
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y podman
|
|
|
|
|
apt-get install -y podman-compose 2>/dev/null || install_podman_compose_pip
|
|
|
|
|
|
|
|
|
|
elif command -v dnf >/dev/null 2>&1; then
|
|
|
|
|
info "installing podman via dnf..."
|
|
|
|
|
dnf install -y podman
|
|
|
|
|
dnf install -y podman-compose 2>/dev/null || install_podman_compose_pip
|
|
|
|
|
|
|
|
|
|
elif command -v yum >/dev/null 2>&1; then
|
|
|
|
|
info "installing podman via yum..."
|
|
|
|
|
yum install -y podman
|
|
|
|
|
yum install -y podman-compose 2>/dev/null || install_podman_compose_pip
|
|
|
|
|
|
|
|
|
|
elif command -v zypper >/dev/null 2>&1; then
|
|
|
|
|
info "installing podman via zypper..."
|
|
|
|
|
zypper --non-interactive install podman
|
|
|
|
|
zypper --non-interactive install podman-compose 2>/dev/null || install_podman_compose_pip
|
|
|
|
|
|
|
|
|
|
elif command -v pacman >/dev/null 2>&1; then
|
|
|
|
|
info "installing podman via pacman..."
|
|
|
|
|
pacman -Sy --noconfirm podman
|
|
|
|
|
pacman -S --noconfirm podman-compose 2>/dev/null || install_podman_compose_pip
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
die "no supported package manager (apt/dnf/yum/zypper/pacman).\nInstall podman manually: https://podman.io/docs/installation"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
install_podman_macos() {
|
|
|
|
|
if ! command -v brew >/dev/null 2>&1; then
|
|
|
|
|
die "Homebrew not found. Install it first:\n\n /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
|
|
|
|
|
fi
|
|
|
|
|
info "installing podman via Homebrew..."
|
|
|
|
|
brew install podman
|
|
|
|
|
brew install podman-compose 2>/dev/null || install_podman_compose_pip
|
|
|
|
|
|
|
|
|
|
info "initializing podman machine..."
|
|
|
|
|
if podman machine list 2>/dev/null | grep -q "Currently running"; then
|
|
|
|
|
ok "podman machine already running"
|
|
|
|
|
else
|
|
|
|
|
podman machine init --now 2>/dev/null || {
|
|
|
|
|
# machine already exists — just start it
|
|
|
|
|
podman machine start 2>/dev/null || true
|
|
|
|
|
}
|
|
|
|
|
ok "podman machine started"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# ── check / install runtime ───────────────────────────────────────────────
|
|
|
|
|
if has_podman && has_compose; then
|
|
|
|
|
ok "podman is already installed ($(podman --version))"
|
|
|
|
|
elif has_docker && has_compose; then
|
|
|
|
|
ok "docker is already installed — using docker compose"
|
|
|
|
|
else
|
|
|
|
|
if has_podman; then
|
|
|
|
|
warn "podman found but no compose runtime — installing podman-compose..."
|
|
|
|
|
install_podman_compose_pip
|
|
|
|
|
else
|
|
|
|
|
info "no container runtime found — installing Podman..."
|
|
|
|
|
if [[ "$PLATFORM" == "linux" ]]; then
|
|
|
|
|
install_podman_linux
|
|
|
|
|
else
|
|
|
|
|
install_podman_macos
|
|
|
|
|
fi
|
|
|
|
|
ok "Podman installed ($(podman --version))"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
has_compose || die "no compose runtime available after installation. Report this at https://github.com/primatekuntech/triton-install/issues"
|
|
|
|
|
|
|
|
|
|
# ── download installer files ──────────────────────────────────────────────
|
|
|
|
|
info "downloading manage-server installer to ${INSTALL_DIR}..."
|
|
|
|
|
mkdir -p "$INSTALL_DIR"
|
|
|
|
|
|
|
|
|
|
for f in "${INSTALLER_FILES[@]}"; do
|
|
|
|
|
curl -fsSL "${REPO_BASE}/${f}" -o "${INSTALL_DIR}/${f}"
|
|
|
|
|
done
|
|
|
|
|
chmod +x "${INSTALL_DIR}/install.sh" "${INSTALL_DIR}/upgrade.sh" "${INSTALL_DIR}/uninstall.sh"
|
|
|
|
|
ok "installer files saved to ${INSTALL_DIR}"
|
|
|
|
|
|
|
|
|
|
# ── hand off ─────────────────────────────────────────────────────────────
|
|
|
|
|
echo ""
|
2026-05-19 19:11:35 +08:00
|
|
|
exec bash "${INSTALL_DIR}/install.sh" "${PASSTHROUGH[@]}"
|