Skip to content

dapplets/n8n-devtun

Repository files navigation

n8n Tunnel Stack

Container stack for exposing an n8n instance through a temporary Cloudflare Tunnel. The setup splits the tunnel sidecars from n8n itself so you can run them together or independently.

Prerequisites

  • Docker Engine 24+
  • Docker Compose V2 (docker compose) or legacy docker-compose
  • Host ports: 5678 for n8n, random high ports opened by Cloudflare tunnel
  • ./runtime, ./local-files, ./shared directories writable by Docker
  • If Docker requires root on your host, prefix commands with sudo (or add your user to the docker group).

Layout

  • docker-compose.tunnel.yml: BusyBox cleaner, Cloudflare tunnel, URL capture sidecar
  • docker-compose.n8n.yml: n8n service, volumes, health check, logging config
  • scripts/: custom entrypoints (n8n-entrypoint.sh, wait-tunnel.sh)
  • runtime/: shared runtime state (cloudflared.log, tunnel_url, n8n.log)
  • compose-up.sh: helper that restarts the stack with both compose files

Starting the stack

./compose-up.sh            # stops existing containers, then runs `docker compose up -d`
# or manually
docker compose \
  -f docker-compose.tunnel.yml \
  -f docker-compose.n8n.yml \
  up -d --remove-orphans

The tunnel URL appears in runtime/tunnel_url; n8n logs are written to runtime/n8n.log.

Stopping

docker compose \
  -f docker-compose.tunnel.yml \
  -f docker-compose.n8n.yml \
  down --remove-orphans

If you previously ran the stack from another directory name, use docker compose --project-name <old-name> down to clean up the old containers.

Verifying

  • Tunnel status: tail -f runtime/cloudflared.log
  • n8n health: docker compose exec n8n node -e "fetch('http://localhost:5678/healthz').then(r=>console.log(r.status)).catch(console.error)"
  • Check tunnel reachability from the tunnel container: docker compose exec tunnel /usr/local/bin/cloudflared --version

Customisation

  • Edit docker-compose.n8n.yml environment variables to adjust n8n behaviour.
  • Override scripts/n8n-entrypoint.sh if you need additional bootstrapping logic.
  • To split stacks or extend services, layer extra compose files with docker compose -f ... -f ... up.

Notes

  • The Cloudflare image is distroless—no shell utilities are available inside the tunnel container.
  • Quick tunnels (trycloudflare.com) have no uptime guarantees; use named tunnels with credentials for production setups.
  • Runtime directory is cleared by the runtime-cleaner service on each start.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages