A comprehensive, production-ready Docker-based environment for Ubuntu 24 VPS, featuring workflow automation, AI services, reverse proxy, and monitoring.
- 🔄 Workflow Automation: n8n with PostgreSQL and Redis
- 🤖 AI/LLM Services: Ollama + OpenWebUI for local AI hosting
- 🌐 Reverse Proxy: Nginx Proxy Manager with automatic HTTPS/SSL
- 📊 Monitoring: Portainer CE and Dozzle for container management
- 🗂️ Website Hosting: Static website and demo environments
- 🔐 Security: UFW firewall, HTTPS everywhere, automated updates
- 💾 Backup System: Automated backups with configurable retention
- Ubuntu 24.04 VPS with root access
- Domain name with DNS control (Cloudflare, Hostinger, etc.)
- Minimum 4GB RAM, 20GB storage
- Docker and Docker Compose (auto-installed)
# Clone to /opt/mystack
sudo git clone https://github.com/aelmasry/mystack.git /opt/mystack
cd /opt/mystack
# Make scripts executable
sudo chmod +x scripts/*.sh
# Initialize server (installs Docker, configures firewall)
sudo bash scripts/init-server.shUpdate your DNS provider with these A records pointing to your VPS IP:
proxy.yourdomain.com → Your VPS IP
n8n.yourdomain.com → Your VPS IP
ollama.yourdomain.com → Your VPS IP
portainer.yourdomain.com → Your VPS IP
dozzle.yourdomain.com → Your VPS IP
# Deploy all services in correct order
sudo bash scripts/deploy-all.sh
# Check status
sudo bash scripts/status.sh- Nginx Proxy Manager:
http://your-vps-ip:81(admin@example.com / changeme) - n8n:
https://n8n.yourdomain.com - OpenWebUI:
https://ollama.yourdomain.com - Portainer:
https://portainer.yourdomain.com - Dozzle:
https://dozzle.yourdomain.com
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Cloudflare │────│ Nginx Proxy │────│ Docker Apps │
│ (DNS + CDN) │ │ Manager │ │ │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │
├── n8n Stack ────────────┤
├── Ollama + WebUI ───────┤
├── Static Websites ──────┤
└── Monitoring ───────────┘
- All services run on
mystack-networkDocker network - Nginx Proxy Manager handles SSL termination and routing
- Internal communication via container names
- External access via configured domains
/opt/mystack/
├── 🔧 proxy/ # Nginx Proxy Manager + SSL
├── ⚡ n8n/ # Workflow automation stack
├── 🤖 ollama/ # AI/LLM services
├── 🌐 websites/ # Static website hosting
├── 📊 monitoring/ # Container management tools
├── 💾 backups/ # Automated backup storage
├── 🔧 scripts/ # Management automation
├── 📝 shared/ # Shared configurations
└── 📚 docs/ # Documentation
| Service | Port | Purpose | Dependencies |
|---|---|---|---|
| Nginx Proxy Manager | 80, 443, 81 | Reverse proxy + SSL | None |
| n8n | 5678 | Workflow automation | PostgreSQL, Redis |
| PostgreSQL | 5432 | n8n database | None |
| Redis | 6379 | n8n cache/queue | None |
| Ollama | 11434 | LLM inference | None |
| OpenWebUI | 8080 | AI web interface | Ollama |
| Portainer | 9000 | Docker management | None |
| Dozzle | 8888 | Log viewer | None |
- Static Websites: Demo and portfolio sites
- Monitoring: Grafana + Prometheus (disabled by default)
# Core Operations
scripts/init-server.sh # Initial VPS setup
scripts/deploy-all.sh # Deploy all services
scripts/status.sh # Check all services status
# Service Management
scripts/management/start-all.sh # Start all services
scripts/management/stop-all.sh # Stop all services
# Backup & Maintenance
scripts/backup.sh # Create backup
scripts/restore.sh # Restore from backup
scripts/cleanup.sh # Clean old data
# Monitoring
scripts/health-check.sh # Health check all services
scripts/monitor.sh # Resource monitoring- Firewall: UFW configured (ports 22, 80, 443, 81)
- HTTPS: Automatic SSL certificates via Let's Encrypt
- Updates: Unattended security updates enabled
- Network: Isolated Docker networks
- Access: Service-specific authentication
- Backups: Encrypted backup storage
- ✅ PostgreSQL databases (n8n workflows)
- ✅ Redis data (sessions, cache)
- ✅ n8n configuration and workflows
- ✅ Website content and configurations
- ✅ Proxy configurations and certificates
- ❌ Large LLM models (Ollama)
- ❌ Docker images and containers
- ❌ System logs
- ❌ Temporary files
# Manual backup
sudo bash scripts/backup.sh
# Restore from backup
sudo bash scripts/restore.sh backup_YYYY-MM-DD_HH-MM-SS.tar.gz
# Automated daily backups (via cron)
# Retention: 30 days (configurable)Each service uses environment variables for configuration:
# n8n Configuration
N8N_HOST=n8n.yourdomain.com
N8N_PROTOCOL=https
WEBHOOK_URL=https://n8n.yourdomain.com
GENERIC_TIMEZONE=Asia/Dubai
# Database Configuration
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=postgres
DB_POSTGRESDB_DATABASE=n8n
# Authentication
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=changeme- Automatic: Let's Encrypt via Nginx Proxy Manager UI
- Manual: Upload custom certificates
- Cloudflare: Origin certificates for Cloudflare users
# Check all services
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
# Service-specific logs
docker-compose -f n8n/docker-compose.yml logs -f
# Resource usage
docker stats- Daily: Automated backups
- Weekly: Security updates
- Monthly: Log cleanup and optimization
- Quarterly: Full system review
# Check Docker daemon
sudo systemctl status docker
# Check network
docker network ls | grep mystack
# Recreate network
docker network create mystack-network# Check Nginx Proxy Manager logs
docker logs nginx-proxy-manager
# Test certificate
openssl s_client -connect yourdomain.com:443
# Renew certificates manually
# Via Nginx Proxy Manager UI: SSL Certificates > Renew# Check PostgreSQL health
docker exec n8n-postgres pg_isready -U postgres
# Check Redis connection
docker exec n8n-redis redis-cli ping- Application Logs: Available via Dozzle UI
- Nginx Logs:
/opt/mystack/proxy/data/logs/ - Backup Logs:
/opt/mystack/backups/logs/
# Update all Docker images
cd /opt/mystack
docker-compose -f proxy/docker-compose.yml pull
docker-compose -f n8n/docker-compose.yml pull
docker-compose -f ollama/docker-compose.yml pull
docker-compose -f monitoring/docker-compose.yml pull
# Restart with new images
bash scripts/deploy-all.sh# Update Ubuntu packages
sudo apt update && sudo apt upgrade -y
# Update Docker
sudo apt install docker-ce docker-ce-cli containerd.io- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Check Logs: Use Dozzle or
docker logs [container-name] - Verify DNS: Ensure domains point to your VPS
- Check Firewall: Verify UFW rules with
sudo ufw status - GitHub Issues: Open an issue for bugs or feature requests
- n8n - Workflow automation platform
- Ollama - Local LLM hosting
- OpenWebUI - AI web interface
- Nginx Proxy Manager - Reverse proxy management
- Portainer - Docker management
- Dozzle - Docker log viewer
⭐ If this project helps you, please consider giving it a star!