-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·130 lines (113 loc) · 4.41 KB
/
setup.sh
File metadata and controls
executable file
·130 lines (113 loc) · 4.41 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
# AutoOps Setup Script
# This script helps you set up the AutoOps development environment
set -e # Exit on any error
echo "🤖 AutoOps Setup Script"
echo "======================="
# Check Python version
python_version=$(python3 --version 2>&1 | awk '{print $2}' | cut -d. -f1,2)
required_version="3.9"
if [ "$(printf '%s\n' "$required_version" "$python_version" | sort -V | head -n1)" = "$required_version" ]; then
echo "✅ Python $python_version is compatible"
else
echo "❌ Python $python_version is not compatible. Please install Python 3.9 or higher"
exit 1
fi
# Check if we're in a virtual environment
if [[ "$VIRTUAL_ENV" != "" ]]; then
echo "✅ Virtual environment detected: $VIRTUAL_ENV"
else
echo "⚠️ No virtual environment detected. Creating one..."
python3 -m venv venv
source venv/bin/activate
echo "✅ Virtual environment created and activated"
fi
# Install dependencies
echo "📦 Installing Python dependencies..."
pip install --upgrade pip
# Try minimal requirements first
if pip install -r requirements-minimal.txt; then
echo "✅ Minimal dependencies installed successfully"
echo "📋 To install additional monitoring and development tools, run:"
echo " pip install -r requirements.txt"
else
echo "❌ Failed to install minimal dependencies"
echo "🔄 Trying individual package installation..."
# Install core packages individually
pip install "langgraph>=0.1.0" || echo "⚠️ langgraph installation failed"
pip install "langchain>=0.1.0" || echo "⚠️ langchain installation failed"
pip install "langchain-openai>=0.1.0" || echo "⚠️ langchain-openai installation failed"
pip install "openai>=1.0.0" || echo "⚠️ openai installation failed"
pip install "kubernetes>=28.0.0" || echo "⚠️ kubernetes installation failed"
pip install "fastapi>=0.104.0" || echo "⚠️ fastapi installation failed"
pip install "uvicorn[standard]>=0.24.0" || echo "⚠️ uvicorn installation failed"
pip install "redis>=5.0.0" || echo "⚠️ redis installation failed"
pip install "click>=8.1.0" || echo "⚠️ click installation failed"
pip install "python-dotenv>=1.0.0" || echo "⚠️ python-dotenv installation failed"
fi
# Create necessary directories
echo "📁 Creating necessary directories..."
mkdir -p logs data config
# Copy environment configuration
if [ ! -f "config/.env" ]; then
echo "⚙️ Setting up environment configuration..."
cp config/.env.example config/.env
echo "✅ Environment file created at config/.env"
echo "📝 Please edit config/.env with your actual configuration values"
else
echo "✅ Environment file already exists"
fi
# Check Docker (optional)
if command -v docker &> /dev/null; then
echo "✅ Docker is available"
# Build Docker image
read -p "🐳 Would you like to build the Docker image? (y/n): " build_docker
if [ "$build_docker" = "y" ] || [ "$build_docker" = "Y" ]; then
echo "🔨 Building Docker image..."
docker build -t autoops:latest .
echo "✅ Docker image built successfully"
fi
else
echo "⚠️ Docker not found. Docker is optional but recommended for deployment"
fi
# Check kubectl (optional)
if command -v kubectl &> /dev/null; then
echo "✅ kubectl is available"
# Check cluster access
if kubectl cluster-info &> /dev/null; then
echo "✅ Kubernetes cluster access verified"
else
echo "⚠️ No Kubernetes cluster access. This is needed for full functionality"
fi
else
echo "⚠️ kubectl not found. This is needed for Kubernetes operations"
fi
# Check Helm (optional)
if command -v helm &> /dev/null; then
echo "✅ Helm is available"
else
echo "⚠️ Helm not found. This is needed for Kubernetes deployment"
fi
echo ""
echo "🎉 Setup completed!"
echo ""
echo "Next steps:"
echo "1. Edit config/.env with your OpenAI API key and other settings"
echo "2. Ensure you have access to a Kubernetes cluster"
echo "3. Run the application:"
echo " python main.py serve"
echo ""
echo "For development with auto-reload:"
echo " python main.py serve --reload"
echo ""
echo "To run with Docker:"
echo " docker-compose up"
echo ""
echo "To deploy to Kubernetes:"
echo " helm install autoops ./helm/autoops"
echo ""
echo "For help and examples:"
echo " python main.py --help"
echo " python examples/usage_examples.py"
echo ""
echo "Happy automating! 🚀"