feat: add Pi monitoring stack with deployment scripts and architecture documentation

This commit is contained in:
S
2026-03-02 21:12:24 -05:00
parent ca4f4924b6
commit 780748083f
16 changed files with 1106 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# shellcheck source=./lib.sh
source "$SCRIPT_DIR/lib.sh"
HOST=""
USER_NAME=""
SSH_PORT="22"
AGENT_IMAGE="portainer/agent:latest"
AUTO_YES=false
usage() {
cat <<USAGE
Usage: $(basename "$0") --host=IP --user=NAME [options]
Install or refresh Portainer Agent on a remote Docker host (Fedora/Unraid).
Options:
--host=IP Remote host IP or hostname
--user=NAME SSH username
--port=PORT SSH port (default: 22)
--agent-image=I Portainer agent image (default: portainer/agent:latest)
--yes, -y Skip confirmation prompt
--help, -h Show help
Example:
$(basename "$0") --host=192.168.1.90 --user=admin --port=22
USAGE
}
for arg in "$@"; do
case "$arg" in
--host=*) HOST="${arg#*=}" ;;
--user=*) USER_NAME="${arg#*=}" ;;
--port=*) SSH_PORT="${arg#*=}" ;;
--agent-image=*) AGENT_IMAGE="${arg#*=}" ;;
--yes|-y) AUTO_YES=true ;;
--help|-h) usage; exit 0 ;;
*) log_error "Unknown argument: $arg"; usage; exit 1 ;;
esac
done
require_cmd ssh
if [[ -z "$HOST" || -z "$USER_NAME" ]]; then
log_error "--host and --user are required"
usage
exit 1
fi
if ! confirm_action "Install/update Portainer Agent on ${USER_NAME}@${HOST}?" "$AUTO_YES"; then
log_info "Cancelled"
exit 0
fi
if [[ -z "$AGENT_IMAGE" ]]; then
log_error "Agent image cannot be empty"
exit 1
fi
ssh -p "$SSH_PORT" "$USER_NAME@$HOST" '
set -euo pipefail
docker rm -f portainer_agent >/dev/null 2>&1 || true
docker run -d \
--name portainer_agent \
--restart=unless-stopped \
-p 9001:9001 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/docker/volumes:/var/lib/docker/volumes \
-v /:/host \
'"$AGENT_IMAGE"'
'
log_success "Portainer Agent running on $HOST:9001"
log_info "Add endpoint in Portainer: tcp://$HOST:9001"