Railway

Deploy n8n Enterprise-Ready Stack

šŸš€ Infinite Scaling n8n + worker + PostgreSQL HA + Redis + Python Runer

Deploy n8n Enterprise-Ready Stack

Just deployed

/var/lib/postgresql/data

Just deployed

Just deployed

Just deployed

/var/lib/postgresql/data

Just deployed

Just deployed

Deploy and Host n8n Enterprise-Ready Stack on Railway

Deploy 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

DependencyVersionPurpose
n8nLatestWorkflow automation engine
Task RunnerLatestUnified Python/JS execution engine
PostgreSQL18Primary database with extensions
Redis7.4Queue 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

ServiceRAMEst. Cost/mo
n8n1GB$5-10
n8n-worker x2512MB$5-10
PostgreSQL Primary1GB$10-15
PostgreSQL Replica512MB$5-8
Redis256MB$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

  1. Go to n8n service → Variables
  2. Edit GENERIC_TIMEZONE="Asia/Bangkok" and TZ="Asia/Bangkok"
  3. Done! Worker and Task Runner will use the same values automatically

Auto-Generated Variables

VariableDescription
POSTGRES_PASSWORDPostgreSQL password
REDIS_PASSWORDRedis password
N8N_ENCRYPTION_KEYCredentials encryption
N8N_USER_MANAGEMENT_JWT_SECRETUser auth JWT
N8N_TASKS_RUNNER_AUTH_TOKENSecure token for Task Runner

Customizable Settings (Edit in n8n service only)

VariableDefaultDescription
EXECUTIONS_MODEqueueUse regular for simple setups
GENERIC_TIMEZONEAsia/BangkokYour timezone
TZAsia/BangkokSystem timezone
N8N_CONCURRENCY_PRODUCTION_LIMIT10Max parallel executions/worker
N8N_LOG_LEVELinfoLogging level

Scaling Guide

Horizontal Scaling

Daily ExecutionsWorkers
< 1,0001
1,000 - 10,0002-3
10,000 - 100,0005-10
100,000+10+

Duplicate n8n-worker service to add more workers.


Cost Comparison

SolutionMonthlyExecutions
Zapier Team$73.502,000
Make.com Pro$1610,000
This Template~$35Unlimited

Getting Started

šŸš€ Simple 3-Step Installation

  1. 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
  2. Wait for Deployment

    • Takes 3-5 minutes
    • Verify all services show "Active" (green status)
  3. 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_KEY was auto-generated

āŒ Workers not processing

  • āœ… Verify Redis is "Active"
  • āœ… Check that EXECUTIONS_MODE=queue in 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! ā˜•

Support Me

Your support helps maintain and improve this template for the community. Thank you! šŸ™


MIT License | Built with ā¤ļø for Railway and n8n communities


Template Content

More templates in this category

View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
View Template
(v1) Simple Medusa Backend
Deploy an ecommerce backend and admin using Medusa

Shahed Nasser
View Template
peppermint
Docker-compose port for peppermint.sh

HamiltonAI