Commit graph

14009 commits

Author SHA1 Message Date
Andras Bacsai
475cfd78cd fix: Prevent N+1 query in LocalPersistentVolume.isDockerComposeResource()
Use relationLoaded() check before accessing the application relationship
to avoid triggering individual queries for each volume when rendering
storage lists. Update Storage.php to eager load the relationship.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 21:23:46 +01:00
Andras Bacsai
f152ec00ad fix: Detect read-only Docker volumes with long-form syntax and enable refresh
- Fixed isReadOnlyVolume() to detect both short-form (:ro) and long-form (read_only: true) Docker Compose volume syntax
- Fixed path matching to use mount_path only (fs_path is transformed during parsing from ./file to absolute path)
- Added "Load from server" button for read-only volumes to allow users to refresh content
- Changed loadStorageOnServer() authorization from 'update' to 'view' since loading is a read operation
- Added helper text to Content field warning users that content may be outdated
- Applied fixes to both LocalFileVolume and LocalPersistentVolume models

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-11 14:18:58 +01:00
Andras Bacsai
07153de68d
Fix deployment marked as failed after healthy container rolling update (#7583) 2025-12-11 10:01:00 +01:00
Andras Bacsai
5b20b49f53
feat: Add deterministic UUIDs to dev seeders (#7584) 2025-12-11 09:58:33 +01:00
Andras Bacsai
2f721c6166 feat: Add deterministic UUIDs to development seeders
Add fixed UUIDs to all development seeders for programmatic API access:
- Server: localhost
- Project: project
- Applications: docker-compose, nodejs, dockerfile, dockerfile-pure
- StandaloneDocker: docker
- StandalonePostgresql: postgresql
- S3Storage: minio
- PrivateKeys: ssh, github-key
- GithubApps: github-public, github-app
- GitlabApp: gitlab-public
- LocalPersistentVolume: volume

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-11 09:54:27 +01:00
Andras Bacsai
a2e5b2d67d Fix deployment marked as failed when healthy container completes rolling update
Prevent deployment status from regressing to FAILED after it's marked as FINISHED by:
1. Calling completeDeployment() first in post_deployment() before any operations that could fail
2. Wrapping all post-deployment side effects in try-catch blocks
3. Adding FINISHED to terminal states that cannot be changed
4. Protecting ExecuteRemoteCommand from overwriting FINISHED status

This fixes the issue where a deployment with a healthy container and successful rolling update was still marked as Failed in the UI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-11 09:42:02 +01:00
Andras Bacsai
18675c8a4d
Fix restart counter persistence and add crash loop example (#7582) 2025-12-11 09:40:56 +01:00
Andras Bacsai
9598562ca0
Fix deployment logs overlap with indicator (#7580) 2025-12-11 09:40:39 +01:00
Andras Bacsai
c6a89087c5 Refactor deployment indicator to use server-side route detection
Replace client-side JavaScript URL checking with Laravel's routeIs() for determining when to reduce indicator opacity. This simplifies the code and uses route names as the source of truth.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-11 09:39:56 +01:00
Andras Bacsai
01308dede5 Fix restart counter persistence and add crash loop example
- Move restart counter reset from Livewire to ApplicationDeploymentJob to prevent race conditions with GetContainersStatus
- Remove artificial restart_type=manual tracking (never used in codebase)
- Add Crash Loop Example in seeder for testing restart tracking UI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-11 09:39:55 +01:00
Andras Bacsai
918dc788ce
Remove duplicate getArchDockerInstallCommand() method (#7581) 2025-12-11 09:31:43 +01:00
Andras Bacsai
ac48c656ba
Fix deployment follow logs stopping mid-deployment (#7579) 2025-12-11 09:26:19 +01:00
Andras Bacsai
206a9c03d2 Remove duplicate getArchDockerInstallCommand() method
The method was defined twice with the first (outdated) definition using
-Syyy and lacking proper flags. Keep the improved version that uses -Syu
with --needed for idempotency and proper systemctl ordering.
2025-12-11 09:25:35 +01:00
Andras Bacsai
56102f6321 Prevent multiple deploymentFinished event dispatches
Add flag to ensure event is only dispatched once, avoiding wasteful
duplicate dispatches during the race condition window before Livewire
removes wire:poll from the DOM.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-11 09:25:22 +01:00
Andras Bacsai
911cfa0b38 Fix deployment logs overlap with indicator and improve visibility
- Reduce deployment logs max-height from 40rem to 30rem to prevent overlap with deployments indicator
- Add conditional opacity (60%) to deployments indicator on deployment pages only (100% on other pages)
- Indicator becomes fully visible on hover or when expanded

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-11 09:24:15 +01:00
Andras Bacsai
d9762e0310 Fix deployment log follow feature stopping mid-deployment
Removed auto-disable behaviors that caused follow logs to stop unexpectedly:
- Removed scroll detection that disabled following when user scrolled >50px from bottom
- Removed fullscreen exit handler that disabled following
- Removed ServiceChecked event listener that caused unnecessary flickers

Follow logs now only stops when:
- User explicitly clicks the Follow Logs button
- Deployment finishes (auto-scrolls to end first, then disables after 500ms delay)

Also improved get-logs component with memory optimizations:
- Limited display to last 2000 lines to prevent memory exhaustion
- Added debounced search (300ms) and scroll handling (150ms)
- Optimized DOM rendering

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-11 09:14:27 +01:00
Andras Bacsai
0e6a2fc15d
Fix Docker container race condition during upgrades (#7565) 2025-12-10 14:19:09 +01:00
Andras Bacsai
65a83fe050 Fix Docker container race condition during upgrades
Add --project-name coolify to docker compose commands to ensure consistent
container naming when executed inside helper containers. Remove --force-recreate
to only recreate containers when image or configuration changes, reducing
race condition risk during concurrent upgrades.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 14:14:43 +01:00
Andras Bacsai
0f9344bdc2
Fix empty logs display and fullscreen coverage (#7564) 2025-12-10 14:05:54 +01:00
Andras Bacsai
37b71cfda3 Fix empty logs display and fullscreen coverage in logs viewer
- Change empty state message from "Refresh to get the logs..." to "No logs yet." with proper styling
- Auto-fetch logs when expanding containers by passing refresh=true to getLogs()
- Ensure fullscreen mode covers entire viewport with solid background by overriding x-collapse styles

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 14:04:10 +01:00
Andras Bacsai
4fca2d457b
feat: add Hetzner server provisioning API endpoints (#7562) 2025-12-10 13:52:41 +01:00
Andras Bacsai
9a671d0d8f feat: add UUID column to cloud_provider_tokens and populate existing records 2025-12-10 13:52:04 +01:00
Andras Bacsai
56394ba093 fix: return actual error message from token validation endpoint
- Return the specific error from validateProviderToken() instead of
  generic "Failed to validate token." message
- Update test to expect the actual error message

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 13:22:53 +01:00
Andras Bacsai
d68ee93445 Update garage.yaml for improved configuration clarity 2025-12-10 12:57:34 +01:00
Andras Bacsai
596b1cb76e refactor: extract token validation into reusable method
- Add validateProviderToken() helper method to reduce code duplication
- Use request body only ($request->json()->all()) to avoid route parameter conflicts
- Add proper logging for token validation failures
- Add missing DB import to migration file
- Minor test formatting fix

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 12:56:57 +01:00
Andras Bacsai
426a6334c7 Remove provisional Hetzner API documentation
These documentation files were created during development but should not be committed at this stage. The API implementation is complete and tested, but the documentation will be provided separately through official channels.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 12:43:38 +01:00
Andras Bacsai
10003cec3d fix: add UUID support to CloudProviderToken model
- Add uuid column to cloud_provider_tokens table via migration
- Update CloudProviderToken to extend BaseModel for auto UUID generation
- Generate UUIDs for existing records in migration
- Fixes null uuid issue in API responses

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 08:59:13 +01:00
Andras Bacsai
ef0a1241b0 fix: rename validate() to validateToken() to avoid parent method conflict
The validate() method conflicted with Controller::validate(). Renamed to
validateToken() to resolve the declaration compatibility issue.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 08:57:04 +01:00
Andras Bacsai
62c394d3a1 feat: add Hetzner server provisioning API endpoints
Add complete API support for Hetzner server provisioning, matching UI functionality:

Cloud Provider Token Management:
- POST /api/v1/cloud-tokens - Create and validate tokens
- GET /api/v1/cloud-tokens - List all tokens
- GET /api/v1/cloud-tokens/{uuid} - Get specific token
- PATCH /api/v1/cloud-tokens/{uuid} - Update token name
- DELETE /api/v1/cloud-tokens/{uuid} - Delete token
- POST /api/v1/cloud-tokens/{uuid}/validate - Validate token

Hetzner Resource Discovery:
- GET /api/v1/hetzner/locations - List datacenters
- GET /api/v1/hetzner/server-types - List server types
- GET /api/v1/hetzner/images - List OS images
- GET /api/v1/hetzner/ssh-keys - List SSH keys

Server Provisioning:
- POST /api/v1/servers/hetzner - Create server with full options

Features:
- Token validation against provider APIs before storage
- Smart SSH key management with MD5 fingerprint deduplication
- IPv4/IPv6 network configuration with preference logic
- Cloud-init script support with YAML validation
- Team-based isolation and security
- Comprehensive test coverage (40+ test cases)
- Complete documentation with curl examples and Yaak collection

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-10 08:38:09 +01:00
Andras Bacsai
d2a1b96598
Bump version to 4.0.0-beta.454 (#7545) 2025-12-10 08:27:22 +01:00
Andras Bacsai
6e15d8e5f8
Add ValidProxyConfigFilename rule for dynamic proxy config validation (#7544) 2025-12-09 16:32:41 +01:00
Andras Bacsai
7c552e8a6a
Fix API response to return fqdn instead of non-existent domains attribute (#7546) 2025-12-09 16:29:02 +01:00
Andras Bacsai
32e047e512 Fix API response to return fqdn instead of non-existent domains attribute
The Application model stores domain as 'fqdn' not 'domains'. The API response
was incorrectly using data_get($application, 'domains') which always returned
null. Fixed all 5 application creation endpoint responses.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 16:26:08 +01:00
Andras Bacsai
5ec3f39b9b
Add autogenerate_domain API parameter for applications (#7515) 2025-12-09 16:19:49 +01:00
Andras Bacsai
25e295e627 Bump version to 4.0.0-beta.454 2025-12-09 16:15:55 +01:00
Andras Bacsai
028fb5c22c Add ValidProxyConfigFilename rule for dynamic proxy config validation
Adds a new Laravel validation rule to prevent path traversal, hidden files, and invalid filenames in the dynamic proxy configuration feature. Validates filenames to ensure they contain only safe characters, don't exceed filesystem limits, and don't use reserved names.

- New Rule: ValidProxyConfigFilename with comprehensive validation
- Updated: NewDynamicConfiguration to use the new rule
- Added: 13 unit tests covering all validation scenarios

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 16:12:45 +01:00
Andras Bacsai
b3289aff71
fix: Prevent terminal disconnects when browser tab loses focus (#7538) 2025-12-08 20:48:53 +01:00
Andras Bacsai
dca6d9f7aa fix: Prevent terminal disconnects when browser tab loses focus
Add visibility API handling to pause heartbeat monitoring when the browser tab is hidden, preventing false disconnection timeouts. When the tab becomes visible again, verify the connection is still alive or attempt reconnection.

Also remove the ApplicationStatusChanged event listener that was triggering terminal reloads whenever any application status changed across the team.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 20:48:03 +01:00
Andras Bacsai
e1d5da3622
fix: Add comprehensive PR cleanup to GitLab, Bitbucket, and Gitea (#7537) 2025-12-08 20:12:33 +01:00
Andras Bacsai
ebac90097a fix: Escape container name in orphaned PR cleanup job
Add shell escaping with escapeshellarg() for container names in the
docker rm command to prevent command injection. Also add validation
to skip containers with missing names and log a warning.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 20:09:00 +01:00
Andras Bacsai
86a02a12e6
Update app/Actions/Application/CleanupPreviewDeployment.php
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-12-08 17:35:13 +01:00
Andras Bacsai
945cce9587 feat: Add scheduled job to cleanup orphaned PR containers
Add CleanupOrphanedPreviewContainersJob that runs daily to find and remove any PR preview containers that weren't properly cleaned up when their PR was closed.

The job:
- Scans all functional servers for containers with coolify.pullRequestId label
- Checks if the corresponding ApplicationPreview record exists in the database
- Removes containers where the preview record no longer exists (truly orphaned)
- Acts as a safety net for webhook failures or race conditions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 17:15:52 +01:00
Andras Bacsai
d27070b215 fix: Add comprehensive PR cleanup to GitLab, Bitbucket, and Gitea webhooks
Create a shared CleanupPreviewDeployment action that unifies PR cleanup logic across all Git providers. Previously, GitHub had comprehensive cleanup (cancels active deployments, kills helper containers, removes all PR containers), while GitLab, Bitbucket, and Gitea only did basic cleanup (delete preview record and remove one container by name).

This fix ensures all providers properly clean up orphaned PR containers when a PR is closed/merged, preventing security issues and resource waste. Also fixes early return bug in GitLab webhook handler.

Fixes #2610

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 17:10:39 +01:00
Andras Bacsai
bade9186fd fix: change default session driver from database to redis 2025-12-08 14:14:52 +01:00
Andras Bacsai
2b81d7fd1b
perf: Add request-level caching and indexes for dashboard optimization (#7533) 2025-12-08 14:06:13 +01:00
Andras Bacsai
44de3f3705 feat: add migration for performance indexes on multiple tables 2025-12-08 13:56:46 +01:00
Andras Bacsai
a661ad796c docs: update application architecture and database patterns for request-level caching best practices 2025-12-08 13:46:31 +01:00
Andras Bacsai
5e8d11f732 refactor: replace queries with cached versions for performance improvements 2025-12-08 13:39:33 +01:00
Andras Bacsai
bb83f4e5c3
Add Arch Linux server support and fix package sanitization (#7531) 2025-12-08 09:18:14 +01:00
Andras Bacsai
089007919d Add package validation guard and make pacman idempotent
- Add explicit validation in UpdatePackage to require package name when
  'all' is false, preventing empty package commands being sent to servers
- Add --needed flag to pacman install in InstallDocker for idempotent
  Docker installation on Arch Linux

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 09:17:24 +01:00