Add automatic dependency installer and package checks

DEPENDENCY MANAGEMENT:
- Created scripts/install-dependencies.sh - automatic installer for all required packages
- Detects OS (Ubuntu, Debian, CentOS, RHEL, Fedora, Arch, macOS)
- Installs PostgreSQL client (psql) automatically
- Installs Docker & Docker Compose if missing
- Installs utility packages (curl, wget, git)

SCRIPT ENHANCEMENTS:
- Updated setup-database.sh with dependency checking
- Updated generate_data.sh with dependency checking
- Updated verify-setup.sh with dependency checking
- All scripts now prompt to run installer if dependencies are missing
- Interactive prompts guide users through installation

DOCUMENTATION:
- Updated README.md with dependency installation instructions
- Updated QUICKSTART.md with Step 0: Install Dependencies
- Added supported OS list
- Added automatic dependency check notes

USER EXPERIENCE:
- No more manual package installation required
- Scripts fail gracefully with helpful error messages
- One-command installation: ./scripts/install-dependencies.sh
- Automatic detection and installation on Linux/macOS
- Clear instructions for Windows users

This ensures users can get started immediately without hunting for package installation commands.
This commit is contained in:
Alphaeus Mote
2025-10-23 14:34:11 -04:00
parent aa803bd3bd
commit 3dde2997f6
6 changed files with 484 additions and 5 deletions
+32
View File
@@ -22,11 +22,43 @@ DB_NAME="${POSTGRES_DB:-business_analytics}"
DB_USER="${POSTGRES_USER:-data_analyst}"
DB_PASSWORD="${POSTGRES_PASSWORD:-SecurePass123!}"
# Script directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo -e "${BLUE}============================================================================${NC}"
echo -e "${BLUE}Business Analytics Database - Verification${NC}"
echo -e "${BLUE}============================================================================${NC}"
echo ""
# Check for required dependencies
check_dependencies() {
local missing_deps=()
# Check for psql
if ! command -v psql >/dev/null 2>&1; then
missing_deps+=("psql (PostgreSQL client)")
fi
# Check for docker
if ! command -v docker >/dev/null 2>&1; then
missing_deps+=("docker")
fi
if [ ${#missing_deps[@]} -gt 0 ]; then
echo -e "${RED}✗ Missing required dependencies:${NC}"
for dep in "${missing_deps[@]}"; do
echo -e " - ${YELLOW}$dep${NC}"
done
echo ""
echo -e "${YELLOW}Run the dependency installer:${NC}"
echo -e " ${GREEN}./scripts/install-dependencies.sh${NC}"
exit 1
fi
}
# Run dependency check
check_dependencies
# Function to execute SQL and get result
execute_sql() {
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -t -c "$1" 2>/dev/null | xargs