π Automation Stack β Full Self-Hosted Deployment Guide
This repo sets up:
- n8n automation with Redis & PostgreSQL
- WhatsApp MCP (Multi-tool control API)
- React dashboard at
/ui
- Cloudflare tunneling (HTTPS access without ports)
- Auto-start & daily Postgres backup
- A domain name (required for Cloudflare tunnels)
- Docker & Docker Compose
- curl, git, and crontab (Linux)
git clone https://github.com/Zie619/automation-stack.git
cd automation-stack
Linux:
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared-linux-amd64.deb
Mac:
brew install cloudflared
Windows:
winget install --id Cloudflare.cloudflared
# or
choco install cloudflared
cloudflared tunnel login
cloudflared tunnel create n8n-tunnel-example
After login, note the JSON credentials path. For example:
/root/.cloudflared/ac167143-2428-4b3c-91fc-0d1579e984cf.json
Linux:
sudo nano /etc/cloudflared/config.yml
Windows: Edit C:\Users\Administrator\.cloudflared\config.yml
tunnel: n8n-tunnel
credentials-file: /root/.cloudflared/your-tunnel.json
ingress:
- hostname: n8n.yourdomain.com
service: http://localhost:5678
- hostname: whatsapp.yourdomain.com
service: http://localhost:8000
- hostname: dashboard.yourdomain.com
service: http://localhost:5137
- service: http_status:404
in cloudflare go to the dns managment and add the domains as in the image whatsapp.yourdomain.com and dashboard.yourdomain.com
sudo tee /etc/systemd/system/cloudflared.service > /dev/null <<EOF
[Unit]
Description=cloudflared
After=network.target
[Service]
ExecStart=/usr/bin/cloudflared --no-autoupdate --config /etc/cloudflared/config.yml tunnel run
Restart=always
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable cloudflared
sudo systemctl start cloudflared
Open terminal and run:
cloudflared tunnel run n8n-tunnel-example
Create a .env
file in the root folder:
# PostgreSQL
POSTGRES_USER=yourusername
POSTGRES_PASSWORD=yourpassword
POSTGRES_DB=n8n
POSTGRES_PORT=5432
POSTGRES_HOST=postgres
# Redis
REDIS_HOST=redis
QUEUE_MODE=redis
# n8n
N8N_PORT=5678
N8N_AUTH_ACTIVE=true
N8N_AUTH_USER=yourusername
N8N_AUTH_PASS=yourpassword
N8N_BASE_URL=https://n8n.yourdomain.com
N8N_WEBHOOK_URL=https://n8n.yourdomain.com
# WhatsApp MCP
MCP_PORT=8000
MCP_AUTH_USER=yourusername
MCP_AUTH_PASS=yourpassword
Build React UI (required only if using dashboard):
cd whatsapp-mcp/whatsapp-dashboard
npm install
npm run build
Build Docker containers:
cd automation-stack
docker compose build
docker compose up -d
π‘ Don't want the UI?
Comment/remove this line in docker-compose.yml
under whatsapp-mcp-server
service:
- ./whatsapp-mcp/whatsapp-dashboard/dist:/app/whatsapp-mcp-server/ui
crontab -e
Paste the following:
@reboot sleep 30 && cd /root/n8n && docker compose up -d
@reboot sleep 60 && cd /root/automation-stack && docker compose build whatsapp-mcp-server && docker compose up -d whatsapp-mcp-server
0 2 * * * /root/backup_postgres.sh
Backups are saved automatically in n8n_postgres_backups/
To restore:
docker exec -i n8n-postgres psql -U yourusername -d n8n < backup_file.sql
Use Basic Auth:
- Username:
MCP_AUTH_USER
- Password:
MCP_AUTH_PASS
Run tool:
POST https://whatsapp.yourdomain.com/run_tool
List GPT-compatible tools:
GET https://whatsapp.yourdomain.com/openai-tools
Output format is OpenAI function-call compatible.
UI location: https://whatsapp.yourdomain.com/ui
Rebuild after changes:
cd whatsapp-mcp/whatsapp-dashboard
npm run build
cd automation-stack
docker compose build whatsapp-mcp-server
docker compose up -d whatsapp-mcp-server
Before using the WhatsApp MCP server, you must link a WhatsApp account to it by scanning a QR code.
- Ensure the WhatsApp bridge container is running:
docker ps | grep whatsapp-bridge
If it's not running:
docker compose up -d whatsapp-bridge
- View the QR code from logs:
docker logs -f whatsapp-bridge
Scroll up until you see a QR code printed as ASCII art in the terminal.
- Open WhatsApp on your phone:
- Go to Settings β Linked Devices
- Tap Link a Device
- Scan the QR code displayed in the terminal
- Wait for confirmation. The terminal will show
authenticated
orready
.
You are now connected. Your WhatsApp account is ready to send/receive messages via the MCP tools.
Let me know if you want this injected directly into the README file as well.
Subdomain | Description |
---|---|
n8n.yourdomain.com | n8n Automation Interface |
whatsapp.yourdomain.com | WhatsApp MCP API & UI |
dashboard.yourdomain.com | Optional: React Dashboard UI |
Restart WhatsApp MCP:
docker compose restart whatsapp-bridge whatsapp-mcp-server
View logs:
docker logs -f whatsapp-mcp-server
Go to n8n, add a costum mcp node and figure it out ;) maybe in a later update I will add a section on that.
optional git ignore for begginers:
# === PYTHON ===
__pycache__/
*.py[cod]
*.egg
*.egg-info/
dist/
build/
.env
.venv/
venv/
*.log
# === NODE / REACT (dashboard) ===
node_modules/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log
*.lock
whatsapp-mcp/whatsapp-dashboard/dist/
# === DOCKER / SYSTEM ===
*.pid
*.sock
docker-compose.override.yml
# === BACKUPS ===
n8n_postgres_backups/
*.sql
*.dump
# === OS / SYSTEM ===
.DS_Store
Thumbs.db
ehthumbs.db
*.swp
*.swo
*~
# === CLOUD FLARE TUNNEL CREDENTIALS (should never be committed) ===
/.root/.cloudflared/
*.pem
*.json
# === IDE SETTINGS ===
.vscode/
.idea/
Eliad Shahar β Open source automation enthusiast.
lharries Credit: lharries Whatsapp mcp