-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_dev.sh
More file actions
executable file
·71 lines (59 loc) · 2.05 KB
/
Copy pathstart_dev.sh
File metadata and controls
executable file
·71 lines (59 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# Development startup script for Flashcard Learning System
# This script starts the development environment with Docker Compose
set -e
echo "🚀 Starting Flashcard Learning System Development Environment..."
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
echo "❌ Docker is not running. Please start Docker and try again."
exit 1
fi
# Check if .env file exists
if [ ! -f .env ]; then
echo "📝 Creating .env file from .env.example..."
cp .env.example .env
echo "✅ Please edit .env file with your configuration before running again."
exit 0
fi
# Create backend .env if it doesn't exist
if [ ! -f backend/.env ]; then
echo "📝 Creating backend/.env file..."
cp backend/.env.example backend/.env
fi
# Build and start services
echo "🔨 Building and starting services..."
docker-compose up --build -d
# Wait for services to be healthy
echo "⏳ Waiting for services to be ready..."
sleep 10
# Check service health
echo "🏥 Checking service health..."
# Check PostgreSQL
if docker-compose exec postgres pg_isready -U flashcard_user -d flashcard_db > /dev/null 2>&1; then
echo "✅ PostgreSQL is ready"
else
echo "❌ PostgreSQL is not ready"
fi
# Check Backend
if curl -f http://localhost:8000/health > /dev/null 2>&1; then
echo "✅ Backend API is ready"
else
echo "❌ Backend API is not ready"
fi
echo ""
echo "🎉 Development environment is running!"
echo ""
echo "📊 Services:"
echo " • Backend API: http://localhost:8000"
echo " • API Documentation: http://localhost:8000/docs"
echo " • Frontend: http://localhost:5173"
echo " • Database: localhost:5432"
echo " • pgAdmin: http://localhost:5050 (run with --profile tools)"
echo ""
echo "🔧 Useful commands:"
echo " • View logs: docker-compose logs -f"
echo " • Stop services: docker-compose down"
echo " • Restart services: docker-compose restart"
echo " • Shell into backend: docker-compose exec backend bash"
echo " • Database shell: docker-compose exec postgres psql -U flashcard_user -d flashcard_db"
echo ""