Skip to content

Commit a34eb27

Browse files
authored
feat: Dashboard v2 - Full CRUD, Information-Rich UI, and Documentation (#28)
* feat: add Vue SPA dashboard foundation (WIP) * feat: complete Vue SPA dashboard with command palette and secure env vars - Add command palette (Cmd+K) with quick actions for deploy, restart, logs, open in Coolify, live site, GitHub, and resource management - Add toast notification system with success/error/warning/info types - Add secure environment variables with automatic masking for sensitive keys (PASSWORD, SECRET, TOKEN, KEY, etc.) and reveal toggle - Add Coolify deep links throughout (app header, resource cards, sidebar) - Consolidate pages: Dashboard, Deployments, Configuration (tabbed), Logs - Add search/filter for environment variables - Update SPA routing with catch-all for client-side navigation - Add comprehensive tests for env vars and database operations - Update Docker generator to handle wayfinder in CI/Docker builds - Improve install/provision command output and CLI formatting Stu Mason + AI <me@stumason.dev> * feat: add multi-environment switcher and backup toast notifications Add EnvironmentController with endpoints to list and switch between configured environments (dev, staging, production). Create EnvironmentSwitcher Vue component in sidebar that shows current environment and allows switching. Add toast notifications to backup trigger for better user feedback. Stu Mason + AI <me@stumason.dev> * fix: align API with Coolify - env vars and backup schedules - Remove is_build_time field from env var creation (Coolify doesn't support it) - Remove non-existent backup trigger endpoint (POST /databases/{uuid}/backup) - Implement proper backup schedule display with executions - Update backups() repository method to fetch schedules with their executions - Update tests to match new backup API structure Stu Mason + AI <me@stumason.dev> * fix: remove is_build_time checkboxes from env var forms The Coolify API doesn't support is_build_time field. Remove the UI elements that were still binding to it via v-model. Stu Mason + AI <me@stumason.dev> * feat: complete dashboard v2 with full CRUD and information-rich UI Dashboard Enhancements: - Hero status card with animated health indicators - Deployment info bar (branch, commit, last deploy, project) - One-click deploy with dropdown (latest, force, specific commit) - Database/cache cards with internal host and public port info - Recent deployments with inline accordion build logs - Lazy-loaded logs with 6-line preview and "See more" expansion - Color-coded stdout/stderr with line numbers - GitHub integration (commit links, branch links, repo links) - Coolify deep links to resources Bug Fixes: - Fix env var update 404 (was missing envUuid in URL path) - Fix deployment logs endpoint response format - Fix project/environment not displaying (fetch from API) New Features: - Backup schedule CRUD for databases - Environment multi-switcher in Configuration - Toast notifications for backup operations - Database start/stop/restart from Resources page API Changes: - ApplicationRepository::updateEnv() now takes envUuid parameter - DatabaseRepository::createBackup/updateBackup/deleteBackup added - DashboardStatsController returns project, environment, server data Documentation: - Complete README rewrite with badges and screenshot - Dashboard overview docs with all features documented - Landing page with feature cards and quick start Stu Mason + AI <me@stumason.dev> * fix: add input validation to controllers (PR review feedback) ApplicationController: - Whitelist allowed fields for update() with proper types/limits - Validate commit SHA format (7-40 hex chars) on deploy - Validate env var keys (uppercase, underscores only, starts with letter) - Validate env var values (max 65535 chars) - Add boolean flags validation for env vars DatabaseController: - Whitelist allowed fields for update() - Validate backup frequency (cron format regex) - Validate retention amounts (1-1000) - Validate S3 storage UUID Tests: - Add 7 new validation tests - Test invalid env var key format - Test required env var fields - Test invalid commit SHA format - Test health check port/interval ranges All 220 tests passing. Stu Mason + AI <me@stumason.dev>
1 parent 1cfd0b8 commit a34eb27

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+9301
-187
lines changed

README.md

Lines changed: 168 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
# Laravel Coolify
22

3-
Deploy Laravel to [Coolify](https://coolify.io) with one command. Dashboard, CLI, and Dockerfile generation included.
3+
[![CI](https://github.com/StuMason/laravel-coolify/actions/workflows/ci.yml/badge.svg)](https://github.com/StuMason/laravel-coolify/actions/workflows/ci.yml)
4+
[![Latest Version](https://img.shields.io/packagist/v/stumason/laravel-coolify.svg)](https://packagist.org/packages/stumason/laravel-coolify)
5+
[![PHP Version](https://img.shields.io/packagist/php-v/stumason/laravel-coolify.svg)](https://packagist.org/packages/stumason/laravel-coolify)
6+
[![Laravel Version](https://img.shields.io/badge/laravel-11.x%20|%2012.x-red.svg)](https://laravel.com)
7+
[![License](https://img.shields.io/packagist/l/stumason/laravel-coolify.svg)](LICENSE)
8+
[![Downloads](https://img.shields.io/packagist/dt/stumason/laravel-coolify.svg)](https://packagist.org/packages/stumason/laravel-coolify)
9+
10+
**Deploy Laravel to [Coolify](https://coolify.io) with one command. Dashboard, CLI, and Dockerfile generation included.**
11+
12+
Like Laravel Horizon for queues, but for your entire infrastructure.
13+
14+
![Laravel Coolify Dashboard](docs/dashboard.png)
15+
16+
## Why This Exists
17+
18+
Self-hosting with Coolify is great, but managing deployments from the Coolify UI gets tedious. This package gives you:
19+
20+
- **A beautiful dashboard** inside your Laravel app - deploy, restart, view logs, manage env vars
21+
- **Artisan commands** for everything - CI/CD pipelines, local development, scripting
22+
- **Production-ready Dockerfiles** generated automatically - no Docker knowledge required
23+
- **Full API access** to Coolify - build custom tooling, automations, whatever you need
424

525
## Quick Start
626

@@ -16,30 +36,170 @@ COOLIFY_URL=https://your-coolify.com
1636
COOLIFY_TOKEN=your-api-token
1737
```
1838

19-
Then:
39+
Then provision your infrastructure:
2040

2141
```bash
2242
php artisan coolify:provision
2343
```
2444

25-
Creates app + PostgreSQL + Dragonfly on Coolify and deploys.
45+
Creates app + PostgreSQL + Dragonfly on Coolify and deploys. One command.
2646

2747
## Documentation
2848

29-
**[Read the docs](https://stumason.github.io/laravel-coolify)**
49+
**[Read the full docs](https://stumason.github.io/laravel-coolify)**
50+
51+
## Dashboard Features
52+
53+
Access at `/coolify` (configurable) - works like Horizon's dashboard.
54+
55+
| Feature | Description |
56+
|---------|-------------|
57+
| **Live Status** | Real-time application health with animated indicators |
58+
| **One-Click Deploy** | Deploy latest, force rebuild, or deploy specific commits |
59+
| **Deployment History** | View all deployments with inline expandable build logs |
60+
| **Database Management** | Start/stop/restart PostgreSQL, MySQL, Redis, Dragonfly |
61+
| **Environment Variables** | Secure CRUD for env vars with masked values |
62+
| **Build Logs** | Stream deployment logs in real-time |
63+
| **GitHub Integration** | Links to commits, branches, repository |
64+
| **Coolify Deep Links** | Jump directly to resources in Coolify UI |
65+
66+
### Dashboard Screenshots
67+
68+
The dashboard shows everything at a glance:
69+
70+
- Application status with health checks
71+
- Current branch, commit, and last deploy time
72+
- Database and cache status with connection strings
73+
- Recent deployments with inline build logs
74+
- Quick actions for deploy, restart, stop
3075

31-
## Commands
76+
## Artisan Commands
3277

3378
| Command | Description |
3479
|---------|-------------|
3580
| `coolify:install` | Publish config, generate Dockerfile |
3681
| `coolify:provision` | Create infrastructure on Coolify |
3782
| `coolify:deploy` | Trigger deployment |
3883
| `coolify:status` | Show application status |
39-
| `coolify:logs` | View logs |
84+
| `coolify:logs` | View application logs |
4085
| `coolify:restart` | Restart application |
41-
| `coolify:rollback` | Rollback deployment |
86+
| `coolify:rollback` | Rollback to previous deployment |
87+
88+
### CI/CD Integration
89+
90+
```yaml
91+
# .github/workflows/deploy.yml
92+
- name: Deploy to Coolify
93+
run: php artisan coolify:deploy --force
94+
env:
95+
COOLIFY_URL: ${{ secrets.COOLIFY_URL }}
96+
COOLIFY_TOKEN: ${{ secrets.COOLIFY_TOKEN }}
97+
```
98+
99+
## Dockerfile Generation
100+
101+
The install command generates production-optimized Docker configuration:
102+
103+
```bash
104+
php artisan coolify:install
105+
```
106+
107+
Creates:
108+
- `Dockerfile` - Multi-stage build with OPcache, proper permissions
109+
- `docker/nginx.conf` - Optimized for Laravel
110+
- `docker/supervisord.conf` - Process management (Horizon, Reverb, Scheduler auto-detected)
111+
- `docker/php.ini` - Production PHP settings
112+
113+
Auto-detects and configures:
114+
- Laravel Horizon (queue workers)
115+
- Laravel Reverb (WebSockets)
116+
- Laravel Scheduler
117+
118+
## Programmatic API
119+
120+
```php
121+
use Stumason\Coolify\Coolify;
122+
123+
// Deploy
124+
Coolify::deploy();
125+
Coolify::deploy('custom-uuid');
126+
127+
// Status
128+
$status = Coolify::status();
129+
$logs = Coolify::logs();
130+
131+
// Repositories for full control
132+
Coolify::applications()->get($uuid);
133+
Coolify::applications()->deploy($uuid, force: true);
134+
Coolify::applications()->restart($uuid);
135+
Coolify::applications()->envs($uuid);
136+
137+
Coolify::databases()->all();
138+
Coolify::databases()->start($uuid);
139+
140+
Coolify::deployments()->forApplication($uuid);
141+
Coolify::deployments()->cancel($uuid);
142+
143+
Coolify::servers()->all();
144+
Coolify::services()->all();
145+
```
146+
147+
## Configuration
148+
149+
```php
150+
// config/coolify.php
151+
return [
152+
'url' => env('COOLIFY_URL'),
153+
'token' => env('COOLIFY_TOKEN'),
154+
'path' => env('COOLIFY_PATH', 'coolify'), // Dashboard URL path
155+
156+
'docker' => [
157+
'php_version' => '8.3',
158+
'node_version' => '20',
159+
'extensions' => ['pdo_pgsql', 'redis', 'pcntl', 'bcmath'],
160+
],
161+
];
162+
```
163+
164+
## Authentication
165+
166+
By default, the dashboard is only accessible in `local` environment. For production:
167+
168+
```php
169+
// app/Providers/AppServiceProvider.php
170+
use Stumason\Coolify\Coolify;
171+
172+
public function boot(): void
173+
{
174+
Coolify::auth(function ($request) {
175+
return $request->user()?->isAdmin();
176+
});
177+
}
178+
```
179+
180+
## Requirements
181+
182+
- PHP 8.2+
183+
- Laravel 11 or 12
184+
- Coolify 4.x instance with API access
185+
186+
## Testing
187+
188+
```bash
189+
composer test # Run tests
190+
composer test:coverage # With coverage
191+
composer lint # Static analysis
192+
```
193+
194+
## Contributing
195+
196+
Contributions welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) first.
42197

43198
## License
44199

45-
MIT
200+
MIT - see [LICENSE](LICENSE)
201+
202+
## Credits
203+
204+
- [Stu Mason](https://github.com/StuMason)
205+
- [All Contributors](../../contributors)

dist/.gitkeep

Whitespace-only changes.

docs/dashboard.png

249 KB
Loading

docs/public/dashboard.png

249 KB
Loading

docs/src/assets/dashboard.png

249 KB
Loading
Lines changed: 91 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,110 @@
11
---
22
title: Dashboard Overview
3-
description: Coolify dashboard within Laravel
3+
description: A beautiful, feature-rich dashboard for managing your Coolify infrastructure
44
---
55

6+
The Laravel Coolify dashboard gives you complete control over your infrastructure from within your Laravel application. Think of it like Laravel Horizon, but for your entire deployment pipeline.
7+
8+
![Dashboard Screenshot](/dashboard.png)
9+
610
## Access
711

812
Default route: `/coolify`
913

10-
Configurable via `COOLIFY_PATH` environment variable.
14+
Configurable via `COOLIFY_PATH` environment variable or in `config/coolify.php`.
1115

1216
## Features
1317

14-
The dashboard shows:
15-
- Application status and health
16-
- Recent deployments with status
17-
- Database connection status
18-
- Redis/Dragonfly status
19-
- Quick actions (deploy, restart, view logs)
18+
### Hero Status Card
19+
20+
The main dashboard shows your application's current state at a glance:
21+
22+
- **Animated status indicator** - Pulsing green dot when running, red when stopped
23+
- **Build pack info** - Shows if using Dockerfile, Nixpacks, etc.
24+
- **Server info** - Which Coolify server hosts your app
25+
- **Quick links** - Direct links to your site, GitHub repo, and Coolify UI
26+
27+
### Deployment Info Bar
28+
29+
Essential deployment information always visible:
30+
31+
| Field | Description |
32+
|-------|-------------|
33+
| **Branch** | Current Git branch with link to GitHub |
34+
| **Current Commit** | Short SHA with GitHub link and copy button |
35+
| **Last Deploy** | Relative time since last deployment with duration |
36+
| **Project** | Coolify project and environment name |
37+
38+
### One-Click Deployments
39+
40+
The deploy button dropdown offers multiple options:
41+
42+
- **Deploy Latest** - Deploy HEAD from your current branch
43+
- **Force Rebuild** - Full rebuild without Docker cache
44+
- **Deploy Specific Commit** - Enter any commit SHA to deploy
45+
- **Redeploy Previous** - Quick redeploy of recent commits
46+
47+
### Database & Cache Cards
48+
49+
Resource cards for your databases showing:
50+
51+
- Status badge (Healthy/Stopped/etc.)
52+
- Database type and image version
53+
- Internal hostname for container networking
54+
- Public port if exposed
55+
- Start/Stop/Restart controls
56+
- Direct link to Coolify UI
57+
58+
### Recent Deployments
59+
60+
Full deployment history with:
61+
62+
- **Status icons** - Visual indicators for finished/failed/in-progress
63+
- **Commit info** - SHA with GitHub links, commit messages
64+
- **Duration** - How long each deployment took
65+
- **Relative timestamps** - "26m ago", "2h ago", etc.
66+
- **Redeploy button** - One-click redeploy of any commit
67+
- **Inline logs** - Expandable build logs without leaving the page
68+
69+
### Accordion Build Logs
70+
71+
Click "Logs" on any deployment to expand inline logs:
72+
73+
- **Lazy loading** - Logs fetched on demand, not upfront
74+
- **6-line preview** - See a summary without overwhelming detail
75+
- **"See more" expansion** - Expand to see all logs
76+
- **Color-coded output** - stdout vs stderr differentiated
77+
- **Line numbers** - Easy reference for debugging
78+
- **Link to full logs** - Jump to dedicated log viewer
79+
80+
## Pages
81+
82+
The dashboard includes multiple pages accessible from the sidebar:
83+
84+
| Page | Description |
85+
|------|-------------|
86+
| **Dashboard** | Main overview with status, deployments, resources |
87+
| **Deployments** | Full deployment history with search and filters |
88+
| **Resources** | All databases and services in your environment |
89+
| **Configuration** | Environment variables, settings, backup schedules |
90+
| **Logs** | Real-time application logs |
91+
92+
## Quick Actions
93+
94+
The command palette (`Cmd/Ctrl + K`) provides quick access to:
95+
96+
- Deploy application
97+
- Restart application
98+
- View logs
99+
- Navigate between pages
100+
- Stop/Start services
20101

21102
## Local-Only Access
22103

23-
By default, the dashboard is only accessible when:
104+
By default, the dashboard is only accessible in local environment:
24105

25106
```php
26107
app()->environment('local')
27108
```
28109

29-
For production access, configure authentication.
110+
For production access, see [Authentication](/dashboard/authentication).

0 commit comments

Comments
 (0)