Deploy N8N
n8n in queue mode: main, workers, Redis and Postgres. Scale workers.
Just deployed
Redis
Just deployed
/data
n8n-worker
Just deployed
Just deployed
/var/lib/postgresql/data
Deploy and Host N8N on Railway
This variant: n8n in queue mode with workers. A main instance, a worker service you can scale, Redis and Postgres. n8n is an open-source workflow automation platform with 400+ integrations, AI agent nodes and a visual editor: a self-hosted alternative to Zapier and Make with no per-execution fees.
About Hosting N8N
This template deploys n8n's scaling architecture as four services:
n8n: the editor, API, triggers and webhooks. It turns every trigger into a job on the queue instead of running it.n8n-worker: pulls jobs from Redis and runs the executions, including test runs from the editor.Redis: the job queue.Postgres: workflows, credentials, execution history and binary data.
Every n8n service is pinned to 2.40.7. The first boot runs n8n's database migrations, which takes about a minute before the healthchecks on /healthz/readiness turn green. Then open the public URL and create the owner account right away: the first visitor to an unclaimed instance becomes its owner.
Common Use Cases
- Run heavy or long workflows without slowing down the editor
- Absorb bursts of webhooks and scheduled jobs by adding worker replicas
- Build production AI agents and automations for a team
Dependencies for N8N Hosting
- Nothing to bring. Every secret (Postgres and Redis passwords, n8n encryption key) is generated at deploy time.
- Optional: API keys for the services your workflows connect to, added later as n8n credentials.
Deployment Dependencies
- n8n: https://github.com/n8n-io/n8n
- Docker image: https://hub.docker.com/r/n8nio/n8n
- Queue mode docs: https://docs.n8n.io/hosting/scaling/queue-mode/
Implementation Details
- Other N8N variants. This creator also publishes n8n with Postgres only, workers plus webhook processors behind one URL, a single-service SQLite version, and a version with external task runners for Python Code nodes.
- Scaling. Add replicas to
n8n-workerin its settings, or raiseN8N_CONCURRENCY_PRODUCTION_LIMIT(executions per replica, default 10; n8n recommends 5 or more). - Shared settings. Workers read
N8N_ENCRYPTION_KEY, the URLs and the timezone fromn8nthrough reference variables, so they always match the main instance. Back up the encryption key: without it, stored credentials cannot be decrypted. - No volumes on n8n services. In queue mode n8n stores binary data in Postgres by default, and
N8N_REINSTALL_MISSING_PACKAGES=truereinstalls community nodes on every boot of every service, so nothing needs a disk. - Worker health.
QUEUE_HEALTH_CHECK_ACTIVE=trueturns on the worker's/healthz/readiness, which only passes once the worker can reach Postgres and Redis. - Custom domain. After adding one, set
N8N_EDITOR_BASE_URLandN8N_WEBHOOK_URLonn8ntohttps://your-domain; the worker picks them up by reference. - Upgrading. Main and workers must run the same version. Change the
n8nio/n8ntag on both services, then redeploy both.
Why Deploy N8N 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 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.
Template Content
Redis
redis:8.2n8n-worker
n8nio/n8n:2.40.7