#!/bin/bash ################################################################################ # AI-Impress Complete Server Report Generator - Master Script # Version: 5.0.0 - Modular Architecture # Generates comprehensive server report from individual modules ################################################################################ set -euo pipefail # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' CYAN='\033[0;36m' NC='\033[0m' REPORT_DIR="/opt/infrastructure-docs/reports" MODULE_DIR="/opt/infrastructure-docs/scripts/modules" TIMESTAMP=$(date +%Y%m%d-%H%M%S) REPORT_FILE="$REPORT_DIR/complete-server-report-$TIMESTAMP.md" mkdir -p "$REPORT_DIR" log() { echo -e "${CYAN}[$(date +%H:%M:%S)]${NC} $1"; } success() { echo -e "${GREEN}✅ $1${NC}"; } error() { echo -e "${RED}❌ $1${NC}"; exit 1; } log "╔════════════════════════════════════════════════════════════╗" log "║ AI-Impress Complete Server Report Generator v5.0 ║" log "║ Modular Architecture - Full System Report ║" log "╚════════════════════════════════════════════════════════════╝" log "" # Check modules exist if [[ ! -d "$MODULE_DIR" ]]; then error "Module directory not found: $MODULE_DIR" fi MODULES=( "generate-summary.sh" "generate-services.sh" "generate-websites.sh" "generate-databases.sh" "generate-storage.sh" "generate-networks.sh" "generate-guides.sh" ) log "Checking modules..." for module in "${MODULES[@]}"; do if [[ ! -f "$MODULE_DIR/$module" ]]; then error "Module missing: $module" fi chmod +x "$MODULE_DIR/$module" done success "All modules found" log "" log "Generating report: $REPORT_FILE" log "" ################################################################################ # HEADER ################################################################################ cat > "$REPORT_FILE" << EOFHEADER # 📋 AI-Impress Complete Server Administration Report > **Generated:** $(date '+%Y-%m-%d %H:%M:%S') > **Server:** ai-impress-prod > **IP:** 51.89.231.46 > **Purpose:** Full system overview for administrators --- ## 📑 TABLE OF CONTENTS 1. [Quick Summary](#quick-summary) - System overview at a glance 2. [System Health](#system-health) - Critical services & websites status 3. [All Services](#all-services) - Docker containers inventory 4. [Websites & Access](#websites--access) - URLs and authentication 5. [Databases](#databases) - Database management & backups 6. [Storage & Backups](#storage--backups) - Disk usage and backup status 7. [Networks](#networks) - Docker networking configuration 8. [Secrets & Passwords](#secrets--passwords) - Vault access & structure 9. [How To Guides](#how-to-guides) - Common administrative tasks 10. [Troubleshooting](#troubleshooting) - Fix common problems 11. [System Architecture](#system-architecture) - System design & dependencies --- EOFHEADER ################################################################################ # GENERATE EACH MODULE ################################################################################ log "Module 1/7: Quick Summary + System Health..." bash "$MODULE_DIR/generate-summary.sh" >> "$REPORT_FILE" 2>/dev/null || { error "Failed to generate summary module" } success "Summary + Health complete" log "Module 2/7: All Services..." bash "$MODULE_DIR/generate-services.sh" >> "$REPORT_FILE" 2>/dev/null || { error "Failed to generate services module" } success "Services complete" log "Module 3/7: Websites & Access..." bash "$MODULE_DIR/generate-websites.sh" >> "$REPORT_FILE" 2>/dev/null || { error "Failed to generate websites module" } success "Websites complete" log "Module 4/7: Databases..." bash "$MODULE_DIR/generate-databases.sh" >> "$REPORT_FILE" 2>/dev/null || { error "Failed to generate databases module" } success "Databases complete" log "Module 5/7: Storage & Backups..." bash "$MODULE_DIR/generate-storage.sh" >> "$REPORT_FILE" 2>/dev/null || { error "Failed to generate storage module" } success "Storage complete" log "Module 6/7: Networks..." bash "$MODULE_DIR/generate-networks.sh" >> "$REPORT_FILE" 2>/dev/null || { error "Failed to generate networks module" } success "Networks complete" log "Module 7/7: Guides & Architecture..." bash "$MODULE_DIR/generate-guides.sh" >> "$REPORT_FILE" 2>/dev/null || { error "Failed to generate guides module" } sed -i "s/TIMESTAMP_PLACEHOLDER/$(date '+%Y-%m-%d %H:%M:%S')/g" "$REPORT_FILE" success "Guides complete" ################################################################################ # FINALIZE ################################################################################ log "" log "Report generation complete!" log "" # Get report stats REPORT_SIZE=$(du -h "$REPORT_FILE" | cut -f1) LINE_COUNT=$(wc -l < "$REPORT_FILE") WORD_COUNT=$(wc -w < "$REPORT_FILE") cat << EOFSTATS ╔════════════════════════════════════════════════════════════╗ ║ 📊 REPORT STATISTICS ║ ╠════════════════════════════════════════════════════════════╣ ║ File: $(basename "$REPORT_FILE") ║ Size: $REPORT_SIZE ║ Lines: $LINE_COUNT ║ Words: $WORD_COUNT ║ Location: $REPORT_FILE ╚════════════════════════════════════════════════════════════╝ ✅ Full server report generated successfully! 📖 View report: cat $REPORT_FILE | less 📤 Upload to Outline: /opt/05-backups/scripts/upload-to-outline.sh latest-report EOFSTATS exit 0