Home / Guides / n8n

Automation with n8n on your own server

n8n connects services with visual workflows: “when this happens, do that”. Self-hosted, your executions are unlimited, your credentials stay on your server, and webhooks answer from your own domain.

1. Install Docker and run n8n

apt update && apt install -y docker.io docker-compose-v2
mkdir -p /opt/n8n && cd /opt/n8n
cat > docker-compose.yml <<'EOF'
services:
  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: unless-stopped
    ports:
      - "127.0.0.1:5678:5678"
    environment:
      - N8N_HOST=n8n.example.com
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://n8n.example.com/
      - GENERIC_TIMEZONE=Europe/Berlin
    volumes:
      - ./data:/home/node/.n8n
EOF
docker compose up -d

Everything n8n knows — workflows, credentials, execution history — lives in /opt/n8n/data. That folder is your backup.

2. HTTPS via Caddy

apt install -y caddy
cat > /etc/caddy/Caddyfile <<'EOF'
n8n.example.com {
    reverse_proxy 127.0.0.1:5678
}
EOF
systemctl reload caddy

Point the A record at your server first. Open https://n8n.example.com, create the owner account, and n8n is live.

3. First workflow: Telegram alert on schedule

Add a Schedule Trigger node (every hour), then a Telegram node with your bot token. Send yourself a message — done, you have a heartbeat monitor. The interesting part starts when webhooks arrive:

https://n8n.example.com/webhook/your-path

Point any service at that URL and n8n reacts — payments, form submissions, monitoring alerts, Git pushes.

4. Practical recipes

Order notifications from your billing into Telegram. Daily database dumps uploaded to storage. RSS to email digests. Scrape a status page and alert when it changes. With the SSH and HTTP nodes, n8n can even run commands on your other servers — a tiny self-hosted Zapier with no per-task pricing.

5. Backups and updates

cd /opt/n8n
docker compose stop
tar czf /root/n8n-backup-$(date +%F).tar.gz data
docker compose pull && docker compose up -d

Update by pulling the new image; workflows live in the mounted volume and survive. Copies of that archive belong off-site — restic guide.

Quick answers

Why self-host n8n instead of using the cloud version?

Unlimited executions instead of counted ones, credentials and data on your own server, webhooks on your own domain, and a flat monthly cost of a small VPS instead of usage-based pricing.

How much RAM does n8n need?

Around 300–500 MB idle, more during heavy workflow runs. A 2 GB VPS runs n8n comfortably; pick 4 GB if it runs big batch jobs or shares the machine with a database.

Is it safe to expose n8n to the internet?

With HTTPS and a strong password, yes — that is how webhooks are meant to work. For extra safety, restrict the editor with Caddy basic auth and keep webhook paths long and random.

n8n on Buran-1 (€6.5/mo) replaces a whole SaaS subscription.

Related