Skip to content

Instantly share code, notes, and snippets.

@Amitind
Created August 1, 2025 16:58
Show Gist options
  • Select an option

  • Save Amitind/f122ad24d18811eaa5f026ce1378639f to your computer and use it in GitHub Desktop.

Select an option

Save Amitind/f122ad24d18811eaa5f026ce1378639f to your computer and use it in GitHub Desktop.
N8N Self Host Docker
services:
n8n:
image: docker.n8n.io/n8nio/n8n:latest
container_name: n8n
restart: unless-stopped
# ports:
# - 5678:5678 #no need to expose port as we are using cloudflare tunnel
environment:
- N8N_HOST=n8n.example.com # replace with your domain
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://n8n.example.com/ # replace with your domain
- GENERIC_TIMEZONE=Asia/Kolkata # change timezone
- N8N_SECURE_COOKIE=true
volumes:
- ./n8n_data:/home/node/.n8n # saving data locally not using docker volumes
cloudflared:
image: cloudflare/cloudflared:latest
pull_policy: always
container_name: cloudflared-n8n
env_file: .env
depends_on:
- n8n
restart: unless-stopped
command: tunnel --retries 13 --grace-period 20s --no-autoupdate run --token ${CLOUDFLARE_TUNNEL_TOKEN} # don't forget to add .env file and cloudflare tunnel token
volumes:
- ./cloudflared:/etc/cloudflared
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment