A comprehensive bash-based management system for running multiple Laravel, WordPress, and other PHP applications in Docker containers with automatic SSL certificate generation, nginx configuration, and database management.
- Multi-Site Management: Run multiple Laravel/WordPress sites simultaneously
- Interactive Menu System: User-friendly CLI interface with fuzzy search
- Automatic SSL Generation: Self-signed certificates for local development
- Docker Integration: Containerized PHP, MySQL, and nginx setup
- Database Management: Automatic database creation and migration support
- Permission Management: Laravel-specific permission fixing
- Cloudflare Integration: Support for Cloudflare tunnels
- Version Control: Support for different PHP and Laravel versions
The system automatically checks for and can install these required applications:
curl- HTTP clientwget- File downloadergit- Version controldocker- Container platformdocker-compose- Multi-container orchestrationufw- Firewall managementjq- JSON processorfzf- Fuzzy finder (for interactive menus)cloudflared- Cloudflare tunnel client
- Ubuntu/Debian-based Linux distribution
- Docker and Docker Compose installed
- Sudo privileges for package installation
project-root/
βββ sites/ # Laravel/WordPress projects (one folder per site)
βββ docker/ # Docker configuration
β βββ nginx/
β β βββ conf.d/ # Generated nginx config files (*.conf)
β βββ mysql/ # MySQL Docker setup
β βββ php/ # PHP Docker setup
βββ certs/ # Generated SSL certificates
βββ bash-scripts/ # Management scripts
βββ cloudflare/ # Cloudflare tunnel configuration
βββ docs/ # Documentation
βββ docker-compose.yml # Generated Docker Compose file
βββ .env # Generated environment variables
βββ config.json # Main configuration file
βββ config.base.json # Configuration template
βββ main.sh # Main interactive script
βββ README.md # This file
-
Clone and Setup:
git clone https://github.com/gartservice/dockervel.git dockervel cd dockervel chmod +x main.sh -
Generate Configuration:
./main.sh # Select "Generate config.json from template" -
Check Requirements:
./main.sh # Select "Check Required Applications" -
Add Your First Site:
./main.sh # Select "Add New Site" -
Build and Start:
./main.sh # Select "Build Docker Containers" docker-compose up -d
Creates a new Laravel, WordPress, or existing project site.
Process:
- Enter site name (alphanumeric, dashes, underscores only)
- Configure DNS (e.g.,
mysite.local) - Set database credentials
- Choose public folder (
publicfor Laravel,.for WordPress) - Enable/disable SSL
- Select PHP version
- Choose installation type:
- Laravel: Fresh Laravel installation
- WordPress: Fresh WordPress installation
- GitHub: Clone from GitHub repository
- Existing: Use existing code
Generated Files:
- Site folder in
sites/<site_name>/ - SSL certificates in
certs/(if enabled) - Updated
config.json - Nginx configuration
Removes a site and all associated files.
Process:
- Select site from list
- Confirm deletion
- Choose cleanup options:
- Remove site folder
- Delete database (with confirmation)
- Remove nginx config
- Delete SSL certificates
- Update configuration
Access to scripts typically run automatically in the background. Use for manual execution, debugging, or testing.
Available Options:
- Fix Laravel Permissions: Fix file and directory permissions for Laravel applications
- Build Docker Containers: Build all Docker containers defined in configuration
- Init Databases: Initialize MySQL databases for all configured sites
- Run Migrations: Execute Laravel migrations for selected sites
- Generate .env File: Create
.envfile fromconfig.jsonconfiguration - Generate docker-compose file: Create
docker-compose.ymlfrom configuration - Generate nginx config files: Create nginx configuration files for all sites
- Generate database_config.json: Create database configuration for MySQL initialization
Verifies all required applications are installed.
Features:
- Checks each required application
- Reports missing applications
- Can install missing packages
Creates config.json from config.base.json template.
Manages useful Laravel, Ubuntu, and Docker command aliases in your .bashrc file.
Features:
- Install Aliases: Adds comprehensive aliases to
.bashrc - Preview Aliases: Shows all available aliases before installation
- Remove Aliases: Safely removes aliases with backup
- Reload .bashrc: Automatically reloads configuration
Available Aliases:
- Laravel:
pa,pam,pat,pam:r,patest,paml,paoc,spaoc,palm,paqr,pamld,showlog,pads,ds - Ubuntu:
cl,add.alias,sc - Docker:
dcu-d,dcd,dl,dc,de-it,d,dps,dcs
{
"docker_settings": {
"networks": {
"backend_network": "backend",
"frontend_network": "frontend"
},
"mysql": {
"container_name": "mysql",
"root_password": "secret"
},
"nginx": {
"container_name": "nginx",
"http_port": 80,
"https_port": 443,
"ssl": {
"cert": "certs/example.crt",
"key": "certs/example.key"
}
},
"sites": [
{
"name": "mysite",
"server_name": "mysite.local",
"root": "mysite",
"public_folder": "public",
"php_version": "8.3",
"db_name": "mysite_db",
"db_user": "root",
"db_password": "secret",
"ssl": {
"enabled": true,
"cert": "certs/mysite.crt",
"key": "certs/mysite.key"
}
}
]
},
"local_settings": {
"sites_folder": "./sites",
"available_php_versions": ["8.4", "8.3", "8.2", "8.1", "8.0", "7.4"],
"available_laravel_versions": ["12.*", "11.*", "10.*", "9.*"],
"required_packages": ["curl", "wget", "git", "docker", "docker-compose", "ufw", "jq", "fzf", "cloudflared"],
"cloudflare": {
"email": "[email protected]",
"api_key": "CHANGEME",
"zone_id": "CHANGEME"
}
}
}Main interactive menu system that orchestrates all other scripts.
Handles new site creation with validation and configuration.
Manages site deletion with cleanup options.
Fixes Laravel-specific file and directory permissions.
Generates Docker Compose configuration from JSON config.
Creates nginx configuration files for all sites.
Executes Laravel migrations in Docker containers.
Verifies and installs required system applications.
Creates .env file from configuration.
Common utility functions (fzf installation).
Creates config.json from template.
Generates database configuration for MySQL.
Initializes MySQL databases.
Builds Docker containers.
Docker container management utilities.
Manages Laravel, Ubuntu, and Docker command aliases in .bashrc.
Provides a submenu for manual script execution and debugging options.
- HTTP:
http://your-site.local - HTTPS:
https://your-site.local(if SSL enabled)
- PHPMyAdmin:
http://localhost:8081 - MySQL:
localhost:3306
# View running containers
docker-compose ps
# View logs
docker-compose logs -f
# Access container shell
docker exec -it php-83 bash
docker exec -it mysql bash
# Stop all containers
docker-compose down
# Rebuild containers
docker-compose up -d --buildThe system automatically generates self-signed SSL certificates for local development:
- Location:
certs/directory - Naming:
{site_name}.crtand{site_name}.key - Validity: 365 days
- Usage: Automatically configured in nginx
Note: Self-signed certificates will show browser warnings. This is normal for local development.
- Databases are created automatically when adding sites
- Each site gets its own database
- Default credentials:
root/secret
# Access MySQL
docker exec -it mysql mysql -uroot -psecret
# Create database manually
CREATE DATABASE my_new_db;
# Import SQL file
docker exec -i mysql mysql -uroot -psecret my_db < backup.sql
# Export database
docker exec mysql mysqldump -uroot -psecret my_db > backup.sqlAfter installing aliases via the main menu, you can use these shortcuts:
# Laravel commands
pa # php artisan
pam # php artisan migrate
pat # php artisan tinker
paoc # php artisan optimize:clear
showlog # tail -f storage/logs/laravel.log
# Docker commands
dcu-d # docker-compose up -d
dcd # docker-compose down
dps # docker ps
de-it # docker exec -it
# Ubuntu commands
cl # clear
sc # source ~/.bashrc# Fix Laravel permissions
./main.sh
# Select "Fix Laravel Permissions"# Check container logs
docker-compose logs <container_name>
# Rebuild containers
docker-compose down
docker-compose up -d --build- Check if containers are running:
docker-compose ps - Verify nginx config:
docker/nginx/conf.d/ - Check site DNS: Add to
/etc/hosts - Verify SSL certificates:
certs/directory
- Ensure MySQL container is running
- Check database credentials in
config.json - Verify
.envfile is generated - Check container networking
# Check all container status
docker-compose ps
# View nginx configuration
cat docker/nginx/conf.d/your-site.conf
# Check SSL certificates
ls -la certs/
# Verify site folder structure
ls -la sites/your-site/
# Test database connection
docker exec mysql mysql -uroot -psecret -e "SHOW DATABASES;"- Update Dependencies: Run
composer updatein site directories - Backup Databases: Export databases regularly
- Clean Logs: Clear Laravel logs in
storage/logs/ - Update SSL: Regenerate certificates if expired
# Backup all databases
for db in $(docker exec mysql mysql -uroot -psecret -e "SHOW DATABASES;" | grep -v Database | grep -v information_schema | grep -v performance_schema); do
docker exec mysql mysqldump -uroot -psecret "$db" > "backup_${db}_$(date +%Y%m%d).sql"
done
# Backup site files
tar -czf "sites_backup_$(date +%Y%m%d).tar.gz" sites/- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Check the troubleshooting section
- Review the script documentation
- Check container logs
- Create an issue with detailed information
Happy Coding! π