-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·64 lines (51 loc) · 1.33 KB
/
deploy.sh
File metadata and controls
executable file
·64 lines (51 loc) · 1.33 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
#!/usr/bin/env bash
# deploy.sh
set -euo pipefail
echo "🚀 GrantFlow Production Deployment"
echo "=================================="
# Проверка Docker
if ! command -v docker >/dev/null 2>&1; then
echo "❌ Docker not installed"
exit 1
fi
compose() {
if command -v docker-compose >/dev/null 2>&1; then
docker-compose "$@"
return
fi
if docker compose version >/dev/null 2>&1; then
docker compose "$@"
return
fi
echo "❌ docker-compose (or 'docker compose') not installed"
exit 1
}
# Проверка .env
if [ ! -f .env ]; then
echo "⚠️ .env not found, copying from .env.example"
cp .env.example .env
echo " Please edit .env with your API keys"
fi
echo "✅ Pre-flight checks passed"
# Сборка
echo "📦 Building Docker image..."
compose build
# Запуск
echo "🏃 Starting services..."
compose up -d
# Проверка здоровья
echo "⏳ Waiting for services to start..."
sleep 10
echo "🏥 Checking health..."
curl -fsS http://localhost:8000/health || {
echo "❌ Health check failed"
compose logs api
exit 1
}
echo ""
echo "✅ Deployment complete!"
echo " API: http://localhost:8000"
echo " Docs: http://localhost:8000/docs"
echo ""
echo "📊 View logs: docker compose logs -f"
echo "🛑 Stop: docker compose down"