- Added multi-platform deployment architecture details (Web App, PWA, DApp) to README.md. - Included comprehensive troubleshooting guides and fix scripts in README.md. - Enhanced CHANGELOG.md with new features, fixes, and improvements, including TypeScript error resolutions and updated documentation structure. - Revised development setup instructions in DEV_SETUP.md to reflect changes in script usage and environment variable setup.
70 lines
2.2 KiB
Bash
70 lines
2.2 KiB
Bash
#!/bin/bash
|
||
# Database Setup Script
|
||
|
||
echo -e "\n========================================"
|
||
echo -e " DATABASE SETUP"
|
||
echo -e "========================================\n"
|
||
|
||
# Check if Docker is available
|
||
if ! command -v docker &> /dev/null; then
|
||
echo -e "\033[0;31m❌ Docker not found\033[0m"
|
||
echo -e " Please install Docker or set up PostgreSQL manually"
|
||
echo -e " See docs/DATABASE_OPTIONS.md for manual setup instructions"
|
||
exit 1
|
||
fi
|
||
|
||
echo -e "\033[0;32m✅ Docker found\033[0m"
|
||
|
||
# Check if container already exists
|
||
if docker ps -a --filter "name=combo-postgres" --format "{{.Names}}" | grep -q "combo-postgres"; then
|
||
echo -e "\n📦 Existing container found: combo-postgres"
|
||
|
||
# Check if running
|
||
if docker ps --filter "name=combo-postgres" --format "{{.Names}}" | grep -q "combo-postgres"; then
|
||
echo -e "\033[0;32m✅ Container is already running\033[0m"
|
||
else
|
||
echo -e "🔄 Starting existing container..."
|
||
docker start combo-postgres
|
||
sleep 3
|
||
fi
|
||
else
|
||
echo -e "\n📦 Creating new PostgreSQL container..."
|
||
docker run --name combo-postgres \
|
||
-e POSTGRES_PASSWORD=postgres \
|
||
-e POSTGRES_DB=comboflow \
|
||
-p 5432:5432 \
|
||
-d postgres:15
|
||
|
||
echo -e "⏳ Waiting for database to initialize..."
|
||
sleep 5
|
||
fi
|
||
|
||
# Verify connection
|
||
echo -e "\n🔍 Verifying database connection..."
|
||
sleep 3
|
||
|
||
if nc -z localhost 5432 2>/dev/null; then
|
||
echo -e "\033[0;32m✅ PostgreSQL is running on port 5432\033[0m"
|
||
|
||
# Test connection
|
||
if docker exec combo-postgres psql -U postgres -d comboflow -c "SELECT 1;" > /dev/null 2>&1; then
|
||
echo -e "\033[0;32m✅ Database connection successful\033[0m"
|
||
else
|
||
echo -e "\033[0;33m⚠️ Connection test failed\033[0m"
|
||
fi
|
||
else
|
||
echo -e "\033[0;31m❌ PostgreSQL is not listening on port 5432\033[0m"
|
||
echo -e " Check container logs: docker logs combo-postgres"
|
||
exit 1
|
||
fi
|
||
|
||
echo -e "\n\033[0;36m📝 Next steps:\033[0m"
|
||
echo -e " 1. Update orchestrator/.env with:"
|
||
echo -e " DATABASE_URL=postgresql://postgres:postgres@localhost:5432/comboflow"
|
||
echo -e " RUN_MIGRATIONS=true"
|
||
echo -e "\n 2. Run migrations:"
|
||
echo -e " cd orchestrator"
|
||
echo -e " npm run migrate"
|
||
echo ""
|
||
|