n8n Docker Compose Generator

Enter your domain and copy a ready n8n setup with HTTPS and PostgreSQL. The passwords are made in your browser and never sent to us.

docker-compose.ymlEnter your domain to copy it
services:
  caddy:
    image: caddy:2
    restart: unless-stopped
    command: caddy reverse-proxy --from n8n.example.com --to n8n:5678
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - caddy_data:/data

  n8n:
    image: docker.n8n.io/n8nio/n8n:stable
    restart: unless-stopped
    environment:
      N8N_HOST: n8n.example.com
      N8N_PROTOCOL: https
      N8N_WEBHOOK_URL: https://n8n.example.com/
      N8N_EDITOR_BASE_URL: https://n8n.example.com/
      N8N_PROXY_HOPS: "1"
      N8N_ENCRYPTION_KEY: "made-for-you"
      GENERIC_TIMEZONE: Asia/Kolkata
      TZ: Asia/Kolkata
      N8N_RUNNERS_MODE: external
      N8N_RUNNERS_AUTH_TOKEN: "made-for-you"
      N8N_RUNNERS_BROKER_LISTEN_ADDRESS: 0.0.0.0
      DB_TYPE: postgresdb
      DB_POSTGRESDB_HOST: postgres
      DB_POSTGRESDB_DATABASE: n8n
      DB_POSTGRESDB_USER: n8n
      DB_POSTGRESDB_PASSWORD: "made-for-you"
    depends_on:
      postgres:
        condition: service_healthy
    volumes:
      - n8n_data:/home/node/.n8n

  n8n-runner:
    image: n8nio/runners:stable
    restart: unless-stopped
    environment:
      N8N_RUNNERS_AUTH_TOKEN: "made-for-you"
      N8N_RUNNERS_TASK_BROKER_URI: http://n8n:5679
    depends_on:
      - n8n

  postgres:
    image: postgres:18
    restart: unless-stopped
    environment:
      POSTGRES_USER: n8n
      POSTGRES_DB: n8n
      POSTGRES_PASSWORD: "made-for-you"
      PGDATA: /var/lib/postgresql/data
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U n8n -d n8n"]
      interval: 5s
      timeout: 5s
      retries: 10

volumes:
  caddy_data:
  n8n_data:
  postgres_data:

VPS we suggest for n8n

Cloud XS

2 vCore · 4GB RAM · 40GB NVMe

₹1,000/mo + 18% GST

Order Cloud XSCompare all VPS plans

How to install n8n with this file

  1. Point your domain to your server: add an A record with the server's IP address.
  2. Install Docker. Our setup script generator can do it for you.
  3. On the server, run mkdir n8n && cd n8n, then save the file there as docker-compose.yml.
  4. Run docker compose up -d and wait about a minute.
  5. Open your domain straight away and create the owner account, so nobody else does it first.

Common questions

What is the encryption key for?

n8n uses it to lock your saved passwords and API keys. Keep a copy of the file somewhere safe. Without the key, you can't recover them.

Should I use PostgreSQL or SQLite?

Use PostgreSQL for anything you rely on. SQLite is fine for a quick test.

How do I update n8n?

Run docker compose pull, then docker compose up -d in the same folder. Back up first.

What size VPS do I need?

We suggest 2 vCores and 4GB RAM for several workflows.