- Add .forgejo/workflows/deploy.yml for automated deployment - Include rollback mechanism with image tagging - Add health check verification (http://127.0.0.1:3100/health) - Create manual rollback script for emergency use - Add deployment documentation and setup instructions - Supports auto-rollback on deployment failure
2.1 KiB
2.1 KiB
DocFast CI/CD Deployment
This repository uses Forgejo Actions for automated deployment to production.
Setup Instructions
1. Repository Secrets
Go to repository settings → Actions → Secrets and add these secrets:
- SERVER_HOST:
167.235.156.214 - SERVER_USER:
root - SSH_PRIVATE_KEY: The private SSH key content from
/home/openclaw/.ssh/docfast
2. How Deployment Works
Trigger: Push to main branch
Process:
- SSH to production server
- Pull latest code from git
- Tag current Docker image for rollback
- Build new Docker image
- Stop current services
- Start new services
- Health check at
http://127.0.0.1:3100/health - Rollback automatically if health check fails
3. Rollback Procedure
Automatic Rollback:
- Happens automatically if deployment fails health checks
- Reverts to the previously tagged image
Manual Rollback:
# On the production server
cd /root/docfast
./scripts/rollback.sh
Emergency Rollback via SSH:
ssh root@167.235.156.214
cd /root/docfast
docker compose down
docker tag docfast-docfast:rollback-YYYYMMDD-HHMMSS docfast-docfast:latest
docker compose up -d
4. Monitoring
- Health Check:
curl http://127.0.0.1:3100/health - Service Status:
docker compose ps - Logs:
docker compose logs -f
5. File Structure
.forgejo/workflows/deploy.yml # Main deployment workflow
scripts/rollback.sh # Manual rollback script
scripts/setup-secrets.sh # Helper for setting up secrets
DEPLOYMENT.md # This documentation
6. Testing the Pipeline
- Make a small change (e.g., bump version comment)
- Commit and push to main branch
- Check Actions tab in Forgejo to see deployment progress
- Verify service is running with
curl http://127.0.0.1:3100/health
Troubleshooting
- SSH Issues: Ensure SSH key is properly added to secrets
- Docker Build Issues: Check server has enough disk space and memory
- Health Check Fails: Check if service is binding to correct port (3100)
- Permission Issues: Ensure user has Docker privileges on server