🚀 Automated Docker Compose setup generator with modern reverse proxy configuration using Traefik and Nginx for production-ready microservices deployment.
- 🔄 Interactive Setup: Easy command-line interface for service configuration
- 🌐 Modern Reverse Proxy: Traefik v2.10 with automatic SSL/TLS via Let's Encrypt
- 🔒 SSL Security: Built-in SSL/TLS termination with security headers
- 📦 Multiple Services: Support for custom applications with domain routing
- 🗄️ Database Support: MySQL, PostgreSQL, MongoDB options
- ⚡ Cache & Queue: Redis and RabbitMQ integration
- 📁 File Storage: MinIO S3-compatible storage
- 🌍 Nginx Integration: Advanced nginx configurations per domain
- 📊 Monitoring: Built-in Traefik dashboard
- 🔧 Production Ready: Optimized configurations for production deployment
- Docker Engine 20.10+
- Docker Compose v2.0+
- Domain names pointing to your server (for production SSL)
- Basic understanding of Docker and networking
git clone https://github.com/yourusername/docker-compose-generator.git
cd docker-compose-generatorchmod +x setup.sh
./setup.shThe script will ask you to configure:
- Network name and SSL email
- Services (name, domain, port)
- Database type (MySQL/PostgreSQL/MongoDB/None)
- Optional services (Nginx, Redis, RabbitMQ, MinIO)
./start-services.shOr manually:
docker-compose up -dproject/
├── 📄 .env # Environment variables
├── 📄 docker-compose.yml # Main Docker Compose file
├── 📄 start-services.sh # Startup script
├── 📁 data/ # Persistent data volumes
│ ├── 📁 traefik/ # Traefik data & SSL certificates
│ ├── 📁 service1/ # Your custom services data
│ ├── 📁 mysql/ # Database data (if selected)
│ └── 📁 redis/ # Redis data (if selected)
├── 📁 config/ # Configuration files
│ ├── 📁 service1/ # Service configurations
│ └── 📁 mysql/ # Database configurations
├── 📁 logs/ # Application logs
│ ├── 📁 traefik/ # Traefik logs
│ └── 📁 service1/ # Service logs
└── 📁 nginx/ # Nginx configuration (if enabled)
├── 📄 nginx.conf # Main nginx config
├── 📁 conf.d/ # Additional nginx configs
├── 📁 sites/ # Per-domain configurations
├── 📁 ssl/ # SSL certificates
└── 📁 html/ # Static files
# During setup:
Service name: frontend
Domain: app.example.com
Port: 3000
Service name: api
Domain: api.example.com
Port: 8080# Services
frontend -> app.example.com:3000
api -> api.example.com:8080
admin -> admin.example.com:3001
# Database: MySQL
# Optional: Redis, Nginx enabledAfter deployment, your services will be available at:
- Traefik Dashboard:
http://localhost:8080 - Your Services:
https://yourdomain.com - Database Admin (if enabled):
https://db.yourdomain.com - File Storage (MinIO):
https://storage.yourdomain.com
Each service gets automatically configured nginx virtual host with:
- HTTP to HTTPS redirect
- SSL/TLS termination
- Security headers
- Rate limiting
- Compression (gzip)
- Static file caching
- Health check endpoints
# HTTP redirect to HTTPS
server {
listen 80;
server_name api.example.com;
return 301 https://$server_name$request_uri;
}
# HTTPS server
server {
listen 443 ssl;
server_name api.example.com;
# SSL Configuration
ssl_certificate /etc/nginx/ssl/live/api.example.com/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/live/api.example.com/privkey.pem;
# Security & Performance optimizations
# Rate limiting, compression, security headers...
location / {
proxy_pass http://api:8080;
# Proxy headers for WebSocket support
}
}- Traefik automatically obtains SSL certificates via Let's Encrypt
- Certificates are automatically renewed
- HTTP traffic is redirected to HTTPS
cd nginx/ssl
./generate-certs.shdocker-compose ps# All services
docker-compose logs -f
# Specific service
docker-compose logs -f traefik
docker-compose logs -f nginx
docker-compose logs -f your-serviceAccess real-time metrics and routing information at http://localhost:8080
- Edit docker-compose.yml:
your-service:
image: your-image:latest
container_name: your-service
networks:
- app-network
labels:
- "traefik.enable=true"
- "traefik.http.routers.your-service.rule=Host(`your-domain.com`)"
- "traefik.http.routers.your-service.tls.certresolver=letsresolver"- Create nginx config (if using nginx):
cp nginx/sites/example.conf nginx/sites/your-domain.com.conf
# Edit the new file with your service detailsEdit .env file to customize:
# Global Settings
NETWORK_NAME=app-network
SSL_EMAIL=admin@example.com
# Service Configuration
API_DOMAIN=api.example.com
API_PORT=8080
# Database Credentials
MYSQL_ROOT_PASSWORD=secure_password
MYSQL_DATABASE=myappServices not accessible
# Check if services are running
docker-compose ps
# Check Traefik logs
docker-compose logs traefik
# Verify domain DNS resolution
nslookup yourdomain.comSSL Certificate Issues
# Check Let's Encrypt rate limits
# Verify domain DNS points to your server
# Check Traefik logs for ACME errors
docker-compose logs traefik | grep acmePort Conflicts
# Check what's using the ports
sudo netstat -tulpn | grep :80
sudo netstat -tulpn | grep :443
# Stop conflicting services
sudo systemctl stop apache2 # or nginxMySQL Connection
# Test connection from host
docker exec -it mysql mysql -u root -p
# Check if port is exposed
docker-compose ps mysql# Create backup directory
mkdir -p backups/$(date +%Y%m%d)
# Backup data volumes
sudo tar -czf backups/$(date +%Y%m%d)/data.tar.gz data/
sudo tar -czf backups/$(date +%Y%m%d)/config.tar.gz config/# Stop services
docker-compose down
# Restore data
sudo tar -xzf backups/20240101/data.tar.gz
sudo tar -xzf backups/20240101/config.tar.gz
# Start services
docker-compose up -d- RAM: 2GB minimum, 4GB recommended
- Storage: 20GB minimum for Docker images and data
- Network: Static IP address
- DNS: Domain names configured with A records
- Change default passwords in
.env - Configure firewall (UFW/iptables)
- Setup regular backups
- Enable Docker logging limits
- Monitor resource usage
- Regular security updates
# Docker logging limits
echo '{"log-driver":"json-file","log-opts":{"max-size":"10m","max-file":"3"}}' | sudo tee /etc/docker/daemon.json
# Restart Docker
sudo systemctl restart docker- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some 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.
- Traefik for the excellent reverse proxy
- Nginx for reliable web server
- Docker for containerization platform
- Let's Encrypt for free SSL certificates
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: admin@example.com
⭐ Star this repository if you find it helpful!
Made with ❤️ by BinaryDev