Deploy n8n Enterprise-Ready Stack
š Infinite Scaling n8n + worker + PostgreSQL HA + Redis + Python Runer
postgres-18-replica
Just deployed
/var/lib/postgresql/data
n8n-worker
Just deployed
postgres-18-proxy
Just deployed
postgres-18-primary
Just deployed
/var/lib/postgresql/data
Just deployed
n8n-task-runner
Just deployed
Redis-n8n
Just deployed
Deploy and Host n8n Enterprise-Ready Stack on Railway
n8n Enterprise-Ready Stack is a production-grade, self-hosted workflow automation platform combining n8n with PostgreSQL HA and Redis for queue management. Deploy with a single click and get infinite horizontal scaling, automatic failover, and enterprise reliability.
About Hosting n8n Enterprise-Ready Stack
Deploying n8n in production requires a robust database, a queue system for high-volume executions, and the ability to scale workers. This template provides:
- PostgreSQL HA with Primary-Replica replication
- Redis for queue-based execution and scaling
- n8n Main Instance serving web UI and webhooks
- n8n Workers processing executions in parallel
- External Task Runner for secure, isolated code execution (Python/JS)
Everything deploys automatically with proper networking, health checks, and restart policies.
Common Use Cases
Marketing Automation
- Sync leads between CRM, email marketing, and ad platforms
- Process webhooks from landing pages and forms
- Build custom integrations that Zapier doesn't offer
E-Commerce Operations
- Automate order processing and shipping notifications
- Sync products across Shopify, WooCommerce, marketplaces
- Build checkout automation with payment integrations
Data Pipeline & ETL
- Extract data from APIs, databases, and files on schedule
- Transform and load data into warehouses or dashboards
- Monitor pipeline health with error notifications
DevOps & IT Automation
- Automate deployment notifications to Slack/Discord
- Process GitHub/GitLab webhooks for CI/CD
- Sync issues across Jira, Linear, Notion
AI & LLM Workflows
- Build RAG pipelines with vector databases
- Automate content generation with OpenAI, Anthropic
- Create AI chatbots integrated with existing tools
Dependencies for n8n Enterprise-Ready Stack Hosting
| Dependency | Version | Purpose |
|---|---|---|
| n8n | Latest | Workflow automation engine |
| Task Runner | Latest | Unified Python/JS execution engine |
| PostgreSQL | 18 | Primary database with extensions |
| Redis | 7.4 | Queue management for workers |
PostgreSQL Extensions Included
- PostGIS - Geospatial data types
- pgvector - Vector search for AI/ML
- pg_cron - Scheduled jobs in PostgreSQL
- pg_partman - Table partitioning
Deployment Dependencies
| Service | RAM | Est. Cost/mo |
|---|---|---|
| n8n | 1GB | $5-10 |
| n8n-worker x2 | 512MB | $5-10 |
| PostgreSQL Primary | 1GB | $10-15 |
| PostgreSQL Replica | 512MB | $5-8 |
| Redis | 256MB | $3-5 |
| Total | $28-48 |
Architecture Overview
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Railway Project ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā āāāāāāāāāāā āāāāāāāāāāāā āāāāāāāāāāāā āāāāāāāāāāāā ā
ā ā n8n ā ā worker-1 ā ā worker-2 ā ā Task ā ā
ā ā (UI) ā ā (queue) ā ā (queue) ā ā Runner ā ā
ā āāāāāā¬āāāāā āāāāāā¬āāāāāā āāāāāā¬āāāāāā āāāāāā¬āāāāāā ā
ā ā ā ā ā ā
ā ā¼ ā¼ ā¼ ā¼ ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Redis (Queue) ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā ā
ā āāāāāāāāāāāāāāāāāāāāāāā“āāāāāāāāāāāāāāāāāāāāāāā ā
ā ā PostgreSQL HA ā ā
ā ā āāāāāāāāāāā āāāāāāāāāāā ā ā
ā ā ā Primary āāāāāā¶ ā Replica ā ā ā
ā ā āāāāāāāāāāā āāāāāāāāāāā ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Configuration
šÆ Easy Configuration - Single Source of Truth
Edit environment variables in the n8n service only!
This template uses a Single Source of Truth pattern:
- ā Edit environment variables in the n8n service only
- ā
n8n-worker automatically syncs values from n8n via
${{n8n.VARIABLE}} - ā n8n-task-runner automatically syncs required values from n8n
- ā No need to edit ENV in worker or task runner - everything syncs automatically
Example: To change timezone to Asia/Bangkok
- Go to n8n service ā Variables
- Edit
GENERIC_TIMEZONE="Asia/Bangkok"andTZ="Asia/Bangkok" - Done! Worker and Task Runner will use the same values automatically
Auto-Generated Variables
| Variable | Description |
|---|---|
POSTGRES_PASSWORD | PostgreSQL password |
REDIS_PASSWORD | Redis password |
N8N_ENCRYPTION_KEY | Credentials encryption |
N8N_USER_MANAGEMENT_JWT_SECRET | User auth JWT |
N8N_TASKS_RUNNER_AUTH_TOKEN | Secure token for Task Runner |
Customizable Settings (Edit in n8n service only)
| Variable | Default | Description |
|---|---|---|
EXECUTIONS_MODE | queue | Use regular for simple setups |
GENERIC_TIMEZONE | Asia/Bangkok | Your timezone |
TZ | Asia/Bangkok | System timezone |
N8N_CONCURRENCY_PRODUCTION_LIMIT | 10 | Max parallel executions/worker |
N8N_LOG_LEVEL | info | Logging level |
Scaling Guide
Horizontal Scaling
| Daily Executions | Workers |
|---|---|
| < 1,000 | 1 |
| 1,000 - 10,000 | 2-3 |
| 10,000 - 100,000 | 5-10 |
| 100,000+ | 10+ |
Duplicate n8n-worker service to add more workers.
Cost Comparison
| Solution | Monthly | Executions |
|---|---|---|
| Zapier Team | $73.50 | 2,000 |
| Make.com Pro | $16 | 10,000 |
| This Template | ~$35 | Unlimited |
Getting Started
š Simple 3-Step Installation
-
Deploy
- Click the "Deploy on Railway" button above
- Railway will automatically create 7 services:
- PostgreSQL Primary + Replica + Proxy
- Redis
- n8n (Main)
- n8n-worker
- n8n-task-runner
-
Wait for Deployment
- Takes 3-5 minutes
- Verify all services show "Active" (green status)
-
Access n8n
- Click on n8n service ā Settings ā Networking
- Enable Public Domain URL
- Create your first admin account
āļø Customization (Optional)
Want to change timezone or other settings?
- Go to n8n service ā Variables
- Edit the variables you need (e.g.,
GENERIC_TIMEZONE,TZ) - Done! No need to edit worker or task runner
Troubleshooting
ā n8n won't start
- ā Verify PostgreSQL Primary is "Active"
- ā Wait 2-3 minutes for database initialization
- ā
Check that
N8N_ENCRYPTION_KEYwas auto-generated
ā Workers not processing
- ā Verify Redis is "Active"
- ā
Check that
EXECUTIONS_MODE=queuein n8n service - ā Review worker logs for error messages
ā Database connection errors
- ā Wait 2-3 minutes for PostgreSQL Proxy to be ready
- ā Verify passwords match across services
- ā Restart n8n service after PostgreSQL is ready
š” Tips
- View logs at each service ā Deployments ā View Logs
- If issues persist, restart the problematic service
- Edit ENV in n8n service only - workers sync automatically
Why Deploy n8n Enterprise-Ready Stack on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying n8n Enterprise-Ready Stack on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Resources
Support This Project
If this template saves you time and money, consider supporting its development! ā
Your support helps maintain and improve this template for the community. Thank you! š
MIT License | Built with ā¤ļø for Railway and n8n communities
Template Content
postgres-18-replica
icueth/n8n-PostgresHA-RedisHAn8n-worker
icueth/n8n-PostgresHA-RedisHApostgres-18-proxy
icueth/n8n-PostgresHA-RedisHApostgres-18-primary
icueth/n8n-PostgresHA-RedisHAn8n-task-runner
icueth/n8n-PostgresHA-RedisHARedis-n8n
icueth/n8n-PostgresHA-RedisHA