docfast/CI-CD-SETUP-COMPLETE.md
openclawd d99eea517c
Some checks failed
Deploy to Production / Deploy to Server (push) Has been cancelled
Add comprehensive CI/CD setup completion documentation
2026-02-15 11:04:25 +00:00

3.7 KiB

DocFast CI/CD Pipeline Setup - COMPLETED

What Was Implemented

Forgejo Actions Workflow

  • File: .forgejo/workflows/deploy.yml
  • Trigger: Push to main branch
  • Process:
    1. SSH to production server (167.235.156.214)
    2. Pull latest code from git
    3. Tag current Docker image for rollback (rollback-YYYYMMDD-HHMMSS)
    4. Build new Docker image with --no-cache
    5. Stop current services (30s graceful timeout)
    6. Start new services with docker compose up -d
    7. Health check at http://127.0.0.1:3100/health (30 attempts, 5s intervals)
    8. Auto-rollback if health check fails
    9. Cleanup old rollback images (keeps last 5)

Rollback Mechanism

  • Automatic: Built into the deployment workflow
  • Manual Script: scripts/rollback.sh for emergency use
  • Image Tagging: Previous images tagged with timestamps
  • Auto-cleanup: Removes old rollback images automatically

Documentation

  • DEPLOYMENT.md: Complete deployment guide
  • CI-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:

  1. SERVER_HOST: 167.235.156.214
  2. SERVER_USER: root
  3. SSH_PRIVATE_KEY: (copy content from /home/openclaw/.ssh/docfast)

🧪 Test the Pipeline

  1. Once secrets are added, push any change to main branch
  2. Check Actions tab: https://git.cloonar.com/openclawd/docfast/actions
  3. Watch deployment progress
  4. Verify with: curl http://127.0.0.1:3100/health

How to Trigger Deployments

  • Automatic: Any push to main branch
  • 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

  1. Set up secrets in Forgejo (5 minutes)
  2. Test deployment by making a small change
  3. Verify the health check endpoint works
  4. 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 (/health endpoint)
  • Git repository integration working
  • Documentation complete
  • Test change ready for pipeline verification

Ready for production use once secrets are configured! 🚀