One-command server setup for Laravel applications with monitoring infrastructure.
Fork of sohag-pro/SingleCommand with enhanced features, monitoring capabilities, and production-ready templates.
bash <(curl -fsSL https://raw.githubusercontent.com/theihasan/laravel-server-setup/main/install-v3.sh)bash <(curl -fsSL https://raw.githubusercontent.com/theihasan/laravel-server-setup/main/setup-v2.sh)bash <(curl -fsSL https://raw.githubusercontent.com/theihasan/laravel-server-setup/main/setup.sh)Alternative (Download and Review First)
# Version 3.0 (Recommended)
curl -fsSL https://raw.githubusercontent.com/theihasan/laravel-server-setup/main/install-v3.sh -o install-v3.sh
chmod +x install-v3.sh
sudo ./install-v3.sh
# Or clone the full repository
git clone https://github.com/theihasan/laravel-server-setup.git
cd laravel-server-setup
sudo ./setup-v3.sh
# Version 2.0
curl -fsSL https://raw.githubusercontent.com/theihasan/laravel-server-setup/main/setup-v2.sh -o setup-v2.sh
chmod +x setup-v2.sh
sudo ./setup-v2.sh
# Version 1.0
curl -fsSL https://raw.githubusercontent.com/theihasan/laravel-server-setup/main/setup.sh -o setup.sh
chmod +x setup.sh
sudo ./setup.sh- Complete Modular Architecture: 7 independent modules for maximum flexibility
- 4 Web Server Options: Nginx, Apache, Caddy (auto-HTTPS), FrankenPHP (HTTP/2/3)
- Full Redis Integration: Cache, Session, Queue with PhpRedis/Predis support
- Remote Database Support: Use external MySQL/PostgreSQL servers
- Git Deployment Workflow: One-command deployments with laravel-deploy CLI
- PHP-FPM Optimization: Resource-based worker pool configuration
- Node.js Integration: Version selection (18.x/20.x/22.x) with Vite auto-detection
- Configuration Templates: 8 production-ready templates (Nginx, Apache, Caddy, Supervisor)
- Grafana Dashboards: Pre-built Laravel and Redis monitoring dashboards
- Management CLIs: 5 command-line tools (deploy, queue, scheduler, monitoring, redis)
- Comprehensive Testing: Detailed testing checklist and verification script
- PHP Version Choice: 8.1, 8.2, 8.3, 8.4 with automatic database drivers
- Documentation: 8 comprehensive guides including testing and troubleshooting
- Smart Installation: Modular setup (choose what you need)
- Laravel Stack: Nginx/Apache, PHP 8.3, MySQL/PostgreSQL, Redis, Supervisor
- Monitoring: Prometheus, Grafana, Node Exporter
- Auto-Configuration: Environment-aware with smart recommendations
- System Analysis: Automatic resource detection and optimization
- Complete LAMP/LEMP: Web server, PHP 7.4-8.4, Database
- Queue Workers: Supervisor with multiple queue support
- Laravel Ready: Scheduler, migrations, permissions
- Frontend Tools: Node.js, NPM, Yarn, asset building
[1] Full Laravel Stack - Complete web + database + Redis + queue + cron
[2] Full Stack + Monitoring - Everything + Prometheus + Grafana
[3] Web Server Only - Just Nginx/Apache/Caddy/FrankenPHP
[4] Database Only - MySQL, PostgreSQL, or Remote DB
[5] Queue Workers Only - Supervisor + Laravel queue workers
[6] Monitoring Only - Prometheus + Grafana + Node Exporter
[1] Full Laravel Stack - Complete web application setup
[2] Laravel Components Only - Add to existing server
[3] Database Only - MySQL or PostgreSQL
[4] Full Monitoring Stack - Prometheus + Grafana
[5] Metrics Collection - Prometheus + Node Exporter
[6] Visualization Only - Grafana dashboards
[7] Complete Solution - Laravel + Monitoring (Best for Production)
[8] Quick Production Setup - Pre-configured defaults
- Ubuntu 18.04+ or Debian 9+
- Root/sudo privileges
- 4GB+ RAM (2GB minimum)
- 20GB+ free disk space
| Component | Options | Purpose |
|---|---|---|
| Web Server | Nginx, Apache, Caddy, FrankenPHP | HTTP/HTTPS serving |
| PHP | 8.1, 8.2, 8.3, 8.4 | Laravel runtime |
| Database | MySQL, PostgreSQL, Remote | Data storage |
| Redis | Server + PhpRedis/Predis | Cache/Queue/Sessions |
| Supervisor | Queue workers | Background jobs |
| Prometheus | Metrics collector | Performance monitoring |
| Grafana | Dashboards | Visualization |
| Node Exporter | System metrics | Server monitoring |
| Component | Purpose |
|---|---|
| Nginx/Apache | Web Server |
| PHP 8.3 | Laravel Runtime |
| MySQL/PostgreSQL | Database |
| Redis | Cache/Queue/Sessions |
| Supervisor | Queue Workers |
| Prometheus | Metrics |
| Grafana | Dashboards |
| Node Exporter | System Metrics |
# Git Deployment (NEW!)
laravel-deploy pull # Deploy latest changes
laravel-deploy force # Force deploy (discard local changes)
laravel-deploy status # Check Git status
laravel-deploy branch # Switch branches
laravel-deploy log # View commit history
laravel-deploy rollback # Rollback to previous commit
# Queue workers
laravel-queue status # Check worker status
laravel-queue restart # Restart workers
laravel-queue logs # View logs
laravel-queue monitor # Live monitoring
# Scheduler
laravel-scheduler list # List scheduled tasks
laravel-scheduler run # Run manually
laravel-scheduler logs # View logs
laravel-scheduler tail # Tail today's log
# Redis
redis-manage status # Redis status
redis-manage info # Redis info
redis-manage monitor # Real-time monitoring
redis-manage cli # Redis CLI
redis-manage keys # List keys
redis-manage memory # Memory usage
# Monitoring
monitoring status # Service status
monitoring restart # Restart services
monitoring logs # View logs
monitoring urls # Access URLs# Check status
sudo systemctl status nginx mysql redis-server supervisor
# Restart services
sudo systemctl restart nginx
sudo supervisorctl restart projectname_*cd /var/www/html/your-project
# Run migrations
php artisan migrate
# Cache for production
php artisan config:cache
php artisan route:cache
php artisan view:cache
# Queue operations
php artisan queue:work
php artisan queue:restartcd /var/www/html/your-project
# Deploy latest changes
laravel-deploy pull
# → Pulls changes, updates dependencies, runs migrations, rebuilds assets
# Force deploy (discard local changes)
laravel-deploy force
# → Resets to remote state, performs full deployment
# Check deployment status
laravel-deploy status
# → Shows current branch, uncommitted changes, last commit
# Switch branches
laravel-deploy branch staging
# → Switches to staging branch and deploys
# View recent commits
laravel-deploy log
# → Shows last 10 commits with dates
# Rollback to previous commit
laravel-deploy rollback
# → Reverts to previous commit and redeploysDeployment Workflow:
- Enables maintenance mode
- Pulls/resets from Git
- Updates Composer dependencies
- Runs database migrations
- Clears Laravel cache
- Rebuilds frontend assets (if Node.js installed)
- Reloads PHP-FPM
- Restarts queue workers
- Disables maintenance mode
# Access URLs
http://your-ip:9090 # Prometheus
http://your-ip:3000 # Grafana (admin/admin)
http://your-ip:9100 # Node Exporter metricssudo chown -R www-data:www-data /var/www/html/your-project
sudo chmod -R 755 /var/www/html/your-project
sudo chmod -R 775 /var/www/html/your-project/storage
sudo chmod -R 775 /var/www/html/your-project/bootstrap/cachesudo supervisorctl status
sudo supervisorctl restart projectname_*
tail -f /var/www/html/your-project/storage/logs/queue_default.log# Check .env file
cat /var/www/html/your-project/.env | grep DB_
# Test connection
php artisan tinker
>>> DB::connection()->getPdo();# Apache
sudo apache2ctl configtest
sudo systemctl restart apache2
# Nginx
sudo nginx -t
sudo systemctl restart nginx| Feature | V1.0 | V2.0 | V3.0 |
|---|---|---|---|
| Installation | Linear | Menu-driven | Interactive Wizard |
| Web Servers | 2 | 2 | 4 (Nginx, Apache, Caddy, FrankenPHP) |
| PHP Versions | Multiple | 8.3 | 4 choices (8.1-8.4) |
| Database Options | Local only | Local only | Local + Remote |
| Redis Integration | Basic | Basic | Full (Cache/Session/Queue) |
| Monitoring | No | Yes | Yes + Dashboards |
| Templates | No | No | 8 production templates |
| Management CLIs | No | No | 4 tools |
| System Analysis | No | Yes | Enhanced |
| Modular Install | No | Yes | 7 modules |
| Documentation | Basic | Good | Comprehensive (8 guides) |
Use V1.0 if: You want the traditional simple approach
Use V2.0 if: You want monitoring and smart recommendations
Use V3.0 if: You want the most complete, production-ready solution ⭐
- Main Guide: README-V3.md - Complete feature documentation
- Quick Start: QUICKSTART.md - 5-minute setup guide
- Testing Guide: TESTING-CHECKLIST.md - Comprehensive testing
- Implementation: IMPLEMENTATION-SUMMARY.md - Technical details
- Templates Guide: templates/README.md - Configuration templates
- Dashboards Guide: dashboards/README.md - Grafana dashboards
- V2.0 Details: SETUP-V2-README.md
- Laravel Docs: https://laravel.com/docs
- Prometheus: https://prometheus.io/docs
- Grafana: https://grafana.com/docs
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: imabulhasan99@gmail.com
MIT License - See LICENSE file
Made for the Laravel community