DevOps Guide
βAutomation applied to an efficient operation will magnify the efficiency.β β Bill Gates
Comprehensive guide for integrating n8n-deploy into DevOps workflows, CI/CD pipelines, and production environments.
π― Overview
This guide covers:
- CI/CD Integration: GitHub Actions, GitLab CI, Jenkins pipelines
- Multi-Environment Setup: Dev, staging, and production configurations
- Backup Strategies: Automated backups with rotation and verification
- Monitoring: Health checks and alerting
- Security: Best practices for production deployments
π Guide Sections
CI/CD Integration
Integrate n8n-deploy into your continuous deployment pipelines.
Topics covered:
- GitHub Actions workflows
- GitLab CI/CD pipelines
- Jenkins job configuration
- Docker container automation
- Secrets management
Multi-Environment Setup
Configure separate environments for development, staging, and production.
Topics covered:
- Environment separation strategies
- Server configuration per environment
- API key management across environments
- Blue-green deployment patterns
- Environment migration workflows
Backup Strategies
Automated backup solutions for database and workflows.
Topics covered:
- Scheduled database backups
- Backup rotation policies
- Integrity verification
- Restore procedures
- Off-site backup storage
Monitoring & Health Checks
Monitor n8n-deploy operations and server health.
Topics covered:
- Database health monitoring
- Server connectivity checks
- API key validation
- Alerting and notifications
- Performance metrics
Security Best Practices
Security patterns for production deployments.
Topics covered:
- File permissions and access control
- API key security
- Backup encryption
- Audit logging
- Network security
π Quick Examples
GitHub Actions Workflow
name: Deploy Workflows
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install n8n-deploy
run: pip install n8n-deploy
- name: Push workflows
env:
N8N_SERVER_URL: $
run: |
echo "$" | n8n-deploy apikey add - --name ci_key
n8n-deploy wf push "Production Workflow"
Daily Backup Script
#!/bin/bash
# Automated daily backup with rotation
BACKUP_DIR="/backups/n8n-deploy"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
RETENTION_DAYS=30
# Create backup
n8n-deploy db backup "${BACKUP_DIR}/backup_${TIMESTAMP}.db" --no-emoji
# Rotate old backups
find "${BACKUP_DIR}" -name "backup_*.db" -mtime +${RETENTION_DAYS} -delete
# Verify latest backup
if [ -f "${BACKUP_DIR}/backup_${TIMESTAMP}.db" ]; then
echo "β Backup successful"
else
echo "β Backup failed" | mail -s "Backup Alert" admin@example.com
fi
Health Check Monitor
#!/bin/bash
# Monitor database and server health
# Check database status
if ! n8n-deploy db status --no-emoji > /dev/null 2>&1; then
echo "β Database health check failed"
exit 1
fi
# Check server connectivity
SERVERS=$(n8n-deploy server list --json --no-emoji | jq -r '.[] | select(.is_active==true) | .name')
for SERVER in $SERVERS; do
SERVER_URL=$(n8n-deploy server list --json --no-emoji | jq -r ".[] | select(.name==\"$SERVER\") | .url")
if curl -sf "${SERVER_URL}/healthz" > /dev/null 2>&1; then
echo "β $SERVER is healthy"
else
echo "β $SERVER is unreachable"
fi
done
π Related Documentation
- Core Features - Essential functionality
- Configuration - Environment variables
- Quick Reference - Command cheat sheets
- Developer Guide - API reference and architecture
π‘ Best Practices
- Separate Environments: Use distinct databases for dev/staging/prod
- Automate Backups: Schedule daily database backups with rotation
- Version Control: Store workflow JSON files in git
- Secret Management: Use CI/CD secrets, never hardcode API keys
- Health Monitoring: Implement automated health checks
- Test Deployments: Validate in staging before production
- Document Changes: Maintain deployment logs and changelogs
- Access Control: Limit production access with read-only keys
Ready to integrate? Start with CI/CD Integration for pipeline setup.