-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
95 lines (82 loc) · 2.59 KB
/
Copy pathsetup.sh
File metadata and controls
95 lines (82 loc) · 2.59 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
#!/bin/bash
# Kernal Setup Script
# Quick setup for self-hosted deployment
set -e # Exit on error
echo "========================================="
echo " Kernal Setup - Open Source Memory API"
echo "========================================="
echo ""
# Check for Docker
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed. Please install Docker first:"
echo " https://docs.docker.com/get-docker/"
exit 1
fi
# Check for Docker Compose
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
echo "❌ Docker Compose is not installed. Please install Docker Compose first:"
echo " https://docs.docker.com/compose/install/"
exit 1
fi
echo "✅ Docker and Docker Compose are installed"
echo ""
# Check for .env file
if [ ! -f .env ]; then
echo "📝 Creating .env file from template..."
cp .env.example .env
echo "✅ Created .env file"
echo ""
echo "⚠️ IMPORTANT: Please edit .env and add your OPENAI_API_KEY"
echo " You can get an API key from: https://platform.openai.com/api-keys"
echo ""
read -p "Press Enter to continue after editing .env, or Ctrl+C to exit..."
else
echo "✅ .env file already exists"
fi
# Check if OPENAI_API_KEY is set
if grep -q "sk-your-openai-api-key-here" .env || ! grep -q "OPENAI_API_KEY=sk-" .env; then
echo ""
echo "⚠️ WARNING: OPENAI_API_KEY is not configured in .env"
echo " The service will not work without a valid OpenAI API key"
echo ""
read -p "Continue anyway? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Setup cancelled. Please add your OPENAI_API_KEY to .env and run this script again."
exit 1
fi
fi
echo ""
echo "🚀 Starting Kernal services..."
echo ""
# Start Docker Compose
docker-compose up -d
# Wait for services to be healthy
echo ""
echo "⏳ Waiting for services to start (this may take 30-60 seconds)..."
sleep 10
# Check service status
echo ""
echo "📊 Service Status:"
docker-compose ps
echo ""
echo "✅ Setup complete!"
echo ""
echo "🔑 To get your API key, run:"
echo " docker-compose logs memory-service | grep 'Default API Key'"
echo ""
echo "📚 API Documentation:"
echo " http://localhost:8000/docs"
echo ""
echo "🏥 Health Check:"
echo " curl http://localhost:8000/api/v1/health"
echo ""
echo "📖 View logs:"
echo " docker-compose logs -f"
echo ""
echo "🛑 Stop services:"
echo " docker-compose down"
echo ""
echo "========================================="
echo " Kernal is ready! Happy coding! 🎉"
echo "========================================="