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
+55
View File
@@ -36,6 +36,61 @@ echo -e "User: ${GREEN}$DB_USER${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
# Check for docker-compose or docker compose
if ! command -v docker-compose >/dev/null 2>&1 && ! docker compose version >/dev/null 2>&1; then
missing_deps+=("docker-compose")
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}Would you like to run the dependency installer? (y/n)${NC}"
read -r response
if [[ "$response" =~ ^[Yy]$ ]]; then
if [ -f "$SCRIPT_DIR/install-dependencies.sh" ]; then
chmod +x "$SCRIPT_DIR/install-dependencies.sh"
"$SCRIPT_DIR/install-dependencies.sh"
echo ""
echo -e "${GREEN}Dependencies installed. Please re-run this script.${NC}"
exit 0
else
echo -e "${RED}✗ install-dependencies.sh not found${NC}"
echo -e "${YELLOW}Please install the following manually:${NC}"
for dep in "${missing_deps[@]}"; do
echo -e " - $dep"
done
exit 1
fi
else
echo -e "${RED}✗ Cannot proceed without required dependencies${NC}"
exit 1
fi
fi
echo -e "${GREEN}✓ All required dependencies are installed${NC}"
echo ""
}
# Run dependency check
check_dependencies
# Function to execute SQL command
execute_sql() {
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME -c "$1" 2>&1