-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
·53 lines (44 loc) · 1.26 KB
/
Copy pathinit.sh
File metadata and controls
executable file
·53 lines (44 loc) · 1.26 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
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
echo "=== NightMend Init ==="
# Check prerequisites
command -v docker >/dev/null 2>&1 || { echo "❌ docker not found"; exit 1; }
command -v docker compose >/dev/null 2>&1 || { echo "❌ docker compose not found"; exit 1; }
# Create .env if not exists
if [ ! -f .env ]; then
cp .env.example .env
echo "📋 Created .env from .env.example — please review settings"
fi
# Start services
echo "🚀 Starting services..."
docker compose up -d --build
# Wait for health
echo "⏳ Waiting for services..."
for i in $(seq 1 30); do
if docker compose exec -T postgres pg_isready -U nightmend >/dev/null 2>&1; then
echo "✅ PostgreSQL ready"
break
fi
sleep 1
done
for i in $(seq 1 30); do
if docker compose exec -T redis redis-cli ping >/dev/null 2>&1; then
echo "✅ Redis ready"
break
fi
sleep 1
done
# Health check backend
for i in $(seq 1 30); do
if curl -sf http://localhost:8000/health >/dev/null 2>&1; then
echo "✅ Backend ready"
break
fi
sleep 2
done
echo ""
echo "🎉 NightMend is running!"
echo " Frontend: http://localhost:3001"
echo " Backend: http://localhost:8001"
echo " API Docs: http://localhost:8001/docs"