51 lines
1.7 KiB
Bash
51 lines
1.7 KiB
Bash
#!/bin/bash
|
|
# setup.sh - Complete Docker setup for Project Defrag
|
|
|
|
set -e
|
|
|
|
echo "🚀 Setting up Project Defrag with Docker..."
|
|
|
|
# 1. Create necessary directories
|
|
echo "📁 Creating directories..."
|
|
mkdir -p {config,plans,logs,reports,sql/migrations}
|
|
|
|
# 2. Copy environment file
|
|
if [ ! -f .env ]; then
|
|
echo "⚙️ Creating .env file from template..."
|
|
cp .env.example .env
|
|
echo "⚠️ Please edit .env file with your configuration!"
|
|
fi
|
|
|
|
# 3. Build the Docker image
|
|
echo "🐳 Building Docker image..."
|
|
docker compose build app
|
|
|
|
# 4. Start the database
|
|
#echo "🗄️ Starting PostgreSQL database..."
|
|
#docker-compose up -d postgres
|
|
|
|
# 5. Wait for database to be ready
|
|
#echo "⏳ Waiting for database to be ready..."
|
|
#sleep 10
|
|
|
|
# 6. Run database initialization
|
|
#echo "📊 Initializing database..."
|
|
#docker-compose exec -T postgres psql -U disk_reorg_user -d disk_reorganizer_db -f /docker-entrypoint-initdb.d/init.sql
|
|
|
|
# 7. Start optional services
|
|
echo "🔧 Starting monitoring services..."
|
|
docker compose --profile monitoring up -d
|
|
|
|
echo "✅ Setup complete!"
|
|
echo ""
|
|
echo "📋 Available commands:"
|
|
echo " docker compose up -d # Start all services"
|
|
echo " docker compose --profile index-only up index # Run index only"
|
|
echo " docker compose --profile plan-only up plan # Generate plan"
|
|
echo " docker compose --profile dry-run-only up dry-run # Dry run"
|
|
echo " docker compose --profile execute-only up execute # Execute migration"
|
|
echo " docker compose --profile report-only up report # Generate report"
|
|
echo ""
|
|
echo "🌐 Access monitoring:"
|
|
echo " - PostgreSQL Admin: http://localhost:5050"
|
|
echo " - Redis Commander: http://localhost:8081" |