stumason/laravel-coolify
Composer 安装命令:
composer require stumason/laravel-coolify
包简介
Manage, deploy, and monitor your Laravel application on Coolify - like Horizon for your infrastructure.
README 文档
README
Deploy Laravel to Coolify with one command. Dashboard, CLI, and Dockerfile generation included.
Like Laravel Horizon for queues, but for your entire infrastructure.
Why This Exists
Self-hosting with Coolify is great, but managing deployments from the Coolify UI gets tedious. This package gives you:
- A beautiful dashboard inside your Laravel app - deploy, restart, view logs, manage env vars
- Artisan commands for everything - CI/CD pipelines, local development, scripting
- Production-ready Dockerfiles generated automatically - no Docker knowledge required
- Full API access to Coolify - build custom tooling, automations, whatever you need
Quick Start
composer require stumason/laravel-coolify php artisan coolify:install
Add to .env:
COOLIFY_URL=https://your-coolify.com COOLIFY_TOKEN=your-api-token
Then provision your infrastructure:
php artisan coolify:provision
This creates app + PostgreSQL + Dragonfly on Coolify and deploys. The provision command automatically adds COOLIFY_PROJECT_UUID to your .env file, enabling all other commands to work without manual configuration.
Documentation
Dashboard Features
Access at /coolify (configurable) - works like Horizon's dashboard.
| Feature | Description |
|---|---|
| Live Status | Real-time application health with animated indicators |
| One-Click Deploy | Deploy latest, force rebuild, or deploy specific commits |
| Deployment History | View all deployments with inline expandable build logs |
| Database Management | Start/stop/restart PostgreSQL, MySQL, Redis, Dragonfly |
| Environment Variables | Secure CRUD for env vars with masked values |
| Build Logs | Stream deployment logs in real-time |
| GitHub Integration | Links to commits, branches, repository |
| Coolify Deep Links | Jump directly to resources in Coolify UI |
Dashboard Screenshots
The dashboard shows everything at a glance:
- Application status with health checks
- Current branch, commit, and last deploy time
- Database and cache status with connection strings
- Recent deployments with inline build logs
- Quick actions for deploy, restart, stop
Laravel Kick Integration
Install laravel-kick on your deployed app for enhanced introspection:
# On your deployed app
composer require stumason/laravel-kick
Add to the app's Coolify environment:
KICK_ENABLED=true
KICK_TOKEN=your-secure-token
A new Kick tab appears with:
- Health checks (database, cache, storage, redis)
- System stats (CPU, memory, disk, uptime)
- Log viewer with filtering and search
- Queue status and failed jobs
- Artisan command execution
Artisan Commands
| Command | Description |
|---|---|
coolify:install |
Publish config, generate Dockerfile |
coolify:provision |
Create infrastructure on Coolify |
coolify:deploy |
Trigger deployment |
coolify:status |
Show application status |
coolify:logs |
View application logs |
coolify:restart |
Restart application |
coolify:rollback |
Rollback to previous deployment |
CI/CD Integration
# .github/workflows/deploy.yml - name: Deploy to Coolify run: php artisan coolify:deploy --force env: COOLIFY_URL: ${{ secrets.COOLIFY_URL }} COOLIFY_TOKEN: ${{ secrets.COOLIFY_TOKEN }}
Dockerfile Generation
The install command generates production-optimized Docker configuration:
php artisan coolify:install
Creates:
Dockerfile- Multi-stage build with OPcache, proper permissionsdocker/nginx.conf- Optimized for Laraveldocker/supervisord.conf- Process management (Horizon, Reverb, Scheduler auto-detected)docker/php.ini- Production PHP settings
Auto-detects and configures:
- Laravel Horizon (queue workers)
- Laravel Reverb (WebSockets)
- Laravel Scheduler
Programmatic API
use Stumason\Coolify\Coolify; // Deploy Coolify::deploy(); Coolify::deploy('custom-uuid'); // Status $status = Coolify::status(); $logs = Coolify::logs(); // Repositories for full control Coolify::applications()->get($uuid); Coolify::applications()->deploy($uuid, force: true); Coolify::applications()->restart($uuid); Coolify::applications()->envs($uuid); Coolify::databases()->all(); Coolify::databases()->start($uuid); Coolify::deployments()->forApplication($uuid); Coolify::deployments()->cancel($uuid); Coolify::servers()->all(); Coolify::services()->all();
Configuration
After running coolify:provision, your .env will contain:
COOLIFY_URL=https://your-coolify.com COOLIFY_TOKEN=your-api-token COOLIFY_PROJECT_UUID=your-project-uuid # Added automatically by provision
The dashboard automatically fetches your application and resources from the configured project's environment. No need to manually configure application UUIDs.
// config/coolify.php return [ 'url' => env('COOLIFY_URL'), 'token' => env('COOLIFY_TOKEN'), 'project_uuid' => env('COOLIFY_PROJECT_UUID'), // Set by coolify:provision 'path' => env('COOLIFY_PATH', 'coolify'), 'docker' => [ 'php_version' => '8.4', 'use_base_image' => true, // Fast builds with pre-built images ], ];
Authentication
By default, the dashboard is only accessible in local environment. For production:
// app/Providers/AppServiceProvider.php use Stumason\Coolify\Coolify; public function boot(): void { Coolify::auth(function ($request) { return $request->user()?->isAdmin(); }); }
Requirements
- PHP 8.2+
- Laravel 11 or 12
- Coolify 4.x instance with API access
Testing
composer test # Run tests composer test:coverage # With coverage composer lint # Static analysis
Contributing
Contributions welcome! Please read CONTRIBUTING.md first.
License
MIT - see LICENSE
Credits
统计信息
- 总下载量: 4.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-17
