Add clean deployment scripts for monitoring services
- setup-glances.sh: Install Glances with web interface and systemd service - setup-netdata.sh: Install Netdata without nginx configuration changes - deploy-netdata-config.sh: Complete Netdata deployment with privacy config - Remove redundant iterative scripts from troubleshooting process - Each script handles one specific deployment task cleanly
This commit is contained in:
51
scripts/deploy-netdata-config.sh
Executable file
51
scripts/deploy-netdata-config.sh
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Deploy Netdata configuration and nginx config for privacy-focused local monitoring
|
||||||
|
# Run with: sudo -A ./scripts/deploy-netdata-config.sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "=== Deploying Netdata privacy configuration ==="
|
||||||
|
cp /home/hoborg/homelab/config/netdata/netdata.conf /etc/netdata/netdata.conf
|
||||||
|
echo "✅ Netdata configured for local-only operation (no cloud/telemetry)"
|
||||||
|
|
||||||
|
echo "=== Backing up nginx config ==="
|
||||||
|
BACKUP_FILE="/etc/nginx/sites-available/homelab.backup.$(date +%Y%m%d-%H%M%S)"
|
||||||
|
cp /etc/nginx/sites-available/homelab "$BACKUP_FILE"
|
||||||
|
echo "Backup created: $BACKUP_FILE"
|
||||||
|
|
||||||
|
echo "=== Deploying nginx configuration with Netdata support ==="
|
||||||
|
cp /home/hoborg/homelab/config/nginx/homelab.conf /etc/nginx/sites-available/homelab
|
||||||
|
|
||||||
|
echo "=== Testing nginx configuration ==="
|
||||||
|
nginx -t
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "=== Restarting Netdata with new config ==="
|
||||||
|
systemctl restart netdata
|
||||||
|
|
||||||
|
echo "=== Reloading nginx ==="
|
||||||
|
systemctl reload nginx
|
||||||
|
|
||||||
|
echo "✅ Configuration deployed successfully!"
|
||||||
|
else
|
||||||
|
echo "❌ ERROR: Nginx configuration test failed!"
|
||||||
|
echo "Restoring backup..."
|
||||||
|
cp "$BACKUP_FILE" /etc/nginx/sites-available/homelab
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Testing Netdata access ==="
|
||||||
|
echo "Direct access: http://127.0.0.1:19999/"
|
||||||
|
curl -s -o /dev/null -w "Direct Netdata: HTTP %{http_code}\\n" http://127.0.0.1:19999/ || echo "Direct test failed"
|
||||||
|
|
||||||
|
echo "Reverse proxy access: https://ak-homelab.duckdns.org/netdata/"
|
||||||
|
curl -k -s -o /dev/null -w "Proxied Netdata: HTTP %{http_code}\\n" https://ak-homelab.duckdns.org/netdata/ || echo "Proxy test failed"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Netdata Privacy Configuration Complete! ==="
|
||||||
|
echo "✅ Cloud features disabled"
|
||||||
|
echo "✅ Telemetry disabled"
|
||||||
|
echo "✅ Local-only monitoring"
|
||||||
|
echo "✅ Accessible via: https://ak-homelab.duckdns.org/netdata/"
|
||||||
|
echo "✅ Basic auth: admin / AdminPass2024!"
|
||||||
28
scripts/setup-glances.sh
Executable file
28
scripts/setup-glances.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Install and configure Glances monitoring service
|
||||||
|
# Run with: sudo -A ./scripts/setup-glances.sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "=== Installing Glances monitoring service ==="
|
||||||
|
pacman -S --noconfirm glances python-fastapi uvicorn python-jinja
|
||||||
|
|
||||||
|
echo "=== Creating glances user ==="
|
||||||
|
useradd -r -s /bin/false glances 2>/dev/null || echo "User glances already exists"
|
||||||
|
|
||||||
|
echo "=== Deploying Glances systemd service ==="
|
||||||
|
cp /home/hoborg/homelab/config/systemd/glances-web.service /etc/systemd/system/
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
|
echo "=== Enabling and starting Glances service ==="
|
||||||
|
systemctl enable glances-web
|
||||||
|
systemctl start glances-web
|
||||||
|
|
||||||
|
echo "=== Checking Glances service status ==="
|
||||||
|
systemctl status glances-web --no-pager -l
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Glances installation complete! ==="
|
||||||
|
echo "Local access: http://127.0.0.1:61208/"
|
||||||
|
echo "External access: https://ak-homelab.duckdns.org/glances/ (requires nginx config)"
|
||||||
|
echo "Basic auth: admin / AdminPass2024!"
|
||||||
32
scripts/setup-netdata.sh
Executable file
32
scripts/setup-netdata.sh
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Install and configure Netdata monitoring service
|
||||||
|
# Run with: sudo -A ./scripts/setup-netdata.sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "=== Installing Netdata monitoring service ==="
|
||||||
|
pacman -S --noconfirm netdata
|
||||||
|
|
||||||
|
echo "=== Enabling and starting Netdata service ==="
|
||||||
|
systemctl enable netdata
|
||||||
|
systemctl start netdata
|
||||||
|
|
||||||
|
echo "=== Checking Netdata service status ==="
|
||||||
|
systemctl status netdata --no-pager -l
|
||||||
|
|
||||||
|
echo "=== Stopping and disabling Cockpit services ==="
|
||||||
|
systemctl stop cockpit cockpit.socket 2>/dev/null || echo "Cockpit services not running"
|
||||||
|
systemctl disable cockpit cockpit.socket 2>/dev/null || echo "Cockpit services not enabled"
|
||||||
|
|
||||||
|
echo "=== Deploying updated landing page ==="
|
||||||
|
cp /home/hoborg/homelab/config/www/index.html /var/www/homelab/
|
||||||
|
echo "✅ Landing page updated with Netdata link"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Netdata installation complete! ==="
|
||||||
|
echo "Local access: http://127.0.0.1:19999/"
|
||||||
|
echo "External access: https://ak-homelab.duckdns.org/netdata/ (after nginx config deploy)"
|
||||||
|
echo ""
|
||||||
|
echo "To deploy nginx config separately:"
|
||||||
|
echo "sudo cp /home/hoborg/homelab/config/nginx/homelab.conf /etc/nginx/sites-available/homelab"
|
||||||
|
echo "sudo nginx -t && sudo systemctl reload nginx"
|
||||||
Reference in New Issue
Block a user