-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebhook-deploy.sh
More file actions
28 lines (19 loc) · 806 Bytes
/
webhook-deploy.sh
File metadata and controls
28 lines (19 loc) · 806 Bytes
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
#!/bin/bash
# GitHub Webhook Handler for SoilIntelligence Auto-Deploy
# This script is called by GitHub webhook when you push code
# It pulls the latest code and restarts the app
set -e
LOG_FILE="/var/log/soilintelligence-webhook.log"
echo "[$(date)] Webhook received - starting deployment" >> $LOG_FILE
cd /var/www/soilintelligence
# Pull latest code
echo "[$(date)] Pulling latest code from GitHub..." >> $LOG_FILE
git pull origin main >> $LOG_FILE 2>&1
# Install any new requirements
echo "[$(date)] Installing requirements..." >> $LOG_FILE
source venv/bin/activate
pip install -r requirements.txt >> $LOG_FILE 2>&1
# Restart the app
echo "[$(date)] Restarting app..." >> $LOG_FILE
supervisorctl restart soilintelligence >> $LOG_FILE 2>&1
echo "[$(date)] ✅ Deployment complete!" >> $LOG_FILE