Files
RustProxy/docker-agent/install.sh
T
gru eba9f89283 v0.35.1: performance, AGPL licensing and documentation overhaul
- Web Server reads static files inline; proxy middleware chain flattened
- About window with license summary and project links; AGPL-3.0-or-later
- Rewritten documentation: feature list, screenshots, performance guide
- Fix false spikes in per-Vhost request-rate charts
2026-11-05 18:29:56 +01:00

41 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
if [[ ${EUID:-$(id -u)} -ne 0 ]]; then
echo "Run as root: sudo ./install.sh" >&2
exit 2
fi
command -v go >/dev/null 2>&1 || { echo "Go is required to build the agent." >&2; exit 2; }
command -v systemctl >/dev/null 2>&1 || { echo "systemd is required." >&2; exit 2; }
getent group docker >/dev/null 2>&1 || { echo "Docker group not found; install Docker first." >&2; exit 2; }
ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' EXIT
cd "$ROOT"
go test ./...
go build -trimpath -ldflags='-s -w' -o "$TMP/rustproxy-docker-agent" .
if ! id rustproxy-docker-agent >/dev/null 2>&1; then
useradd --system --no-create-home --shell /usr/sbin/nologin --gid docker rustproxy-docker-agent
else
usermod -a -G docker rustproxy-docker-agent
fi
install -m 0755 "$TMP/rustproxy-docker-agent" /usr/local/bin/rustproxy-docker-agent
install -d -m 0750 /etc/rustproxy
install -d -o rustproxy-docker-agent -g docker -m 0750 /var/lib/rustproxy-docker-agent
if [[ ! -f /etc/rustproxy/docker-agent.env ]]; then
install -m 0600 docker-agent.env.example /etc/rustproxy/docker-agent.env
fi
# Provisioning is delegated to the Go CLI, which keeps existing credentials.
/usr/local/bin/rustproxy-docker-agent init
install -m 0644 rustproxy-docker-agent.service /etc/systemd/system/rustproxy-docker-agent.service
systemctl daemon-reload
systemctl enable --now rustproxy-docker-agent.service
systemctl --no-pager --full status rustproxy-docker-agent.service || true
printf '\nAgent endpoint, TLS certificate details and Bearer token (sensitive):\n'
/usr/local/bin/rustproxy-docker-agent info --show-token
printf '\nInstalled. Configure RustProxy -> Settings -> Docker agents with the HTTPS endpoint, token and SHA-256 fingerprint above.\n'