Deploy n8n-workers-template
n8n queue mode: Primary+Worker+Redis+Postgres. No API keys.
Worker
Just deployed
Postgres
Just deployed
/var/lib/postgresql/data
Redis
Just deployed
/data
Primary
Just deployed
/home/node/.n8n
Deploy and Host n8n with Workers on Railway
Advanced n8n on Railway in queue mode: Primary (editor + webhooks) + Worker + Redis + Postgres. This is the scalable stack on c17.io/stacks/n8n-workers.
For personal / light use, prefer the simpler two-service template: 9o4t/n8n → c17.io/stacks/n8n-automation.
No LLM or SaaS API keys are required to boot. Railway injects PORT. The template generates N8N_ENCRYPTION_KEY (shared by Primary and Worker) and wires WEBHOOK_URL to the public domain.
Cost note: four services (Primary, Worker, Redis, Postgres) cost more than the simple n8n + Postgres stack. Use this when concurrent workflows or heavy jobs would slow the editor.
About Hosting n8n with Workers
Queue mode separates the UI from execution:
Browser / Webhooks → Primary (n8n start)
↓
Redis (Bull queue)
↓
Worker (n8n worker)
↓
Postgres
| Service | Source | Public | Notes |
|---|---|---|---|
Primary | Docker image n8nio/n8n | Yes | n8n start. Health GET /healthz. Volume /home/node/.n8n. |
Worker | Docker image n8nio/n8n | No | n8n worker. Shares DB, Redis, and encryption key. |
Redis | redis:7-alpine (or Railway Redis) | No | Bull queue broker. |
Postgres | postgres:16 | No | Workflows, credentials, execution history. |
Both Primary and Worker need EXECUTIONS_MODE=queue and the same N8N_ENCRYPTION_KEY. Losing the key makes stored credentials unreadable.
The first account you create in the editor is the owner. There is no default username or password.
Common Use Cases
- High-volume webhooks without blocking the editor
- Concurrent / heavy workflows offloaded to workers
- Scale throughput by adding Worker replicas
- Production-style automation where UI and execution stay separate
Dependencies for n8n with workers Hosting
Required (wired or generated — you do not type these)
| Variable | Service | Source |
|---|---|---|
PORT | Primary / Worker | 5678 (Railway may also inject) |
EXECUTIONS_MODE | Primary / Worker | queue |
N8N_ENCRYPTION_KEY | Primary | Generated. Worker refs ${{Primary.N8N_ENCRYPTION_KEY}} |
WEBHOOK_URL | Primary | https://${{RAILWAY_PUBLIC_DOMAIN}} |
N8N_EDITOR_BASE_URL | Primary | https://${{RAILWAY_PUBLIC_DOMAIN}} |
DB_TYPE | Primary / Worker | postgresdb |
DB_POSTGRESDB_* | Primary / Worker | Refs to Postgres |
QUEUE_BULL_REDIS_* | Primary / Worker | Refs to Redis |
QUEUE_BULL_REDIS_DUALSTACK | Primary / Worker | true (Railway private DNS is IPv6) |
OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS | Primary / Worker | true |
Optional
| Variable | Required | Why |
|---|---|---|
GENERIC_TIMEZONE | No | Cron timezone, e.g. America/New_York. Default UTC. |
| Slack / OpenAI / Google keys | No | Added inside n8n credentials after deploy. BYO. |
Volumes
| Mount | Service | Why |
|---|---|---|
/home/node/.n8n | Primary | Settings, binary data. Keep even with Postgres. |
/var/lib/postgresql/data | Postgres | Database files |
/data | Redis | AOF / RDB persistence |
Worker is stateless by default (no volume).
Why Deploy n8n Workers on Railway?
The simple n8n + Postgres template is cheaper and enough for most personal graphs. This workers stack costs more because Redis and a Worker run continuously — worth it when the editor would otherwise stall under load. Trial credits cover the first deploy for most people. c17 never charges you — Railway usage is the referral / template kickback.
See TEMPLATE.md for the marketplace / composer shape.
Run locally
cp .env.example .env
# set POSTGRES_PASSWORD, REDIS_PASSWORD, N8N_ENCRYPTION_KEY (openssl rand -hex 32)
docker compose up
Editor: http://localhost:5678 — create the first owner account. Worker logs should show it consuming the queue.
License
n8n is fair-code (Sustainable Use License). This repo is config and docs only.
Template Content
Worker
n8nio/n8nPORT
DB_TYPE
NODE_OPTIONS
EXECUTIONS_MODE
N8N_LISTEN_ADDRESS
N8N_RUNNERS_ENABLED
QUEUE_BULL_REDIS_DUALSTACK
ENABLE_ALPINE_PRIVATE_NETWORKING
OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS
Postgres
postgres:16PGDATA
PGPORT
PGUSER
PGDATABASE
PGPASSWORD
POSTGRES_DB
POSTGRES_USER
POSTGRES_PASSWORD
Redis
redis:7-alpineREDISPORT
REDISUSER
REDIS_PASSWORD
Primary
9o4t/n8n-workersPORT
DB_TYPE
N8N_PROTOCOL
NODE_OPTIONS
EXECUTIONS_MODE
N8N_ENCRYPTION_KEY
N8N_LISTEN_ADDRESS
N8N_RUNNERS_ENABLED
QUEUE_BULL_REDIS_DUALSTACK
ENABLE_ALPINE_PRIVATE_NETWORKING
OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS
N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS