What's the ideal way to self-deploy n8n? (Comparing npm, Docker, and database options)

Hey everyone! I’m trying to figure out the best approach for self-hosting n8n. I’ve played around with it before on a VPS, but now I’m looking for some expert advice.

I’ve tried a few setups:

  1. Docker with Traefik

    • Using Postgres in the same container
    • Postgres as a separate service
    • Postgres on another server
  2. Node/NPX with Nginx

    • Postgres options same as above
  3. Docker without Traefik (using Nginx instead)

I had some trouble with Traefik blocking port 80, and the Docker + Nginx combo gave me webhook issues. The NPX method worked, but I’m not sure if it’s secure enough.

What’s your go-to method? Are there any other options I should consider? I’d love to hear about your experiences and why you prefer certain setups.

Thanks for your help!

For self-deploying n8n, I’ve found that using Docker with a separate Postgres container offers the best balance of simplicity and flexibility. This setup allows for easier updates and backups while keeping the database isolated.

I’d recommend using Docker Compose to manage the containers since it simplifies the process of defining and running multi-container applications. Specifying n8n and Postgres in a single YAML file makes maintenance straightforward.

Regarding reverse proxies, Nginx has proven more reliable in my experience; Traefik, while powerful, can sometimes introduce unnecessary complexity. For security, always use HTTPS, keep containers updated, and manage sensitive data through environment variables.

i’ve been using docker with separate postgres container for n8n and it works great. nginx as reverse proxy solved my webhook issues. make sure to use https and keep everything updated. also, don’t forget to backup your workflows regularly! docker-compose makes managing everything way easier.

I’ve been self-hosting n8n for a while now, and I’ve settled on using Docker with a separate Postgres container. It’s been rock-solid for me.

One thing I’d add is to consider using Docker Swarm if you’re looking to scale. It’s not as complex as Kubernetes, but it gives you some nice orchestration features.

For the reverse proxy, I actually prefer Caddy over Nginx or Traefik. It’s super easy to set up with automatic HTTPS, and I’ve had zero issues with webhooks.

Don’t forget about backups! I use pgbackrest to handle Postgres backups, and I’ve set up a cron job to regularly export n8n workflows. Better safe than sorry.

Lastly, if you’re worried about security, consider running n8n behind a VPN. It adds an extra layer of protection, especially if you’re dealing with sensitive data in your workflows.