Skip to content

convox-examples/n8n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

n8n Workflow Automation for Convox

A production-ready n8n workflow automation platform configured for deployment on Convox.

n8n is a powerful workflow automation tool that allows you to connect various services and automate tasks without writing code. This example demonstrates how to deploy n8n on Convox with PostgreSQL database, email configuration, and secure webhook handling.

Deploy to Convox Cloud for a fully-managed platform experience, or to your own Convox Rack for complete control over your infrastructure. Either way, you'll get automatic SSL, load balancing, and zero-downtime deployments out of the box.

Features

  • Workflow Automation - Create powerful automation workflows with 400+ integrations
  • Visual Editor - Design workflows with an intuitive drag-and-drop interface
  • Webhook Support - Trigger workflows via webhooks with automatic SSL
  • User Management - Built-in authentication and user management
  • PostgreSQL Storage - Reliable data persistence with automatic backups
  • Email Integration - SMTP configuration for notifications and user invites
  • Health Monitoring - Built-in health checks for reliability

Deploy to Convox Cloud

  1. Create a Cloud Machine at console.convox.com

  2. Create the app:

convox cloud apps create n8n -i your-machine-name
  1. Set required configuration:
convox cloud env set N8N_HOST=n8n.yourdomain.com N8N_ENCRYPTION_KEY=$(openssl rand -hex 32) -a n8n -i your-machine-name
  1. Deploy the app:
convox cloud deploy -a n8n -i your-machine-name
  1. View your app:
convox cloud services -a n8n -i your-machine-name
  1. (Recommended) Enable authentication:
convox cloud env set \
  N8N_BASIC_AUTH_ACTIVE=true \
  N8N_BASIC_AUTH_USER=admin \
  N8N_BASIC_AUTH_PASSWORD=$(openssl rand -base64 12) \
  -a n8n -i your-machine-name

Visit your URL to access the n8n editor!

Deploy to Convox Rack

  1. Create the app:
convox apps create n8n
  1. Set required configuration:
convox env set N8N_HOST=n8n.yourdomain.com N8N_ENCRYPTION_KEY=$(openssl rand -hex 32) -a n8n
  1. Deploy the app:
convox deploy -a n8n
  1. View your app:
convox services -a n8n
  1. (Recommended) Enable authentication:
convox env set \
  N8N_BASIC_AUTH_ACTIVE=true \
  N8N_BASIC_AUTH_USER=admin \
  N8N_BASIC_AUTH_PASSWORD=$(openssl rand -base64 12) \
  -a n8n

Visit your URL to access the n8n editor!

Configuration

Required Configuration

These environment variables must be set before deployment:

Variable Description Example
N8N_HOST Your n8n instance domain n8n.yourdomain.com
N8N_ENCRYPTION_KEY 32-character hex key for encrypting credentials Generate with: openssl rand -hex 32

⚠️ Important: Save your encryption key securely! You'll need it for backups, restores, and redeployments.

Security Configuration (Highly Recommended)

Secure your instance with authentication:

Variable Description Default
N8N_BASIC_AUTH_ACTIVE Enable basic authentication false
N8N_BASIC_AUTH_USER Username for basic auth -
N8N_BASIC_AUTH_PASSWORD Password for basic auth -
N8N_USER_MANAGEMENT_DISABLED Disable built-in user management false

Email Configuration (Optional)

To enable email features (user invites, password resets, notifications), set these after deployment:

convox env set \
  N8N_SMTP_HOST=smtp.gmail.com \
  N8N_SMTP_PORT=465 \
  N8N_SMTP_SSL=true \
  N8N_SMTP_USER=your-email@gmail.com \
  N8N_SMTP_PASS=your-app-password \
  N8N_SMTP_SENDER=your-email@gmail.com \
  -a n8n

If you don't need email features, these can be left empty (default).

Advanced Configuration (Optional)

These settings are only needed for specific use cases:

Variable Description Default
N8N_WEBHOOK_TUNNEL_URL Webhook tunnel URL for development -
QUEUE_BULL_REDIS_HOST Redis host for queue mode -
QUEUE_BULL_REDIS_PORT Redis port for queue mode -
N8N_VERSION_CONTROL_ENABLED Enable version control features false

Database Options

Using Containerized PostgreSQL (Default)

The default configuration uses a containerized PostgreSQL database that runs alongside n8n:

resources:
  database:
    type: postgres
    options:
      storage: 20
      version: 14

Using AWS RDS PostgreSQL

For production workloads, you can use AWS RDS for better durability:

resources:
  database:
    type: rds-postgres
    options:
      class: db.t3.micro
      storage: 20
      version: 14
      encrypted: true
      deletionProtection: true

Using External Database

To use an existing database, set the DATABASE_URL:

convox env set DATABASE_URL=postgres://user:pass@host:5432/dbname -a n8n

Scaling

Convox Cloud

convox cloud scale web --count 1 --cpu 500 --memory 1024 -a n8n -i your-machine-name

Convox Rack

convox scale web --count 1 --cpu 500 --memory 1024 -a n8n

Note: n8n should typically run as a single instance unless you configure queue mode with Redis.

Monitoring

View logs

Cloud:

convox cloud logs -a n8n -i your-machine-name

Rack:

convox logs -a n8n

Check application health

curl https://your-n8n-url/healthz

Backup and Restore

Export Workflows

  1. Access n8n UI
  2. Go to Settings → Download
  3. Select workflows to export
  4. Save the JSON file

Import Workflows

  1. Access n8n UI
  2. Go to Settings → Import
  3. Upload your JSON file
  4. Review and confirm import

Database Backup

Cloud:

convox cloud resources export database -a n8n -i your-machine-name -f n8n-backup.sql

Rack:

convox resources export database -a n8n -f n8n-backup.sql

Security Best Practices

  1. Always set N8N_ENCRYPTION_KEY - Required for encrypting stored credentials
  2. Enable authentication - Use basic auth or configure OAuth
  3. Use HTTPS - Convox automatically provides SSL certificates
  4. Secure webhooks - Use webhook authentication when possible
  5. Regular backups - Export workflows and database regularly
  6. Update regularly - Keep n8n updated for security patches

Troubleshooting

n8n won't start

Check that all required environment variables are set:

convox env -a n8n

Verify the database connection:

convox logs -a n8n --filter="database"

Cannot access the UI

Ensure the domain is configured:

convox services -a n8n

Check SSL certificate status:

convox certs -a n8n

Workflow execution errors

Check execution logs in the n8n UI under "Executions"

For detailed logs:

convox logs -a n8n --since=1h

Resources

Support

About

Self-hosted n8n is a free and source-available workflow automation tool similar to Zapier.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published