DEV Community

William
William

Posted on

Dockavel - Production-Ready Docker Stack for Laravel

After 10 years of deploying Laravel applications, I've open-sourced the Docker stack I've been using in production.

The Problem

Every new Laravel project meant several hours of:

  • Configuring Docker Compose
  • Setting up Nginx and SSL certificates
  • Server hardening (Fail2Ban, firewall, SSH)
  • Writing deployment scripts
  • Debugging permissions

It was never the interesting partβ€”just friction before actual work could begin.

The Solution: Dockavel

A production-ready Docker environment that handles everything with one command:

./scripts/deploy.sh prod
Enter fullscreen mode Exit fullscreen mode

What It Does

πŸš€ One-Command Deployment

  • Development: ./scripts/dev.sh up
  • Production: ./scripts/deploy.sh prod
  • Zero-downtime deployments

πŸ” Automatic SSL

  • Let's Encrypt integration with auto-renewal
  • Cloudflare origin certificates support
  • Smart proxy detection
  • HTTP to HTTPS redirects

πŸ›‘οΈ Security Hardening

Server setup script configures:

  • Fail2Ban for SSH and HTTP protection
  • UFW firewall with minimal ports
  • SSH hardening (key-only, custom port)
  • Automatic security updates

πŸ“¦ Full Production Stack

  • Laravel 12+ with optimizations
  • PHP 8.4-FPM with xtensions
  • MySQL 8.0 with persistent volumes
  • Redis 7.0 for caching and sessions
  • Laravel Horizon for queue monitoring
  • Nginx as reverse proxy

πŸ’Ύ Automated Backups

  • Daily database backups
  • Configurable retention (7/30/90 days)
  • Email notifications
  • One-command restoration

Quick Start

# Clone the repository
git clone https://github.com/mg2k4/Dockavel.git my-project
cd my-project

# Development
./scripts/deploy.sh dev

# Production (on your server)
./scripts/server-setup.sh  # First time only
./scripts/deploy.sh prod
Enter fullscreen mode Exit fullscreen mode

Your app is now running with SSL, security hardening, and automated backups!

What Makes It Different

Laravel Sail: Great for local development, not production-focused

Laradock: Offers many options but complex for production

Dockavel: Production-first, opinionated, one command to deploy

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Nginx     β”‚ ← SSL termination, reverse proxy
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚  PHP-FPM    β”‚ ← Laravel application
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
       β”‚
   β”Œβ”€β”€β”€β”΄β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚       β”‚         β”‚
β”Œβ”€β”€β–Όβ”€β”€β”  β”Œβ”€β–Όβ”€β”€β”€β”  β”Œβ”€β”€β–Όβ”€β”€β”€β”€β”
β”‚MySQLβ”‚  β”‚Redisβ”‚  β”‚Horizonβ”‚
β””β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”˜
Enter fullscreen mode Exit fullscreen mode

Links

πŸ“š Documentation: https://dockavel.com

πŸ“¦ GitHub: https://github.com/mg2k4/Dockavel

πŸŽ₯ Demo Video: https://www.youtube.com/watch?v=o-kj-T2QlXw

My First Open Source Project

This is my first time releasing something open source. I've been using variations of this stack for 5+ years in production, and I finally cleaned it up to share.

Feedback, issues, and PRs are very welcome! Let me know what features you'd like to see.

License

MIT - Free to use, modify, and distribute.


If this saves you even a few hours of Docker configuration, I'll consider it a success. Happy deploying! πŸš€

What deployment challenges are you facing with Laravel? Let me know in the comments!

Top comments (0)