-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·115 lines (99 loc) · 2.86 KB
/
setup.sh
File metadata and controls
executable file
·115 lines (99 loc) · 2.86 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
# AI Society D&D - Setup Script
# ==============================
# This script helps you get started quickly
set -e
echo "=================================="
echo "AI Society D&D - Setup Script"
echo "=================================="
echo ""
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed!"
echo " Please install Docker first: https://docs.docker.com/get-docker/"
exit 1
fi
echo "✓ Docker found"
# Check if docker-compose is installed
if ! command -v docker-compose &> /dev/null; then
echo "❌ Docker Compose is not installed!"
echo " Please install Docker Compose: https://docs.docker.com/compose/install/"
exit 1
fi
echo "✓ Docker Compose found"
# Check if .env exists
if [ ! -f .env ]; then
echo ""
echo "📝 Creating .env file..."
cp .env.example .env
echo "✓ Created .env file"
echo ""
echo "⚠️ IMPORTANT: Please edit .env and add your OpenAI API key!"
echo " Run: nano .env"
echo " Add: OPENAI_API_KEY=sk-your-key-here"
echo ""
read -p "Press Enter when you've added your API key..."
fi
# Check if API key is set
if ! grep -q "OPENAI_API_KEY=sk-" .env; then
echo ""
echo "⚠️ Warning: OpenAI API key may not be set correctly in .env"
echo " Make sure it starts with 'sk-'"
echo ""
fi
echo ""
echo "🐳 Starting Docker services..."
echo ""
# Start services
docker-compose up -d
echo ""
echo "⏳ Waiting for services to be ready..."
sleep 5
# Check if services are running
if docker-compose ps | grep -q "Up"; then
echo "✓ Services are running!"
else
echo "❌ Services failed to start"
echo " Check logs: docker-compose logs"
exit 1
fi
echo ""
echo "🔍 Checking API health..."
# Try to hit the health endpoint
if curl -s http://localhost:8000/health > /dev/null; then
echo "✓ API is healthy!"
else
echo "⚠️ API is starting up... (this is normal)"
echo " Give it a few more seconds"
fi
echo ""
echo "=================================="
echo "✅ Setup Complete!"
echo "=================================="
echo ""
echo "🎮 What to do next:"
echo ""
echo "1. Run the demo:"
echo " python3 demo.py"
echo ""
echo "2. Try the API:"
echo " curl http://localhost:8000/health"
echo ""
echo "3. Create a campaign:"
echo " curl -X POST http://localhost:8000/campaigns/create \\"
echo " -H 'Content-Type: application/json' \\"
echo " -d '{\"campaign_name\": \"Test\", \"dm_id\": \"me\"}'"
echo ""
echo "4. View logs:"
echo " docker-compose logs -f"
echo ""
echo "5. Stop services:"
echo " docker-compose down"
echo ""
echo "📚 Documentation:"
echo " • START_HERE.md - Overview"
echo " • QUICKSTART.md - Quick commands"
echo " • README.md - Full documentation"
echo ""
echo "🚀 Your D&D system is ready to use!"
echo "=================================="