n8n / scripts /run-task-runner.sh
subham
Sync local n8n deployment: refactor to single Dockerfile, add runners, sandbox, cleanup legacy compose/nginx
4c98a98
Raw History Blame Contribute Delete
1.14 kB
#!/bin/sh
set -eu
echo "[runner] waiting for n8n http://127.0.0.1:${N8N_PORT:-7860}/healthz"
# Wait for n8n health
for i in $(seq 1 120); do
if curl -fsS "http://127.0.0.1:${N8N_PORT:-7860}/healthz" >/dev/null 2>&1; then
echo "[runner] n8n ready"
break
fi
sleep 1
if [ "$i" -eq 120 ]; then echo "[runner] n8n health timeout, starting runner anyway"; fi
done
# Ensure config exists
if [ ! -f /etc/n8n-task-runners.json ]; then
echo "[runner] missing /etc/n8n-task-runners.json"
fi
# Export required broker envs for launcher (allowed-env list in json permits these)
export N8N_RUNNERS_TASK_BROKER_URI=${N8N_RUNNERS_TASK_BROKER_URI:-http://127.0.0.1:5679}
export N8N_RUNNERS_AUTH_TOKEN=${N8N_RUNNERS_AUTH_TOKEN:-}
export N8N_VERSION=${N8N_VERSION:-2.39.8}
echo "[runner] launching task-runner-launcher -> $N8N_RUNNERS_TASK_BROKER_URI mode=${N8N_RUNNERS_MODE:-external}"
# Use allowlisted envs only — launcher filters, but broker URI/token must be passed via env file or args
# Launcher reads N8N_RUNNERS_TASK_BROKER_URI etc. via allowed-env; we export them
exec /usr/local/bin/task-runner-launcher javascript python