Deploy n8n
Fair-code workflow automation tool. Easily automate tasks across different services.
⭐ 49.0k stars📜 Sustainable Use License🔴 Advanced⏱ ~20 minutes
What You’ll Get
A fully working n8n instance running on your server. Your data stays on your hardware — no third-party access, no usage limits, no surprise invoices.
Prerequisites
- A server with Docker and Docker Compose installed (setup guide)
- A domain name pointed to your server (optional but recommended)
- Basic terminal access (SSH)
The Config
Create a directory for n8n and add this docker-compose.yml:
# -------------------------------------------------------------------------
# 🚀 Created and distributed by The AltStack
# 🌍 https://thealtstack.com
# -------------------------------------------------------------------------
version: '3.8'
services:
n8n:
image: n8nio/n8n:latest
container_name: n8n
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=password
- N8N_HOST=localhost
- N8N_PORT=5678
- N8N_PROTOCOL=http
- NODE_ENV=production
- WEBHOOK_URL=http://localhost:5678/
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:Let’s Ship It
# Create a directory
mkdir -p /opt/n8n && cd /opt/n8n
# Create the docker-compose.yml (paste the config above)
nano docker-compose.yml
# Pull images and start
docker compose up -d
# Watch the logs
docker compose logs -fEnvironment Variables
| Variable | Default | Required |
|---|---|---|
N8N_BASIC_AUTH_ACTIVE | true | No |
N8N_BASIC_AUTH_USER | admin | No |
N8N_BASIC_AUTH_PASSWORD | password | No |
N8N_HOST | localhost | No |
N8N_PORT | 5678 | No |
N8N_PROTOCOL | http | No |
NODE_ENV | production | No |
WEBHOOK_URL | http://localhost:5678/ | No |
Post-Deployment Checklist
- Service is accessible on the configured port
- Admin account created (if applicable)
- Reverse proxy configured (Caddy guide)
- SSL/HTTPS working
- Backup script set up (backup guide)
- Uptime monitor added (Uptime Kuma)
The “I Broke It” Section
Container won’t start?
docker compose logs n8n | tail -50Port already in use?
# Find what's using the port
lsof -i :PORT_NUMBERNeed to start fresh?
docker compose down -v # ⚠️ This deletes volumes/data!
docker compose up -d