#!/bin/sh # GoAccess real-time dashboard script # Serves metrics dashboard on port 7890 with WebSocket support echo "Starting GoAccess setup..." # Wait for nginx to start and create logs sleep 10 # Create log directory if it doesn't exist mkdir -p /var/log/nginx # Create HTML output directory mkdir -p /usr/share/nginx/html/goaccess # Create a dummy access log if it doesn't exist touch /var/log/nginx/access.log echo "Starting GoAccess..." # Use static HTML generation for lower memory usage # Generate every 60 seconds to reduce memory pressure echo "Starting GoAccess with low-memory static mode..." while true; do goaccess /var/log/nginx/access.log \ --log-format='%h - %^ [%d:%t %^] "%r" %s %b "%R" "%u" rt=%T uct=%^ uht=%^ urt=%^' \ --date-format='%d/%b/%Y' \ --time-format='%H:%M:%S' \ --output=/usr/share/nginx/html/goaccess/index.html echo "Generated static report at $(date)" sleep 60 done & GOACCESS_PID=$! echo "GoAccess static generator started with PID: $GOACCESS_PID"