Lý thuyết
35 phút
Bài 1/15

Deployment Options Overview

So sánh các phương thức deploy n8n - Cloud hosted, self-hosted Docker, VPS, và Kubernetes

🚀 Deployment Options Overview

Server Deployment

Trước khi deploy n8n, bạn cần hiểu các options và trade-offs. Bài này sẽ giúp bạn chọn đúng strategy cho use case của mình.

Deployment Options Matrix

Quick Comparison:

OptionSetup TimeCostControlScaleBest For
n8n Cloud5 min$$$$LowAutoQuick start
Railway15 min$$MediumManualSide projects
Docker VPS1-2 hr$$HighManualProduction
Kubernetes4-8 hr$$$HighestAutoEnterprise

Option 1: n8n Cloud

Pros & Cons:

Text
1✅ PROS:
2• Zero setup/maintenance
3• Auto updates
4• Built-in auth
5• Team features included
6• Support available
7
8❌ CONS:
9• Highest cost ($20-500/mo)
10• Limited customization
11• Data on n8n servers
12• Execution limits
13• No source access

When to Use:

  • Trying n8n first time
  • Don't want ops overhead
  • Budget isn't constraint
  • Need enterprise features fast

Pricing (2024):

Text
1STARTER: $20/mo
2• 2,500 executions
3• 1 user
4
5PRO: $50/mo
6• 10,000 executions
7• 5 users
8
9ENTERPRISE: Custom
10• Unlimited executions
11• SSO, audit logs

Option 2: Platform-as-a-Service (PaaS)

Platforms:

Text
1RAILWAY
2├── Easy Docker deployment
3├── $5-20/mo typical
4├── Auto-sleep (free tier)
5└── Good for dev/staging
6
7RENDER
8├── Free tier available
9├── $7/mo starter
10├── Web service + PostgreSQL
11└── Decent free tier
12
13HEROKU (via Docker)
14├── Established platform
15├── $7-25/mo
16├── Eco dyno sleeps
17└── Good addons marketplace
18
19DIGITALOCEAN APP PLATFORM
20├── Simple interface
21├── $12/mo minimum
22├── Easy database attach
23└── Predictable pricing

Best Choice: Railway

Text
1WHY RAILWAY:
2• One-click n8n template
3• Built-in PostgreSQL
4• Environment variables UI
5• Cheap for small scale
6• Good developer experience
7
8LIMITATION:
9• Sleep after inactivity (free)
10• Less control than VPS
11• Costs grow with usage

Option 3: Self-Hosted VPS

Popular VPS Providers:

Text
1PROVIDER MIN COST BEST FOR
2─────────────────────────────────────
3Hetzner $4/mo Best value
4DigitalOcean $6/mo Good docs
5Vultr $6/mo Many regions
6Linode $5/mo Reliable
7AWS Lightsail $5/mo AWS ecosystem

Recommended Specs:

Text
1SMALL (Personal)
2• 1 vCPU, 2GB RAM
3• 40GB SSD
4• $5-10/mo
5• 100-500 exec/day
6
7MEDIUM (Team)
8• 2 vCPU, 4GB RAM
9• 80GB SSD
10• $15-25/mo
11• 500-5000 exec/day
12
13LARGE (Production)
14• 4 vCPU, 8GB RAM
15• 160GB SSD
16• $40-60/mo
17• 5000+ exec/day

Why Self-Host:

Text
1✅ BENEFITS:
2• Full control over data
3• Lower cost at scale
4• Custom configurations
5• No execution limits
6• Install any node
7
8⚠️ REQUIREMENTS:
9• Linux/Docker knowledge
10• Time for maintenance
11• Backup responsibility
12• Security management

Option 4: Kubernetes

When K8s Makes Sense:

Text
1✅ USE K8S IF:
2• Need high availability
3• 10,000+ executions/day
4• Multiple n8n instances
5• Existing K8s infrastructure
6• Auto-scaling required
7
8❌ SKIP K8S IF:
9• Just starting out
10• Small team
11• Limited ops capacity
12• Budget-conscious

K8s Components Needed:

