4.8 KiB
4.8 KiB
🔗 Webhook Setup Guide
✅ Webhook Status
- Endpoint:
https://api.argeict.net/webhook/deploy - Method: POST
- Status: ✅ Working
- Last Test: 2026-01-10 12:39:04 UTC
📝 Gitea Webhook Configuration
Step 1: Access Gitea Repository Settings
- Go to: https://gitea.argeict.net/hostadmin/hosting-platform
- Click on Settings (top right)
- Click on Webhooks in the left sidebar
Step 2: Add New Webhook
- Click Add Webhook button
- Select Gitea from the dropdown
Step 3: Configure Webhook
Fill in the following details:
Target URL: https://api.argeict.net/webhook/deploy
HTTP Method: POST
POST Content Type: application/json
Secret: (leave empty for now)
Trigger On:
- ✅ Push events (checked)
- Branch filter:
main
Active:
- ✅ Active (checked)
Step 4: Save and Test
- Click Add Webhook button
- The webhook will appear in the list
- Click on the webhook to view details
- Click Test Delivery button
- Check the response - should see:
{
"status": "success",
"message": "Deployment triggered successfully",
"repository": "hosting-platform",
"pusher": "hostadmin",
"timestamp": "2026-01-10T12:39:04.822854",
"note": "Check /var/log/auto-deploy.log for deployment progress"
}
🧪 Manual Testing
Test the webhook manually with curl:
curl -X POST https://api.argeict.net/webhook/deploy \
-H "Content-Type: application/json" \
-d '{
"repository": {
"name": "hosting-platform"
},
"pusher": {
"username": "test-user"
}
}'
Expected response (HTTP 202):
{
"status": "success",
"message": "Deployment triggered successfully",
"repository": "hosting-platform",
"pusher": "test-user",
"timestamp": "2026-01-10T12:39:04.822854",
"note": "Check /var/log/auto-deploy.log for deployment progress"
}
📊 How It Works
┌─────────────┐
│ Developer │
│ git push │
└──────┬──────┘
│
▼
┌─────────────────┐
│ Gitea Server │
│ (detects push) │
└──────┬──────────┘
│
│ POST /webhook/deploy
▼
┌──────────────────────┐
│ Backend API │
│ (receives webhook) │
└──────┬───────────────┘
│
│ Triggers async
▼
┌────────────────────────────┐
│ deploy-local.sh │
│ 1. git pull │
│ 2. install dependencies │
│ 3. database migration │
│ 4. build frontend │
│ 5. restart services │
└────────────────────────────┘
│
▼
┌─────────────────┐
│ Deployment │
│ Complete! ✅ │
└─────────────────┘
🔍 Monitoring Deployments
View Deployment Logs
# Real-time deployment logs
ssh root@176.96.129.77 'tail -f /var/log/auto-deploy.log'
# Last 50 lines
ssh root@176.96.129.77 'tail -50 /var/log/auto-deploy.log'
View Backend Logs
ssh root@176.96.129.77 'tail -f /var/log/hosting-backend.log'
Check Service Status
ssh root@176.96.129.77 'supervisorctl status'
🛠️ Troubleshooting
Webhook Returns Error
-
Check backend logs:
ssh root@176.96.129.77 'tail -100 /var/log/hosting-backend.log' -
Verify deployment script exists:
ssh root@176.96.129.77 'ls -la /opt/hosting-platform/deploy-local.sh' -
Test deployment script manually:
ssh root@176.96.129.77 '/opt/hosting-platform/deploy-local.sh'
Deployment Fails
-
Check deployment logs:
ssh root@176.96.129.77 'cat /var/log/auto-deploy.log' -
Check for git issues:
ssh root@176.96.129.77 'cd /opt/hosting-platform && git status' -
Restart services manually:
ssh root@176.96.129.77 'supervisorctl restart hosting-backend hosting-frontend'
🔐 Security (Optional)
To add webhook secret validation:
-
Generate a secret:
openssl rand -hex 32 -
Add to Gitea webhook configuration (Secret field)
-
Update backend code to validate the secret
✅ Verification Checklist
- Webhook added in Gitea
- Test Delivery successful (green checkmark)
- Push to main branch triggers deployment
- Deployment logs show successful completion
- Services restart automatically
- Frontend and backend updated
Last Updated: 2026-01-10
Maintained By: Hosting Platform Team