Choosing between hosted n8n services and a self-hosted setup is often a trade-off between control and ongoing costs. In 2025, you have a range of options from cheap VPSs to fully managed platforms like FlowEngine, plus the ongoing evolution of n8n itself. This guide walks you through a production-ready self-hosted n8n deployment on Ubuntu 24.04 using Docker Compose, including a PostgreSQL database, Redis queue, and a secure reverse proxy with TLS. You’ll see concrete numbers, a tested Docker Compose example, and practical guidance on backups, security, and scaling. By the end, you’ll understand when self-hosting makes sense for your team and how to estimate ongoing costs compared to managed options.
What you’ll build: a single n8n instance backed by PostgreSQL and Redis, accessible over HTTPS, with basic authentication and a simple backup strategy. The setup is described with production-grade defaults, suitable for small teams or bootstrapped startups that want predictable infrastructure without letting cloud bills creep up. We’ll also discuss when a managed option like FlowEngine or n8n Cloud makes more sense, so you can compare the total cost of ownership.
What you’ll learn
- How to run n8n in Docker Compose on Ubuntu 24.04 with PostgreSQL and Redis.
- How to expose n8n behind a secure Nginx reverse proxy and enable TLS via Let’s Encrypt.
- Best practices for authentication, backups, and basic hardening.
- How to scale with multiple n8n instances using a Redis queue and a shared database.
- A practical cost analysis comparing self-hosting with popular cloud options in 2025.
Prerequisites
- A server running Ubuntu 24.04 LTS or newer with 2–4 GB of RAM for a small setup; 4 GB is preferred for modest traffic.
- Root or sudo access to the server.
- A registered domain (e.g., example.com) and DNS control to create A/AAAA records.
- Basic familiarity with Linux commands, Docker, and editing text files.
- Ports 80 and 443 open to the world (for TLS termination with Let's Encrypt).
Why self-hosting, and how it stacks up against managed options
Self-hosted n8n gives you predictable costs and full control over data and configuration. It’s usually cheaper at scale than pay-as-you-go hosted services, assuming you’re comfortable with maintenance. On the flip side, managed options reduce operational overhead but come with higher ongoing costs and potential vendor lock-in. In 2025, a typical comparison looks like this:
| Option | Typical monthly cost (small workload) | Control / trade-offs |
|---|---|---|
| Self-hosted n8n (Ubuntu + Docker) | €3.5–€8/mo for a 2–4 GB RAM VPS; additional costs for data/store | Full control, no vendor lock-in, needs maintenance |
| Railway / Render (hosted) | Usage-based; often €5–€30/mo for small apps; scaling up | Low ops, simpler setup, recurring costs |
| FlowEngine (managed n8n hosting) | Typically higher per-month but includes managed hosting and support | Less maintenance, predictable billing, data residency choices |
| n8n Cloud (official) | Subscription tiers based on workflows | Managed, easy onboarding, less customization |
Notes: pricing varies by provider and region. Always verify current rates and any data transfer costs. For a small team, self-hosting on a cheap VPS can be cheaper than paid plans, but you’ll trade off ease of use and support. For teams that must move fast, a managed option may be preferable despite higher monthly costs.
High-level architecture for a production-ready self-hosted n8n
This is a minimal but robust stack that you can grow later:
- n8n running in Docker containers
- PostgreSQL as the relational database
- Redis for job queueing and caching
- Nginx as a reverse proxy with TLS termination
- Let's Encrypt for free TLS certificates
- Optional: separate backups and monitoring (Prometheus/Grafana)
Step-by-step: Docker Compose production for n8n on Ubuntu 24.04
Below is a production-oriented Docker Compose setup that wires n8n to PostgreSQL and Redis, with a reverse-proxy layer for TLS. Adapt the values to your domain and environment. This example keeps credentials in the compose file for simplicity; for real deployments, consider using a secret manager or Docker Swarm/Kubernetes secrets.
version: