3.7 KiB
3.7 KiB
DocFast CI/CD Pipeline Setup - COMPLETED ✅
What Was Implemented
✅ Forgejo Actions Workflow
- File:
.forgejo/workflows/deploy.yml - Trigger: Push to
mainbranch - Process:
- SSH to production server (167.235.156.214)
- Pull latest code from git
- Tag current Docker image for rollback (
rollback-YYYYMMDD-HHMMSS) - Build new Docker image with
--no-cache - Stop current services (30s graceful timeout)
- Start new services with
docker compose up -d - Health check at
http://127.0.0.1:3100/health(30 attempts, 5s intervals) - Auto-rollback if health check fails
- Cleanup old rollback images (keeps last 5)
✅ Rollback Mechanism
- Automatic: Built into the deployment workflow
- Manual Script:
scripts/rollback.shfor emergency use - Image Tagging: Previous images tagged with timestamps
- Auto-cleanup: Removes old rollback images automatically
✅ Documentation
DEPLOYMENT.md: Complete deployment guideCI-CD-SETUP-COMPLETE.md: This summary- Inline comments: Detailed workflow documentation
✅ Git Integration
- Repository:
git@git.cloonar.com:openclawd/docfast.git - SSH access configured with key:
/home/openclaw/.ssh/docfast - All CI/CD files committed and pushed successfully
What Needs Manual Setup (5 minutes)
🔧 Repository Secrets
Go to: https://git.cloonar.com/openclawd/docfast/settings/actions/secrets
Add these 3 secrets:
- SERVER_HOST:
167.235.156.214 - SERVER_USER:
root - SSH_PRIVATE_KEY: (copy content from
/home/openclaw/.ssh/docfast)
🧪 Test the Pipeline
- Once secrets are added, push any change to main branch
- Check Actions tab: https://git.cloonar.com/openclawd/docfast/actions
- Watch deployment progress
- Verify with:
curl http://127.0.0.1:3100/health
How to Trigger Deployments
- Automatic: Any push to
mainbranch - Manual: Push a trivial change (already prepared: VERSION file)
How to Rollback
Automatic Rollback
- Happens automatically if new deployment fails health checks
- No manual intervention required
Manual Rollback Options
# Option 1: Use the rollback script
ssh root@167.235.156.214
cd /root/docfast
./scripts/rollback.sh
# Option 2: Manual Docker commands
ssh root@167.235.156.214
docker compose down
docker images | grep rollback # Find latest rollback image
docker tag docfast-docfast:rollback-YYYYMMDD-HHMMSS docfast-docfast:latest
docker compose up -d
Monitoring Commands
# Health check
curl http://127.0.0.1:3100/health
# Service status
docker compose ps
# View logs
docker compose logs -f docfast
# Check rollback images available
docker images | grep docfast-docfast
Files Added/Modified
.forgejo/workflows/deploy.yml # Main deployment workflow
scripts/rollback.sh # Emergency rollback script
scripts/setup-secrets.sh # Helper script (API had auth issues)
DEPLOYMENT.md # Deployment documentation
CI-CD-SETUP-COMPLETE.md # This summary
VERSION # Test file for pipeline testing
Next Steps
- Set up secrets in Forgejo (5 minutes)
- Test deployment by making a small change
- Verify the health check endpoint works
- Document any environment-specific adjustments needed
Success Criteria ✅
- Forgejo Actions available and configured
- Deployment workflow created and tested (syntax)
- Rollback mechanism implemented (automatic + manual)
- Health check integration (
/healthendpoint) - Git repository integration working
- Documentation complete
- Test change ready for pipeline verification
Ready for production use once secrets are configured! 🚀