🎬 HÃY ĐĂNG KÝ KÊNH YOUTUBE ĐỂ ỦNG HỘ MÌNH NHÉ! 🔔 👉 ĐĂNG KÝ NGAY TẠI ĐÂY để nhận những video hướng dẫn mới nhất về N8N, Automation và nhiều công nghệ thú vị khác!
Script tự động cài đặt N8N với đầy đủ tính năng mở rộng và quản lý từ xa, bao gồm:
- Localhost Mode - Không cần domain, truy cập qua IP
- Domain Mode - Cần domain và DNS với SSL tự động
- Cloudflare Tunnel Mode - Không cần public IP, hoàn toàn bảo mật
- Smart Mode Detection - Tự động chọn mode phù hợp nhất
- No more 503 errors! - Tự động fix tất cả lỗi phổ biến
- Permission Auto-Fix - Tự động sửa quyền thư mục (1000:1000)
- Docker Network Recovery - Tự động recreate networks bị lỗi
- Service Health Recovery - Tự động restart services không ổn định
- PostgreSQL Connection Fix - Tự động fix database connection issues
- SSL Certificate Recovery - Tự động fix SSL problems
- No Public IP Required - Hoạt động ngay cả khi không có public IP
- Automatic SSL - SSL certificates tự động từ Cloudflare
- DDoS Protection - Bảo vệ khỏi DDoS attacks
- Zero Trust Security - Bảo mật cao cấp
- Easy Setup - Chỉ cần tunnel token từ Cloudflare dashboard
- Dynamic Port Assignment - Tự động tìm port khả dụng
- Multi-Instance Ports - Mỗi N8N instance có port riêng
- Port Conflict Resolution - Tự động tránh xung đột port
- Custom Base Ports - Có thể thay đổi base port mặc định
- Real-time Health Checks - Kiểm tra sức khỏe hệ thống liên tục
- Auto-Recovery System - Tự động khôi phục khi có lỗi
- Performance Metrics - Theo dõi hiệu suất realtime
- Telegram Alerts - Thông báo lỗi qua Telegram
- Retry Mechanism - Tự động thử lại khi thất bại
- Basic Authentication - Bảo vệ dashboard với username/password
- Secure Credentials - Lưu trữ thông tin đăng nhập an toàn
- IP Filtering - Chỉ cho phép IP được ủy quyền
- Session Management - Quản lý phiên đăng nhập
- Quản lý từ xa hoàn toàn qua Telegram
- Real-time monitoring và alerts
- Quick actions: restart, backup, logs, health check
- Performance metrics realtime
- Security: Chỉ Chat ID được ủy quyền
- Auto-Fix Commands - Lệnh fix lỗi từ Telegram
- Tự động upload backup lên Google Drive
- Folder structure theo năm/tháng/domain
- Easy restore từ Google Drive
- OAuth2 authentication bảo mật
- Cross-platform access
- Auto-Fix Integration - Tự động fix backup issues
- Browser-based management interface
- Real-time charts và metrics
- Mobile responsive design
- Quick actions và troubleshooting
- Multi-user support ready
- Auto-Fix Dashboard - Giao diện quản lý auto-fix
- Basic Authentication cho N8N instances
- IP filtering và whitelist
- Fail2ban protection
- SSL security headers
- Rate limiting advanced
- Cloudflare Zero Trust integration
- Nhiều N8N instances trên cùng một server
- Chia sẻ tài nguyên hiệu quả (News API, PostgreSQL)
- Quản lý tập trung backup và monitoring
- SSL tự động cho tất cả domains
- Auto-Fix Multi-Domain - Tự động fix tất cả instances
- Hiệu suất cao hơn SQLite
- Concurrent connections tốt hơn
- Backup và restore dễ dàng
- Chia sẻ database giữa các instances
- Hoàn toàn miễn phí
- Auto-Fix Database - Tự động fix connection issues
🌟 Nguyễn Ngọc Thiện 🌟
- 📺 YouTube: Kalvin Thien Social - 🔥 HÃY ĐĂNG KÝ ĐỂ ỦNG HỘ! 🔥
- 📘 Facebook: @Ban.Thien.Handsome
- 📱 Zalo/Phone: 08.8888.4749
- 🎬 N8N Playlist: Danh sách video N8N
- 🚀 Ngày cập nhật: 01/07/2025
- 🆕 Phiên bản: 4.0 Enhanced - Multi-Mode + Auto-Fix + Cloudflare Tunnel + Health Monitoring + Custom Ports
💡 Đừng quên nhấn SUBSCRIBE và 🔔 để không bỏ lỡ những video hữu ích mới nhất!
🎯 Kênh của mình chia sẻ kiến thức về:
- 🤖 N8N Automation workflows
- 🐳 Docker & DevOps
- 💻 Server management
- 🚀 Latest tech tutorials
- 📱 Social media automation
✅ Ubuntu VPS/Server (Recommend)
✅ Ubuntu on Windows WSL
✅ Ubuntu Docker Environment
✅ Tự động detect và xử lý môi trường
✅ Cloudflare Tunnel - Không cần public IP
- OS: Ubuntu 20.04+ (VPS hoặc WSL)
- RAM: Tối thiểu 2GB (khuyến nghị 4GB+ cho multi-domain)
- Disk: 20GB+ free space
- Network: Domains đã trỏ về server (cho Domain Mode)
- Permission: Root access
- RAM: Khuyến nghị 4GB+ (mỗi N8N instance ~512MB)
- CPU: 2+ cores cho hiệu suất tốt
- Disk: 30GB+ cho nhiều instances + backups
- Google Account: Cho Google Drive backup (optional)
- Telegram Bot: Cho remote management (optional)
- Cloudflare Account: Cho Cloudflare Tunnel (optional)
cd /tmp && curl -sSL https://raw.githubusercontent.com/KalvinThien/install-n8n-ffmpeg/main/auto_cai_dat_n8n.sh | tr -d '\r' > install_n8n.sh && chmod +x install_n8n.sh && sudo bash install_n8n.sh -lcd /tmp && curl -sSL https://raw.githubusercontent.com/KalvinThien/install-n8n-ffmpeg/main/auto_cai_dat_n8n.sh | tr -d '\r' > install_n8n.sh && chmod +x install_n8n.sh && sudo bash install_n8n.sh -fcd /tmp && curl -sSL https://raw.githubusercontent.com/KalvinThien/install-n8n-ffmpeg/main/auto_cai_dat_n8n.sh | tr -d '\r' > install_n8n.sh && chmod +x install_n8n.sh && sudo bash install_n8n.sh -m -pcd /tmp && curl -sSL https://raw.githubusercontent.com/KalvinThien/install-n8n-ffmpeg/main/auto_cai_dat_n8n.sh | tr -d '\r' > install_n8n.sh && chmod +x install_n8n.sh && sudo bash install_n8n.sh -m -p -g -t# Localhost mode với auto-fix
sudo ./auto_cai_dat_n8n.sh -l
# Cloudflare Tunnel mode
sudo ./auto_cai_dat_n8n.sh -f
# Multi-domain với PostgreSQL và auto-fix
sudo ./auto_cai_dat_n8n.sh -m -p
# Full features với tất cả tính năng
sudo ./auto_cai_dat_n8n.sh -m -p -g -t
# Clean install với full features
sudo ./auto_cai_dat_n8n.sh -c -m -p -g -t
# Tắt auto-fix (không khuyến nghị)
sudo ./auto_cai_dat_n8n.sh --no-auto-fix
# Xem trợ giúp
./auto_cai_dat_n8n.sh -hScript sẽ hướng dẫn bạn qua các bước:
- Localhost Mode - Không cần domain, truy cập qua IP
- Domain Mode - Cần domain và DNS với SSL tự động
- Cloudflare Tunnel Mode - Không cần public IP, hoàn toàn bảo mật
- Chọn Installation Mode - Localhost/Domain/Cloudflare
- Setup Swap tự động (tăng cường cho multi-domain)
- Nhập domains (single hoặc multiple)
- Custom Port Configuration - Tự động phân bổ ports
- Dashboard Security - Basic Auth setup
- Cấu hình PostgreSQL (nếu được chọn)
- Cấu hình News API (tùy chọn)
- Cấu hình Telegram (tùy chọn)
- Cấu hình Google Drive (nếu được chọn)
- Cấu hình Cloudflare Tunnel (nếu được chọn)
- Kiểm tra DNS cho tất cả domains (Domain Mode)
- Cài đặt Docker & dependencies
- Build & start tất cả containers với auto-fix
- Setup SSL cho tất cả domains
- Thiết lập services (Dashboard, Telegram Bot, Health Monitor)
- Auto-Fix Integration - Kiểm tra và fix lỗi tự động
- Permission Issues - Tự động fix quyền thư mục (1000:1000)
- Docker Network Problems - Tự động recreate networks
- Container Health Issues - Tự động restart containers không ổn định
- PostgreSQL Connection - Tự động fix database connection
- SSL Certificate Problems - Tự động fix SSL issues
- Port Conflicts - Tự động tìm port khả dụng
- Health Monitoring - Kiểm tra sức khỏe hệ thống liên tục
- Retry Mechanism - Tự động thử lại khi thất bại
- Graceful Degradation - Hệ thống vẫn hoạt động khi có lỗi
- Telegram Alerts - Thông báo lỗi và fix status
# Tự động fix tất cả lỗi
/home/n8n/auto-fix.sh
# Fix permissions
/home/n8n/auto-fix.sh permissions
# Fix Docker networks
/home/n8n/auto-fix.sh networks
# Fix PostgreSQL
/home/n8n/auto-fix.sh database
# Fix SSL certificates
/home/n8n/auto-fix.sh ssl- No Public IP Required - Hoạt động ngay cả khi không có public IP
- Automatic SSL - SSL certificates tự động từ Cloudflare
- DDoS Protection - Bảo vệ khỏi DDoS attacks
- Zero Trust Security - Bảo mật cao cấp
- Easy Setup - Chỉ cần tunnel token từ Cloudflare dashboard
- Truy cập Cloudflare Zero Trust
- Vào Zero Trust → Access → Tunnels
- Create a tunnel → Cloudflared
- Đặt tên tunnel (vd: n8n-tunnel)
- Copy tunnel token
- Nhập token vào script
/home/n8n/cloudflare/
├── config.yml # Tunnel configuration
├── credentials.json # Cloudflare credentials
└── tunnel.log # Tunnel logs
- Auto Port Detection - Tự động tìm port khả dụng
- Port Conflict Resolution - Tránh xung đột port
- Custom Base Ports - Có thể thay đổi base port mặc định
- Multi-Instance Ports - Mỗi N8N instance có port riêng
# Default ports
N8N Base Port: 5678
API Base Port: 8000
Dashboard Port: 8080
# Multi-domain ports
Instance 1: 5678
Instance 2: 5800
Instance 3: 5801
...- Real-time Monitoring - Kiểm tra sức khỏe hệ thống liên tục
- Auto-Recovery - Tự động khôi phục khi có lỗi
- Performance Metrics - Theo dõi hiệu suất realtime
- Telegram Alerts - Thông báo lỗi qua Telegram
# Health check endpoints
N8N: /healthz
News API: /health
PostgreSQL: pg_isready
Caddy: Built-in health checks
# Health check interval: 30s
# Retry attempts: 3
# Auto-recovery: Enabled/start - Khởi động bot
/status - Trạng thái tất cả instances
/health - Health check chi tiết
/performance - Performance metrics
/help - Danh sách lệnh
/restart all - Restart tất cả services
/restart n8n - Restart N8N container
/restart caddy - Restart Caddy proxy
/restart postgres - Restart PostgreSQL
/auto-fix - Chạy auto-fix system
/auto-fix permissions - Fix permissions
/auto-fix networks - Fix Docker networks
/auto-fix database - Fix PostgreSQL
/auto-fix ssl - Fix SSL certificates
/logs all - Logs tất cả services
/logs n8n 50 - 50 dòng logs cuối của N8N
/backup - Chạy backup manual
/troubleshoot - Chạy diagnostic
/health-monitor - Health monitor status
🚀 N8N System Status v4.0
📊 System Info:
• Uptime: up 2 days, 14 hours, 32 minutes
• Memory: 2.1G/4.0G
• Disk Usage: 45%
• Auto-Fix: ✅ Enabled
• Health Monitor: ✅ Active
🌐 Installation Mode: Cloudflare Tunnel
🌐 Domains (3):
• Instance 1: n8n1.example.com (Port: 5678)
• Instance 2: n8n2.example.com (Port: 5800)
• Instance 3: n8n3.example.com (Port: 5801)
🐳 Containers (6):
✅ n8n-container-1: running (healthy)
✅ n8n-container-2: running (healthy)
✅ caddy-proxy: running (healthy)
✅ postgres-n8n: running (healthy)
✅ cloudflared: running (healthy)
✅ news-api-container: running (healthy)
🔧 Auto-Fix Status:
• Last Check: 2 minutes ago
• Issues Fixed: 0
• System Health: ✅ Excellent
- Truy cập Google Cloud Console
- Tạo project mới hoặc chọn project có sẵn
- Enable Google Drive API
- Tạo Service Account credentials
- Download JSON credentials file
- Share Google Drive folder với service account
N8N-Backups/
├── 2025/
│ ├── 06-June/
│ │ ├── domain1.com/
│ │ │ ├── n8n_backup_20250628_140000.zip
│ │ │ └── n8n_backup_20250627_020000.zip
│ │ ├── domain2.com/
│ │ └── All-Domains/
│ └── 07-July/
└── 2024/
- Daily upload lên Google Drive
- Organized by year/month/domain
- Automatic cleanup old backups
- Telegram notifications với status
- Fallback local nếu upload thất bại
- Auto-Fix Integration - Tự động fix backup issues
http://YOUR_SERVER_IP:8080
- Real-time monitoring tất cả instances
- System metrics (CPU, Memory, Disk, Network)
- Container status với health checks
- SSL certificate monitoring
- Backup status và history
- Quick actions (restart, backup, logs)
- Mobile responsive design
- Auto-refresh every 30 seconds
- Auto-Fix Dashboard - Giao diện quản lý auto-fix
- Health Monitor Status - Trạng thái health monitoring
- 🔄 Refresh Data - Cập nhật realtime
- 🔄 Restart All - Restart tất cả services
- 💾 Manual Backup - Chạy backup manual
- 📋 View Logs - Xem logs trong tab mới
- ⬆️ Update System - Update hệ thống
- 🔧 Troubleshoot - Chạy diagnostic script
- 🛠️ Auto-Fix - Chạy auto-fix system
- 🏥 Health Check - Chạy health check manual
Tất cả API calls yêu cầu Bearer Token:
Authorization: Bearer YOUR_TOKEN_HERESau khi cài đặt, truy cập:
- Homepage:
https://api.yourdomain.com/ - Swagger UI:
https://api.yourdomain.com/docs - ReDoc:
https://api.yourdomain.com/redoc
# Lấy nội dung bài viết
curl -X POST "https://api.yourdomain.com/extract-article" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"url": "https://dantri.com.vn/the-gioi.htm",
"language": "vi",
"extract_images": true,
"summarize": true
}'- ZIP compression tối ưu dung lượng
- Multi-domain backup tất cả instances cùng lúc
- PostgreSQL databases backup riêng từng instance
- SSL certificates backup và restore
- Configuration files backup
- Metadata chi tiết cho mỗi backup
- Auto-Fix Integration - Tự động fix backup issues
- Detailed reports về tất cả instances
- File upload nếu <50MB
- Status notifications success/failure
- Fallback: Giữ backup local nếu Telegram thất bại
- Auto-Fix Notifications - Thông báo auto-fix status
- Auto-upload sau mỗi backup
- Organized folders theo domain và ngày
- Easy restore từ Google Drive
- Cross-platform access
- Auto-Fix Integration - Tự động fix upload issues
# Restore từ backup file
/home/n8n/restore-from-backup.sh /path/to/backup.zip
# Restore domain cụ thể
/home/n8n/restore-from-backup.sh /path/to/backup.zip domain.com
# Restore sẽ:
# 1. Stop tất cả services
# 2. Restore configuration files
# 3. Restore SSL certificates
# 4. Restore PostgreSQL databases
# 5. Restore N8N instances data
# 6. Import workflows và credentials
# 7. Start tất cả services
# 8. Run auto-fix để đảm bảo stability- Auto-generated username/password cho N8N
- Secure storage credentials
- Easy rotation passwords
- Dashboard Security - Basic Auth cho dashboard
- Whitelist allowed IP addresses
- CIDR block support
- Easy configuration via file
- Cloudflare Integration - IP filtering với Cloudflare
- Auto-ban malicious IPs
- Custom rules cho N8N
- Configurable ban times
- Cloudflare Integration - Fail2ban với Cloudflare
- HSTS enforcement
- XSS protection
- Content Security Policy
- Frame protection
- Cloudflare Zero Trust integration
# Xem trạng thái tất cả containers
cd /home/n8n && docker-compose ps
# Xem logs realtime tất cả services
cd /home/n8n && docker-compose logs -f
# Restart toàn bộ hệ thống
cd /home/n8n && docker-compose restart
# Web Dashboard
http://YOUR_SERVER_IP:8080
# Auto-Fix System
/home/n8n/auto-fix.sh
# Health Monitor
systemctl status n8n-health-monitor
# Troubleshoot script
/home/n8n/troubleshoot.sh# Enhanced backup
/home/n8n/backup-workflows-enhanced.sh
# Restore system
/home/n8n/restore-from-backup.sh
# Manual backup test
/home/n8n/backup-manual.sh
# Auto-Fix System
/home/n8n/auto-fix.sh
# Health Monitor
/home/n8n/health_checks/health_monitor.sh/home/n8n/
├── docker-compose.yml # Main config với multi-domain
├── Dockerfile # N8N custom image
├── Caddyfile # Reverse proxy cho tất cả domains
├── init-multi-db.sh # PostgreSQL init script
├── backup-workflows-enhanced.sh # Enhanced backup script
├── restore-from-backup.sh # Enhanced restore script
├── troubleshoot.sh # Multi-domain diagnostic script
├── auto-fix.sh # Auto-Fix system script
├── telegram_config.txt # Telegram settings
├── dashboard/ # Web Dashboard
│ ├── index.html # Dashboard UI
│ ├── api_server.py # Dashboard API server
│ └── assets/ # Static assets
├── telegram_bot/ # Telegram Bot Management
│ ├── bot.py # Main bot script
│ └── start_bot.sh # Bot startup script
├── google_drive/ # Google Drive Integration
│ ├── gdrive_backup.py # Google Drive backup script
│ ├── credentials.json # Service account credentials
│ └── cleanup_old_backups.py # Cleanup script
├── cloudflare/ # Cloudflare Tunnel
│ ├── config.yml # Tunnel configuration
│ ├── credentials.json # Cloudflare credentials
│ └── tunnel.log # Tunnel logs
├── health_checks/ # Health Monitoring
│ ├── health_monitor.sh # Health monitor script
│ ├── health_check.sh # Health check script
│ └── auto_recovery.sh # Auto recovery script
├── security/ # Security configurations
│ ├── setup_security.sh # Security setup script
│ ├── auth_credentials.txt # Basic auth credentials
│ ├── allowed_ips.txt # IP whitelist
│ └── ssl_headers.conf # SSL security headers
├── management/ # Management tools
│ ├── dashboard.sh # CLI dashboard
│ ├── menu.sh # Management menu
│ └── export-migration.sh # Migration tools
├── files/ # N8N data
│ ├── backup_full/ # Enhanced backup storage
│ ├── n8n_instance_1/ # Instance 1 data
│ ├── n8n_instance_2/ # Instance 2 data
│ └── n8n_instance_n/ # Instance N data
├── postgres_data/ # PostgreSQL data (if enabled)
├── logs/ # System logs
└── news_api/ # News API (shared)
├── Dockerfile
├── requirements.txt
└── main.py
- Localhost Mode: Tối ưu cho development và testing
- Domain Mode: Tối ưu cho production với SSL
- Cloudflare Mode: Tối ưu cho bảo mật cao và không có public IP
- Memory: Script tự động tăng swap cho multi-domain
- CPU: Mỗi N8N instance sử dụng optimized workers
- Database: PostgreSQL shared connection pooling
- Disk: Auto cleanup old backups và logs
- Network: Caddy auto-compression cho tất cả domains
# Resource usage tất cả containers
docker stats --no-stream
# Real-time dashboard
http://YOUR_SERVER_IP:8080
# Telegram monitoring
/status trong Telegram Bot
# Performance metrics
/performance trong Telegram Bot
# Health monitor
systemctl status n8n-health-monitor
# Auto-fix status
/home/n8n/auto-fix.sh status1. Auto-Fix System không hoạt động
# Kiểm tra auto-fix service
systemctl status n8n-auto-fix
# Chạy auto-fix manual
/home/n8n/auto-fix.sh
# Xem auto-fix logs
tail -f /var/log/n8n-auto-fix.log2. Cloudflare Tunnel không kết nối
# Kiểm tra tunnel status
systemctl status cloudflared
# Xem tunnel logs
journalctl -u cloudflared -f
# Test tunnel connection
cloudflared tunnel info3. Health Monitor không hoạt động
# Kiểm tra health monitor
systemctl status n8n-health-monitor
# Xem health monitor logs
journalctl -u n8n-health-monitor -f
# Restart health monitor
systemctl restart n8n-health-monitor4. Custom Ports không hoạt động
# Kiểm tra port usage
netstat -tulpn | grep :5678
# Check port conflicts
/home/n8n/auto-fix.sh ports
# Fix port issues
/home/n8n/auto-fix.sh networks5. Multi-Mode issues
# Kiểm tra installation mode
cat /home/n8n/installation_mode.txt
# Switch mode
/home/n8n/switch-mode.sh localhost
/home/n8n/switch-mode.sh domain
/home/n8n/switch-mode.sh cloudflare- Multi-Mode support (Localhost/Domain/Cloudflare) ✅
- Auto-Fix Integration system ✅
- Health Monitoring & Auto-Recovery ✅
- Custom Port Configuration ✅
- Cloudflare Tunnel support ✅
- Multi-domain support ✅
- PostgreSQL external database ✅
- Telegram Bot management ✅
- Google Drive backup ✅
- Web Dashboard ✅
- Enhanced Security ✅
- Load balancing between instances
- Kubernetes deployment
- Advanced monitoring dashboard with metrics
- Auto-scaling based on load
- Plugin marketplace integration
- Cross-instance workflow sharing
- Multi-cloud deployment support
- Fork repository
- Create feature branch
- Commit changes
- Push to branch
- Create Pull Request
MIT License - Xem file LICENSE
- Issues: GitHub Issues
- YouTube: Kalvin Thien Social
- Facebook: Ban Thien Handsome
- Zalo: 08.8888.4749
Nếu script này hữu ích, hãy cho một ⭐ star để ủng hộ!
🚀 Made with ❤️ by Nguyễn Ngọc Thiện - 01/07/2025
🆕 Enhanced Version 4.0 - Multi-Mode + Auto-Fix + Cloudflare Tunnel + Health Monitoring + Custom Ports
Nếu gặp các vấn đề sau:
- ❌ HTTP ERROR 502 khi truy cập domains
- ❌ N8N containers liên tục restart
- ❌ Permission denied errors
- ❌ PostgreSQL connection issues
- ❌ SSL certificate problems
- ❌ Cloudflare Tunnel connection issues
- ❌ Health monitor not working
Script auto-fix.sh sẽ tự động fix tất cả vấn đề:
# 1. Auto-Fix System đã được tích hợp sẵn
# Chạy auto-fix toàn diện
sudo /home/n8n/auto-fix.sh
# 2. Fix từng phần cụ thể
sudo /home/n8n/auto-fix.sh permissions # Fix permissions
sudo /home/n8n/auto-fix.sh networks # Fix Docker networks
sudo /home/n8n/auto-fix.sh database # Fix PostgreSQL
sudo /home/n8n/auto-fix.sh ssl # Fix SSL certificates
sudo /home/n8n/auto-fix.sh ports # Fix port conflicts
sudo /home/n8n/auto-fix.sh health # Fix health monitor-
✅ Fix Permission Issues (1000:1000)
- Chỉnh sửa quyền thư mục N8N
- Fix user/group ownership
- Tạo missing directories
-
🌐 Fix Docker Network & Service Names
- Recreate Docker networks
- Fix container name resolution
- Clean up old networks
-
🐘 Fix PostgreSQL Database Issues
- Tạo lại users và databases
- Fix connection issues
- Test database connectivity
-
🔒 Fix SSL Certificate Problems
- Update Caddyfile với container names đúng
- Add health checks
- Fix reverse proxy configuration
-
☁️ Fix Cloudflare Tunnel Issues
- Recreate tunnel configuration
- Fix tunnel credentials
- Restart tunnel service
-
🔌 Fix Custom Port Issues
- Resolve port conflicts
- Reassign available ports
- Update configuration files
-
🏥 Fix Health Monitor Issues
- Restart health monitor service
- Fix health check scripts
- Update monitoring configuration
-
🚀 Restart Services in Correct Order
- PostgreSQL → N8N → API → Caddy → Cloudflare
- Verify service health
- Clean up old containers
-
📊 Health Check All Components
- Test container connectivity
- Verify domain accessibility
- Check SSL certificates
- Test Cloudflare tunnel
Auto-Fix System sẽ tạo log file chi tiết tại /var/log/n8n-auto-fix.log
# Xem log auto-fix
tail -f /var/log/n8n-auto-fix.log
# Monitor containers sau khi fix
cd /home/n8n && docker-compose logs -f
# Check status
cd /home/n8n && docker-compose ps
# Health monitor status
systemctl status n8n-health-monitor✅ Tất cả domains hoạt động bình thường
✅ SSL certificates được cấp tự động
✅ N8N instances khởi động ổn định
✅ PostgreSQL kết nối thành công
✅ Cloudflare Tunnel hoạt động
✅ Health Monitor active
✅ No more HTTP 502 errors
✅ Auto-Fix System ready
⏰ Lưu ý: Cần đợi 2-3 phút sau khi fix để SSL certificates được cấp hoàn toàn và Cloudflare Tunnel kết nối.
# Lệnh Telegram Bot cho auto-fix
/auto-fix # Chạy auto-fix toàn diện
/auto-fix permissions # Fix permissions
/auto-fix networks # Fix Docker networks
/auto-fix database # Fix PostgreSQL
/auto-fix ssl # Fix SSL certificates
/auto-fix health # Fix health monitor
/auto-fix status # Xem auto-fix status