logo
icon

N8N v2 with Worker & Task Runners

N8N v2 workflow automation with worker and external task runners for secure code execution

template cover
Dideploy693 kali
Penerbitglasschan
Dibuat2025-03-04
Tag
AutomationWorkflowN8N v2Task RunnersCode Execution

N8N v2 with Worker & Task Runners (create by SEAFOODHOLDHAND)

N8N with Worker

N8N v2 is a powerful workflow automation platform that helps you connect different services and automate tasks. This template includes:

  • N8N v2 main instance for workflow management (latest version)
  • N8N worker for processing background tasks
  • External Task Runners for secure Code node execution (production-ready setup)
  • PostgreSQL database for data storage
  • Redis for queue management

Why External Task Runners?

This template uses external task runners - N8N's recommended production setup for executing code in Code nodes:

  • 🔒 Enhanced Security: Code runs in isolated containers, separate from your main N8N instance
  • ⚡ Better Performance: Task runners can scale independently based on workload
  • 🛡️ Sandboxed Execution: JavaScript and Python code execute in controlled environments
  • 🔄 Auto-Shutdown: Idle runners automatically shut down after 15 seconds to save resources
  • 📊 Production Ready: Follows N8N's best practices for production deployments

With N8N v2, you can:

  • Create automated workflows with the visual editor
  • Connect to hundreds of services and APIs
  • Execute custom JavaScript and Python code securely in Code nodes
  • Process data and automate tasks with reliable background workers
  • Handle webhook-triggered workflows efficiently

The worker + task runner setup ensures your automation tasks are processed reliably and securely.

Update Log

2026-08-02

  • Removed N8N-Runners service: With OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS=true + queue mode, the main N8N instance never starts a task broker on port 5679 — all executions (manual and production) are offloaded to the Worker. N8N-Runners was permanently stuck on "Waiting for task broker to be ready" and served no purpose. Also removed the taskbroker port (5679) and N8N_RUNNERS_BROKER_LISTEN_ADDRESS from the N8N service. Only Worker-Runners remains (the Worker does run a broker).
  • Fixed Code node execution (Worker-Runners): Changed Worker-Runners N8N_RUNNERS_TASK_BROKER_URI from http://Worker:5679 to http://${WORKER_BROKER_HOST}:5679. Zeabur's in-cluster DNS resolves service-<id> hostnames, not bare service names like Worker — runners were stuck on "Waiting for task broker to be ready" indefinitely, and Code nodes timed out after 60 seconds. The Worker service now exposes its internal hostname (WORKER_BROKER_HOST) via ${CONTAINER_HOSTNAME} for the runner to consume. (N8N_RUNNERS_ENABLED is deprecated in n8n v2 and intentionally not set — see docs.)
  • Fixed "Invalid URL" error on every node execution: Added N8N_PROTOCOL=https to both N8N and Worker. n8n builds $execution.resumeUrl from ${N8N_PROTOCOL}://${N8N_HOST}/...; without the protocol, the URL is malformed and every node (Set, Switch, Code, etc.) throws TypeError: Invalid URL.
  • Fixed Worker webhook URL resolution: The Worker service has no domain binding of its own, so ${ZEABUR_WEB_DOMAIN} / ${ZEABUR_WEB_URL} are unset in its container. Now consumes ${N8N_WEBHOOK_HOST} / ${N8N_WEBHOOK_URL} (newly exposed by the N8N service) for N8N_HOST and WEBHOOK_URL.

2026-07-31

  • Added healthChecks to PostgreSQL, Redis, N8N, and Worker so services wait for their dependencies before starting (no more startup race)
  • Upgraded PostgreSQL to 18 (postgres:18 — volume now mounts at /var/lib/postgresql for the new data-dir layout)
  • The N8N encryption key is no longer shown in the deploy instructions (kept secret — anyone holding it can decrypt all workflow credentials; find it under the N8N service's environment variables if you ever need it)
  • Removed the stale TASK_RUNNERS_AUTH_TOKEN variable from the localized setup screens (the token is auto-generated and shared between services automatically)

2026-03-23

  • Fixed service dependencies placement to comply with Zeabur template schema (moved from inside spec to service level), ensuring correct startup ordering
  • Removed deprecated N8N_RUNNERS_ENABLED environment variable (task runners are enabled by default in N8N v2)
  • Fixed task runner architecture: Split single Runners into N8N-Runners (connects to http://N8N:5679) and Worker-Runners (connects to http://Worker:5679), matching the official n8n docker-compose setup where each n8n instance needs its own dedicated runner

2025-12-28

  • IMPORTANT: Template updated for N8N v2 compatibility
  • Upgraded to external task runners (production-recommended setup)
  • Added separate task-runners service as a sidecar to n8n-worker
  • Configured N8N_RUNNERS_MODE=external for better security and performance
  • Task runners now execute Code node JavaScript/Python code in isolated containers
  • Added TASK_RUNNERS_AUTH_TOKEN variable for secure broker-runner authentication

This update ensures your N8N v2 workflows run securely with external task runners, following N8N's best practices for production deployments.

2025-03-17

  • Fixed N8N_ENCRYPTION_KEY mismatch between n8n main instance and worker
  • Ensured worker uses the same encryption key as main instance for improved system stability
  • Added ability to manually set N8N_ENCRYPTION_KEY for both main instance and workers

⚠️ Important: If you're using a previous version of this template, please update to this version to avoid potential encryption key synchronization issues.

Note: This template enables critical environment variables to prevent future compatibility issues:

  • N8N_RUNNERS_MODE=external: Uses external task runner containers (recommended for production) instead of internal child processes.

  • OFFLOAD_MANUAL_EXECUTIONS_TO_WORKERS=true: Running manual executions in the main instance in scaling mode is deprecated. Manual executions will be routed to workers in a future version. This setting prepares your deployment for this change.

Learn more about task runners: https://docs.n8n.io/hosting/configuration/task-runners/

This template has been logically designed and tested to work successfully. As a nocode user, I welcome any suggestions or improvements on GitHub. I'll do my best to update the template (with AI's help) since I'm not very familiar with GitHub.

If you encounter any issues during deployment, please let me know via GitHub issues: https://github.com/glasschan/seafoodholdhand-zeabur-templates