Text
1N8N ON KUBERNETES
2─────────────────
3
4┌──────────────────────────────────┐
5│ INGRESS │
6│ (nginx/traefik) │
7└─────────────┬────────────────────┘
8
9┌─────────────┴────────────────────┐
10│ N8N DEPLOYMENT │
11│ ┌──────┐ ┌──────┐ │
12│ │ Pod1 │ │ Pod2 │ (HPA) │
13│ └──────┘ └──────┘ │
14└─────────────┬────────────────────┘
15
16┌─────────────┴────────────────────┐
17│ PERSISTENT STORAGE │
18│ PostgreSQL / Redis (Queue) │
19└──────────────────────────────────┘

Architecture Comparison

Simple Setup (VPS):

Text
1┌─────────────────────────────────────┐
2│ VPS │
3│ ┌─────────────────────────────┐ │
4│ │ Docker │ │
5│ │ ┌─────┐ ┌──────┐ │ │
6│ │ │ n8n │──│Postgres│ │ │
7│ │ └──┬──┘ └───────┘ │ │
8│ │ │ │ │
9│ │ ┌──┴───┐ │ │
10│ │ │Nginx │←── HTTPS │ │
11│ │ └──────┘ │ │
12│ └─────────────────────────────┘ │
13└─────────────────────────────────────┘

Production Setup:

Text
1┌────────────────────────────────────────────┐
2│ PRODUCTION STACK │
3│ │
4│ CDN/WAF │
5│ │ │
6│ Load Balancer │
7│ │ │
8│ ┌──┴───┬───────┐ │
9│ │ │ │ │
10│ n8n-1 n8n-2 n8n-3 (Queue Mode) │
11│ │ │ │ │
12│ └──┬───┴───────┘ │
13│ │ │
14│ ┌──┴────────────────────────┐ │
15│ │ PostgreSQL (Primary) │ │
16│ │ Redis (Queue/Session) │ │
17│ │ S3 (Binary storage) │ │
18│ └────────────────────────────┘ │
19└────────────────────────────────────────────┘

Decision Framework

Questions to Ask:

Text
11. BUDGET
2 └── <$20/mo → PaaS/Small VPS
3 └── $20-100/mo → VPS self-host
4 └── $100+/mo → Consider n8n Cloud or K8s
5
62. TECHNICAL SKILL
7 └── Beginner → n8n Cloud
8 └── Can use CLI → PaaS
9 └── Docker comfortable → VPS
10 └── DevOps team → Kubernetes
11
123. DATA SENSITIVITY
13 └── Non-sensitive → Any option
14 └── Business data → Self-host recommended
15 └── Regulated → Self-host required
16
174. SCALE NEEDS
18 └── <1000 exec/day → Any option
19 └── 1000-10000 → VPS or Cloud Pro
20 └── 10000+ → Dedicated VPS or K8s
21
225. UPTIME REQUIREMENTS
23 └── Can tolerate downtime → Any
24 └── 99% uptime → Good VPS + monitoring
25 └── 99.9% uptime → HA setup or K8s

Quick Recommendation:

Text
1JUST STARTING:
2→ Use n8n Cloud free trial
3
4SIDE PROJECT:
5→ Railway (free tier or $5/mo)
6
7SERIOUS PRODUCTION:
8→ Hetzner VPS + Docker ($8-15/mo)
9
10ENTERPRISE:
11→ K8s hoặc n8n Enterprise Cloud

Cost Analysis (1 Year)

Text
1OPTION SETUP MONTHLY YEARLY HIDDEN COSTS
2──────────────────────────────────────────────────────────
3n8n Cloud Pro 0 $50 $600 None
4Railway $0 $15 $180 Overages
5Hetzner VPS $20* $8 $116 Your time
6DigitalOcean $20* $12 $164 Your time
7K8s (managed) $100* $50 $700 Complexity
8
9*One-time setup cost (your time estimated)
10
11WINNER FOR MOST: VPS self-host ($8-15/mo)
12WINNER FOR LAZY: n8n Cloud ($50/mo)

Getting Ready

Pre-Deployment Checklist:

Text
1□ Decide on deployment option
2□ Estimate executions/month
3□ List required integrations
4□ Identify data requirements
5□ Plan backup strategy
6□ Document access credentials
7□ Choose domain name
8□ Set budget
Your Action

Before next lesson:

  1. Choose your deployment path
  2. Sign up for chosen platform
  3. Get domain ready (optional)
  4. Note down credentials needed

We'll start hands-on Docker in next lesson! 🐳

Tiếp Theo

Bài tiếp theo: Docker Basics - Hiểu images, containers, volumes và cách Docker hoạt động cho n8n.