Files
vpsmgr/oneclick.sh
T
bluebluesodaandCommandCodeBot 4c93ae4be3 feat(haproxy): replace Traefik with a pinned HAProxy domain proxy
The panel now fronts user domains with HAProxy 3.4 LTS (official performance
packages) instead of Traefik: about 100 MB of RSS and 200 MB of disk saved for
a feature set that never used more than Host routing on :80 and SNI passthrough
on :443.

- hpx: publish the proxy configuration as immutable GENERATIONS. Every domain
  mutation renders the whole set from the DB, validates it with the pinned
  `haproxy -c`, and only then repoints the `current` symlink, so a rejected
  candidate leaves the running proxy untouched and a stale domain can never
  survive into a later generation. Routing is carried by two map files
  (Host -> backend, SNI -> backend): per-domain frontend rules cannot work from
  a second file because HAProxy rejects duplicate section names since 3.3 and
  attaches bare directives to the section opened last.
- mgr: republish and reload (SIGUSR2, i.e. `systemctl reload`) after every
  domain change, so a change takes effect without dropping established HTTP or
  TLS connections. Rollback semantics (DB first, then publish) are unchanged.
- cfg,db: `net.traefik` is renamed to `net.haproxy` with identical values. A
  pre-rename config.yaml key and the legacy VPSMGR_TRAEFIK env var are still
  read (new name wins), and schema migration v18 moves the settings mirror from
  `traefik` to `haproxy`, keeping a newer value when both rows exist.
- 30-haproxy.sh: install the pinned branch from the vendor repository and
  migrate a Traefik host in one run — install and validate HAProxy first, then
  remove Traefik's binary, unit, service account and dynamic rules (only its
  config file is kept, inert). No fallback keeps both proxies alive.
- upgrade-haproxy.sh: follow the pinned branch to its newest patch, with a
  configuration check and a graceful reload; `install.sh --update` runs it.
- tests: generation publish/rollback, map rendering, config-key and settings
  migrations, plus real-binary tests (skipped unless
  VPSMGR_TEST_HAPROXY_BIN is set) that run the generated configuration through
  `haproxy -c` and start it in a network namespace.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
2026-09-16 12:59:13 +00:00

53 lines
1.9 KiB
Bash

#!/usr/bin/env bash
# vpsmgr oneclick.sh — gitless one-shot installer.
# Downloads the repo as a tarball (no git needed on the host), runs install.sh,
# then removes the extracted directory on exit so nothing is left behind.
#
# Usage:
# bash <(curl -fsSL https://raw.githubusercontent.com/bluebluesoda/vpsmgr/refs/heads/main/oneclick.sh)
# bash <(curl -fsSL https://raw.githubusercontent.com/bluebluesoda/vpsmgr/refs/heads/main/oneclick.sh) --update
#
# Supported args (passed straight through to install.sh):
# --update re-download the latest prebuilt release binary over an
# existing one, and follow the pinned HAProxy branch to its
# newest patch (the panel and the domain proxy move together)
# --local-build force local Go compilation of the panel binary
# --disable-v4forward install with IPv4 inbound forwarding disabled
# Env:
# VPSMGR_STORAGE=zfs|btrfs|dir storage backend (default zfs)
# VPSMGR_BRANCH=<branch> branch/tag to fetch (default main)
set -euo pipefail
if [[ $EUID -ne 0 ]]; then
echo "error: must run as root (sudo bash ...)" >&2
exit 1
fi
REPO="bluebluesoda/vpsmgr"
BRANCH="${VPSMGR_BRANCH:-main}"
# The installer may reclaim /tmp and /var/tmp when disk space is tight.
# Keep the active checkout outside those directories until installation ends.
WORKDIR="$(mktemp -d /var/lib/vpsmgr-oneclick.XXXXXX)"
cleanup() {
rm -rf "$WORKDIR"
}
trap cleanup EXIT
ARGS=()
for a in "$@"; do
case "$a" in
--update|--local-build|--disable-v4forward) ARGS+=("$a") ;;
*) echo "oneclick.sh: ignoring unknown arg '$a'" >&2 ;;
esac
done
echo "==> downloading $REPO@$BRANCH (gitless) into $WORKDIR"
curl -fsSL "https://codeload.github.com/$REPO/tar.gz/refs/heads/$BRANCH" \
| tar -xz --strip-components=1 -C "$WORKDIR"
echo "==> starting installer ${ARGS[*]:-}"
bash "$WORKDIR/install.sh" "${ARGS[@]:-}"
echo "==> install finished; temp dir $WORKDIR will be removed on exit"