1- # One-line installer
1+ #! /bin/bash
2+
3+ # TaskProvision - AI-Powered Development Automation Platform
4+ # One-line installer: curl -fsSL https://get.taskprovision.com | bash
5+
6+ set -e
7+
8+ # Colors for output
9+ RED=' \033[0;31m'
10+ GREEN=' \033[0;32m'
11+ YELLOW=' \033[1;33m'
12+ BLUE=' \033[0;34m'
13+ NC=' \033[0m' # No Color
14+
15+ # Configuration
16+ TASKPROVISION_VERSION=" latest"
17+ INSTALL_DIR=" $HOME /taskprovision"
18+ GITHUB_ORG=" taskprovision"
19+ GITHUB_REPO=" taskprovision"
20+
21+ # Print colored output
22+ print_status () {
23+ echo -e " ${BLUE} [INFO]${NC} $1 "
24+ }
25+
26+ print_success () {
27+ echo -e " ${GREEN} [SUCCESS]${NC} $1 "
28+ }
29+
30+ print_warning () {
31+ echo -e " ${YELLOW} [WARNING]${NC} $1 "
32+ }
33+
34+ print_error () {
35+ echo -e " ${RED} [ERROR]${NC} $1 "
36+ }
37+
38+ # Check system requirements
39+ check_requirements () {
40+ print_status " Checking system requirements..."
41+
42+ # Check OS
43+ if [[ " $OSTYPE " != " linux-gnu" * ]]; then
44+ print_error " This installer currently supports Linux only"
45+ exit 1
46+ fi
47+
48+ # Check memory (require at least 6GB)
49+ total_mem=$( free -g | awk ' NR==2{print $2}' )
50+ if [ $total_mem -lt 6 ]; then
51+ print_warning " System has ${total_mem} GB RAM. Recommended: 8GB+"
52+ fi
53+
54+ # Check required commands
55+ local required_commands=(" curl" " git" " python3" " pip3" )
56+ for cmd in " ${required_commands[@]} " ; do
57+ if ! command -v $cmd & > /dev/null; then
58+ print_error " Required command '$cmd ' is not installed"
59+ exit 1
60+ fi
61+ done
62+
63+ print_success " System requirements check passed"
64+ }
65+
66+ # Install Docker if not present
67+ install_docker () {
68+ if ! command -v docker & > /dev/null; then
69+ print_status " Installing Docker..."
70+ curl -fsSL https://get.docker.com | sh
71+ sudo usermod -aG docker $USER
72+ print_success " Docker installed successfully"
73+ else
74+ print_status " Docker already installed"
75+ fi
76+ }
77+
78+ # Install Kubernetes (k3s for lightweight deployment)
79+ install_kubernetes () {
80+ if ! command -v kubectl & > /dev/null; then
81+ print_status " Installing Kubernetes (k3s)..."
82+ curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 644
83+ export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
84+ sudo chmod 644 /etc/rancher/k3s/k3s.yaml
85+
86+ # Add kubectl alias
87+ echo ' export KUBECONFIG=/etc/rancher/k3s/k3s.yaml' >> ~ /.bashrc
88+ echo ' alias k=kubectl' >> ~ /.bashrc
89+
90+ print_success " Kubernetes (k3s) installed successfully"
91+ else
92+ print_status " Kubernetes already installed"
93+ fi
94+ }
95+
96+ # Install Ollama for local AI
97+ install_ollama () {
98+ if ! command -v ollama & > /dev/null; then
99+ print_status " Installing Ollama (Local AI)..."
100+ curl -fsSL https://ollama.ai/install.sh | sh
101+
102+ # Start Ollama service
103+ sudo systemctl enable ollama
104+ sudo systemctl start ollama
105+
106+ # Wait for service to start
107+ sleep 5
108+
109+ # Pull a lightweight model for development
110+ print_status " Downloading AI model (this may take a few minutes)..."
111+ ollama pull qwen2.5:1.5b
112+
113+ print_success " Ollama installed with qwen2.5:1.5b model"
114+ else
115+ print_status " Ollama already installed"
116+ fi
117+ }
118+
119+ # Clone TaskProvision repository
120+ clone_repository () {
121+ print_status " Cloning TaskProvision repository..."
122+
123+ if [ -d " $INSTALL_DIR " ]; then
124+ print_warning " Directory $INSTALL_DIR already exists. Updating..."
125+ cd " $INSTALL_DIR "
126+ git pull origin main
127+ else
128+ git clone https://github.com/${GITHUB_ORG} /${GITHUB_REPO} .git " $INSTALL_DIR "
129+ cd " $INSTALL_DIR "
130+ fi
131+
132+ print_success " Repository cloned successfully"
133+ }
134+
135+ # Setup Python environment
136+ setup_python_env () {
137+ print_status " Setting up Python environment..."
138+
139+ cd " $INSTALL_DIR "
140+
141+ # Create virtual environment
142+ python3 -m venv venv
143+ source venv/bin/activate
144+
145+ # Upgrade pip
146+ pip install --upgrade pip
147+
148+ # Install dependencies
149+ pip install -r requirements.txt
150+
151+ # Install TaskProvision package in development mode
152+ pip install -e .
153+
154+ print_success " Python environment setup complete"
155+ }
156+
157+ # Deploy to Kubernetes
158+ deploy_kubernetes () {
159+ print_status " Deploying TaskProvision to Kubernetes..."
160+
161+ cd " $INSTALL_DIR "
162+
163+ # Apply Kubernetes manifests
164+ kubectl apply -f kubernetes/
165+
166+ # Wait for deployment
167+ print_status " Waiting for deployment to be ready..."
168+ kubectl wait --for=condition=available deployment/taskprovision --timeout=300s
169+
170+ # Get service URL
171+ local service_ip=$( kubectl get svc taskprovision-service -o jsonpath=' {.status.loadBalancer.ingress[0].ip}' )
172+ if [ -z " $service_ip " ]; then
173+ service_ip=$( kubectl get svc taskprovision-service -o jsonpath=' {.spec.clusterIP}' )
174+ fi
175+
176+ print_success " TaskProvision deployed successfully"
177+ print_success " Access your platform at: http://${service_ip} "
178+ }
179+
180+ # Setup monitoring
181+ setup_monitoring () {
182+ print_status " Setting up monitoring..."
183+
184+ # Deploy Prometheus and Grafana
185+ kubectl apply -f monitoring/
186+
187+ print_success " Monitoring setup complete"
188+ }
189+
190+ # Create initial admin user
191+ create_admin_user () {
192+ print_status " Creating initial admin user..."
193+
194+ # Wait for API to be ready
195+ sleep 10
196+
197+ # Create admin user via API
198+ local service_ip=$( kubectl get svc taskprovision-service -o jsonpath=' {.spec.clusterIP}' )
199+
200+ curl -X POST " http://${service_ip} /api/auth/create-admin" \
201+ -H " Content-Type: application/json" \
202+ -d ' {
203+ "email": "admin@taskprovision.local",
204+ "password": "admin123",
205+ "full_name": "TaskProvision Admin"
206+ }' || print_warning " Could not create admin user automatically"
207+
208+ print_success " Admin user creation attempted"
209+ }
210+
211+ # Setup sales automation
212+ setup_sales_automation () {
213+ print_status " Setting up sales automation tools..."
214+
215+ cd " $INSTALL_DIR "
216+
217+ # Setup GitHub lead mining
218+ python3 campaigns/github_lead_mining.py --setup
219+
220+ # Setup email sequences
221+ python3 campaigns/email_sequences.py --setup
222+
223+ print_success " Sales automation tools configured"
224+ }
225+
226+ # Show final instructions
227+ show_final_instructions () {
228+ local service_ip=$( kubectl get svc taskprovision-service -o jsonpath=' {.spec.clusterIP}' 2> /dev/null || echo " localhost" )
229+
230+ echo " "
231+ echo " 🎉 TaskProvision Installation Complete!"
232+ echo " ========================================"
233+ echo " "
234+ echo " 📊 Platform Access:"
235+ echo " • Web Interface: http://${service_ip} "
236+ echo " • API Docs: http://${service_ip} /docs"
237+ echo " • Grafana: http://${service_ip} :3000"
238+ echo " "
239+ echo " 🔐 Default Credentials:"
240+ echo " • Email: admin@taskprovision.local"
241+ echo " • Password: admin123"
242+ echo " "
243+ echo " 🚀 Quick Start Commands:"
244+ echo " • cd $INSTALL_DIR "
245+ echo " • source venv/bin/activate"
246+ echo " • python3 -m taskprovision.main"
247+ echo " "
248+ echo " 📚 Next Steps:"
249+ echo " 1. Change admin password"
250+ echo " 2. Configure GitHub integration"
251+ echo " 3. Setup Stripe billing"
252+ echo " 4. Launch first sales campaign"
253+ echo " "
254+ echo " 💡 Documentation: https://github.com/taskprovision/www"
255+ echo " 🐛 Support: https://github.com/taskprovision/taskprovision/issues"
256+ echo " "
257+ print_success " Ready to start automating development workflows!"
258+ }
259+
260+ # Main installation flow
261+ main () {
262+ echo " 🚀 TaskProvision Installer"
263+ echo " ========================="
264+ echo " AI-Powered Development Automation Platform"
265+ echo " "
266+
267+ check_requirements
268+ install_docker
269+ install_kubernetes
270+ install_ollama
271+ clone_repository
272+ setup_python_env
273+ deploy_kubernetes
274+ setup_monitoring
275+ create_admin_user
276+ setup_sales_automation
277+ show_final_instructions
278+ }
279+
280+ # Handle interrupts
281+ trap ' print_error "Installation interrupted by user"; exit 1' INT
282+
283+ # Run main installation
284+ main " $@ "
0 commit comments