Workflow Automation

    Deploy N8N on RamNode

    Set up N8N workflow automation on your RamNode VPS hosting. Automate repetitive tasks, connect services, and streamline your business processes with this powerful open-source platform.

    Ubuntu 20.04/22.04
    N8N + Node.js
    ⏱️ 30-45 minutes

    Prerequisites

    Before starting, ensure you have:

    Server Requirements

    • • RamNode VPS (1GB+ RAM minimum)
    • • Ubuntu 20.04/22.04 or Debian 11
    • • 1 CPU core minimum
    • • SSH access to your VPS
    • • Domain name (optional, recommended)

    Knowledge Requirements

    • • Basic Linux command line
    • • Understanding of web servers
    • • Basic networking concepts
    • • SSH connection skills
    2

    Initial Server Setup

    Connect to your RamNode VPS and prepare the environment:

    Connect via SSH
    ssh root@your-server-ip
    Update System Packages
    apt update && apt upgrade -y
    Create N8N User for Security
    adduser n8n
    usermod -aG sudo n8n
    Switch to N8N User
    su - n8n

    💡 Security Tip: Running N8N as a dedicated user improves security by limiting permissions and isolating the application.

    3

    Install Node.js and npm

    N8N requires Node.js to run. Install the latest LTS version:

    Add NodeSource Repository
    curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
    Install Node.js
    sudo apt-get install -y nodejs
    Verify Installation
    node --version
    npm --version

    ✅ Node.js is now installed and ready for N8N deployment!

    4

    Install N8N

    Install N8N globally using npm:

    Install N8N Globally
    sudo npm install n8n -g
    Verify N8N Installation
    n8n --version

    What is N8N?

    N8N is a powerful workflow automation tool that allows you to connect different services and automate repetitive tasks through a visual interface. It's perfect for automating business processes, data synchronization, and API integrations.

    5

    Configure N8N

    Set up N8N configuration and environment variables:

    Create N8N Directory
    mkdir ~/.n8n
    cd ~/.n8n
    Set Environment Variables
    nano ~/.bashrc

    Add these environment variables to the end of the file:

    N8N Environment Variables
    export N8N_BASIC_AUTH_ACTIVE=true
    export N8N_BASIC_AUTH_USER=your_username
    export N8N_BASIC_AUTH_PASSWORD=your_secure_password
    export N8N_HOST=0.0.0.0
    export N8N_PORT=5678
    export N8N_PROTOCOL=http
    export NODE_ENV=production
    Reload Environment
    source ~/.bashrc

    🔐 Security: Replace "your_username" and "your_secure_password" with strong, unique credentials!

    6

    Set Up Nginx Reverse Proxy

    Configure Nginx as a reverse proxy for N8N:

    Install Nginx
    sudo apt install nginx -y
    Create Nginx Configuration
    sudo nano /etc/nginx/sites-available/n8n

    Add the following Nginx configuration:

    Nginx Configuration for N8N
    server {
        listen 80;
        server_name your-domain.com;  # Replace with your domain
    
        location / {
            proxy_pass http://localhost:5678;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_cache_bypass $http_upgrade;
            proxy_read_timeout 86400;
        }
    }
    Enable the Site
    sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
    sudo nginx -t
    sudo systemctl restart nginx
    7

    Set Up SSL with Let's Encrypt

    Secure your N8N installation with SSL certificate:

    Install Certbot
    sudo apt install certbot python3-certbot-nginx -y
    Obtain SSL Certificate
    sudo certbot --nginx -d your-domain.com
    Test Auto-Renewal
    sudo certbot renew --dry-run

    🔒 SSL Enabled: Your N8N instance is now secured with HTTPS!

    8

    Create Systemd Service

    Set up N8N as a system service for automatic startup:

    Create Service File
    sudo nano /etc/systemd/system/n8n.service

    Add the following service configuration:

    N8N Systemd Service
    [Unit]
    Description=n8n workflow automation
    After=network.target
    
    [Service]
    Type=simple
    User=n8n
    ExecStart=/usr/bin/n8n start
    Restart=on-failure
    RestartSec=10
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=n8n
    Environment=NODE_ENV=production
    Environment=N8N_BASIC_AUTH_ACTIVE=true
    Environment=N8N_BASIC_AUTH_USER=your_username
    Environment=N8N_BASIC_AUTH_PASSWORD=your_secure_password
    Environment=N8N_HOST=0.0.0.0
    Environment=N8N_PORT=5678
    
    [Install]
    WantedBy=multi-user.target
    Enable and Start Service
    sudo systemctl daemon-reload
    sudo systemctl enable n8n
    sudo systemctl start n8n
    Check Service Status
    sudo systemctl status n8n
    9

    Configure Firewall

    Set up UFW firewall to secure your N8N installation:

    Configure UFW Firewall
    sudo ufw allow ssh
    sudo ufw allow 'Nginx Full'
    sudo ufw enable
    Check Firewall Status
    sudo ufw status

    ⚠️ Important: Make sure SSH is allowed before enabling UFW to avoid losing access to your server!

    10

    Database Setup (Optional)

    For production use, consider switching from SQLite to PostgreSQL:

    Install PostgreSQL
    sudo apt install postgresql postgresql-contrib -y
    Create Database and User
    sudo -u postgres psql
    CREATE DATABASE n8n;
    CREATE USER n8nuser WITH PASSWORD 'secure_password';
    GRANT ALL PRIVILEGES ON DATABASE n8n TO n8nuser;
    \q
    Update Environment Variables
    export DB_TYPE=postgresdb
    export DB_POSTGRESDB_HOST=localhost
    export DB_POSTGRESDB_PORT=5432
    export DB_POSTGRESDB_DATABASE=n8n
    export DB_POSTGRESDB_USER=n8nuser
    export DB_POSTGRESDB_PASSWORD=secure_password

    📊 Database Tip: PostgreSQL provides better performance and reliability for production N8N deployments with high workflow volume.

    11

    Performance Tuning

    Optimize N8N performance for your RamNode VPS:

    Memory Optimization

    Increase Node.js Memory Limit
    export NODE_OPTIONS="--max-old-space-size=2048"

    N8N Production Settings

    Production Environment Variables
    export N8N_LOG_LEVEL=warn
    export N8N_METRICS=true
    export EXECUTIONS_DATA_PRUNE=true
    export EXECUTIONS_DATA_MAX_AGE=168  # Keep executions for 1 week
    export N8N_ENCRYPTION_KEY="your-encryption-key"

    Performance Tips

    • • Enable execution data pruning to manage database size
    • • Use PostgreSQL for better performance with large datasets
    • • Monitor memory usage and upgrade VPS if needed
    • • Set appropriate log levels to reduce disk I/O
    12

    Backup Strategy

    Implement automated backups for your N8N installation:

    Create Backup Script
    nano ~/backup-n8n.sh

    Add the following backup script:

    N8N Backup Script
    #!/bin/bash
    DATE=$(date +%Y%m%d_%H%M%S)
    BACKUP_DIR="/home/n8n/backups"
    mkdir -p $BACKUP_DIR
    
    # Backup N8N data
    tar -czf $BACKUP_DIR/n8n_backup_$DATE.tar.gz ~/.n8n/
    
    # Backup database (if using PostgreSQL)
    if [ "$DB_TYPE" = "postgresdb" ]; then
        pg_dump -h localhost -U n8nuser n8n > $BACKUP_DIR/n8n_db_$DATE.sql
    fi
    
    # Keep only last 7 backups
    find $BACKUP_DIR -name "n8n_backup_*.tar.gz" -mtime +7 -delete
    find $BACKUP_DIR -name "n8n_db_*.sql" -mtime +7 -delete
    
    echo "Backup completed: $DATE"
    Make Script Executable and Schedule
    chmod +x ~/backup-n8n.sh
    crontab -e
    # Add this line for daily backups at 2 AM
    0 2 * * * /home/n8n/backup-n8n.sh
    13

    Monitoring and Logs

    Set up monitoring to track N8N performance and health:

    View N8N Logs

    Monitor Service Logs
    # View real-time logs
    sudo journalctl -u n8n -f
    
    # View recent logs
    sudo journalctl -u n8n --no-pager
    
    # View logs from last hour
    sudo journalctl -u n8n --since "1 hour ago"

    System Resource Monitoring

    System Monitoring Commands
    # Check memory usage
    free -h
    
    # Check disk usage
    df -h
    
    # Check CPU usage
    htop
    
    # Check N8n process
    ps aux | grep n8n

    Log Rotation Setup

    Configure Log Rotation
    sudo nano /etc/logrotate.d/n8n
    Log Rotation Configuration
    /var/log/n8n/*.log {
        daily
        rotate 7
        compress
        delaycompress
        missingok
        notifempty
        create 644 n8n n8n
    }
    14

    Troubleshooting Common Issues

    Common issues and their solutions when running N8N on RamNode:

    🎉 Congratulations!

    You've successfully deployed N8N workflow automation on your RamNode VPS! You can now automate tasks, connect services, and streamline your business processes.