Self-hosted n8n workflow automation platform using Docker. Works on macOS (for testing) and Raspberry Pi (for production).
- Docker and Docker Compose installed
- For Raspberry Pi: Docker installed on Raspbian/Raspberry Pi OS
git clone <your-repo-url>
cd n8n-selfhost
cp .env.example .env
Edit .env
and update the following:
N8N_BASIC_AUTH_USER
: Your usernameN8N_BASIC_AUTH_PASSWORD
: Your passwordGENERIC_TIMEZONE
: Your timezone (e.g.,Asia/Tokyo
,America/New_York
)
docker-compose up -d
Open your browser and navigate to:
- Local: http://localhost:5678
- Network: http://:5678
Login with the credentials you set in the .env
file.
Before deploying to Raspberry Pi, test everything on your MacBook:
# Start n8n
docker-compose up -d
# View logs
docker-compose logs -f
# Stop n8n
docker-compose down
# Stop and remove volumes (reset everything)
docker-compose down -v
-
Copy the entire directory to your Raspberry Pi:
scp -r . pi@<raspberry-pi-ip>:~/n8n-selfhost
-
SSH into your Raspberry Pi:
ssh pi@<raspberry-pi-ip>
-
Navigate to the directory and start:
cd ~/n8n-selfhost docker-compose up -d
N8N_PORT
: Port to run n8n on (default: 5678)N8N_BASIC_AUTH_ACTIVE
: Enable/disable basic auth (default: true)N8N_BASIC_AUTH_USER
: Username for loginN8N_BASIC_AUTH_PASSWORD
: Password for loginN8N_HOST
: Hostname (default: localhost)N8N_PROTOCOL
: Protocol (http or https)WEBHOOK_URL
: Webhook URL for external accessGENERIC_TIMEZONE
: Timezone setting
- Workflow data is stored in the Docker volume
n8n_data
- The
local-files
directory can be used to share files with n8n
# Start n8n
docker-compose up -d
# Stop n8n
docker-compose down
# View logs
docker-compose logs -f n8n
# Restart n8n
docker-compose restart
# Update to latest version
docker-compose pull
docker-compose up -d
# Backup data
docker run --rm -v n8n-selfhost_n8n_data:/data -v $(pwd):/backup alpine tar czf /backup/n8n-backup.tar.gz -C /data .
# Restore data
docker run --rm -v n8n-selfhost_n8n_data:/data -v $(pwd):/backup alpine tar xzf /backup/n8n-backup.tar.gz -C /data
- Change the default password in
.env
- For production use, consider setting up HTTPS with a reverse proxy (nginx/Traefik)
- Keep your
.env
file secure and never commit it to git - Regularly update n8n to the latest version
Change N8N_PORT
in .env
to a different port.
Make sure your firewall allows the port and use your machine's IP address instead of localhost.
For better performance on Raspberry Pi, consider using Raspberry Pi 4 with at least 2GB RAM.
MIT