Commit Graph
1443 Commits
Author SHA1 Message Date
Andras Bacsai 9a4b4280be refactor(jobs): split task skip checks into critical and runtime phases
Move expensive runtime checks (service/application status) after cron
validation to avoid running them for tasks that aren't due. Critical
checks (orphans, infrastructure) remain in first phase.

Also fix database heading parameters to be built from the model.
2026-02-28 18:37:51 +01:00
Andras Bacsai 31555f9e8a fix(jobs): prevent non-due jobs firing on restart and enrich skip logs with resource links
- Refactor shouldRunNow() to only fire on first run (empty cache) if actually due by cron schedule, preventing spurious executions after cache loss or service restart
- Add enrichSkipLogsWithLinks() method to fetch and populate resource names and links for tasks, backups, and docker cleanup jobs in skip logs
- Update skip logs UI to display resource column with links to related resources, improving navigation and context
- Add fallback display when linked resources are deleted
- Expand tests to cover both restart scenarios: non-due jobs (should not fire) and due jobs (should fire)
2026-02-28 18:03:29 +01:00
Andras Bacsai 63be5928ab feat(scheduler): add pagination to skipped jobs and filter manager start events
- Implement pagination for skipped jobs display with 20 items per page
- Add pagination controls (previous/next buttons) to the scheduled jobs view
- Exclude ScheduledJobManager "started" events from run logs, keeping only "completed" events
- Add ShouldBeEncrypted interface to ScheduledTaskJob for secure queue handling
- Update log filtering to fetch 500 recent skips and slice for pagination
- Use Log facade instead of fully qualified class name
2026-02-28 16:23:58 +01:00
Andras Bacsai a0c177f6f2 feat(jobs): add queue delay resilience to scheduled job execution
Implement dedup key-based cron tracking to make scheduled jobs resilient to queue
delays. Even if a job is delayed by minutes, it will catch the missed cron window
by tracking previousRunDate in cache instead of relying on isDue() alone.

- Add dedupKey parameter to shouldRunNow() in ScheduledJobManager
  - When provided, uses getPreviousRunDate() + cache tracking for resilience
  - Falls back to isDue() for docker cleanups without dedup key
  - Prevents double-dispatch within same cron window

- Optimize ServerConnectionCheckJob dispatch
  - Skip SSH checks if Sentinel is healthy (enabled and live)
  - Reduces redundant checks when Sentinel heartbeat proves connectivity

- Remove hourly Sentinel update checks
  - Consolidate to daily CheckAndStartSentinelJob dispatch
  - Crash recovery handled by sentinelOutOfSync → ServerCheckJob flow

- Add logging for skipped database backups with context (backup_id, database_id, status)

- Refactor skip reason methods to accept server parameter, avoiding redundant queries

- Add comprehensive test suite for scheduling with various delay scenarios and timezones
2026-02-28 15:06:25 +01:00
Andras Bacsai f68793ed69 feat(jobs): optimize async job dispatches and enhance Stripe subscription sync
Reduce unnecessary job queue pressure and improve subscription sync reliability:

- Cache ServerStorageCheckJob dispatch to only trigger on disk percentage changes
- Rate-limit ConnectProxyToNetworksJob to maximum once per 10 minutes
- Add progress callback support to SyncStripeSubscriptionsJob for UI feedback
- Implement bulk fetching of valid Stripe subscription IDs for efficiency
- Detect and report resubscribed users (same email, different customer ID)
- Fix CleanupUnreachableServers query operator (>= 3 instead of = 3)
- Improve empty subId validation in PushServerUpdateJob
- Optimize relationship access by using properties instead of query methods
- Add comprehensive test coverage for all optimizations
2026-02-28 13:18:44 +01:00
Andras BacsaiandGitHub c93296e9a6 feat(healthcheck): add command-based health check support (#8612) 2026-02-25 12:09:59 +01:00
Andras Bacsai 3e755338b4 fix(healthchecks): remove redundant newline sanitization from CMD healthcheck
Simplify the CMD healthcheck generation by removing the str_replace call that
normalizes newlines. The command is now used directly without modification,
following the pattern of centralized command escaping in recent changes.
2026-02-25 12:08:24 +01:00
Andras Bacsai b88f9fca67 chore: prepare for PR 2026-02-25 12:07:29 +01:00
Andras Bacsai 521d995ea1 Merge remote-tracking branch 'origin/next' into 7765-healthcheck-investigation 2026-02-25 11:57:58 +01:00
Andras BacsaiandGitHub 57848c25e9 fix(docker): centralize command escaping in executeInDocker helper (#8615) 2026-02-25 11:51:23 +01:00
Andras Bacsai 992b922df3 chore: prepare for PR 2026-02-25 11:50:57 +01:00
Andras Bacsai 609cb4190e fix(health-checks): sanitize and validate CMD healthcheck commands
- Add regex validation to restrict allowed characters (alphanumeric, spaces, and specific safe symbols)
- Enforce maximum 1000 character limit on healthcheck commands
- Strip newlines and carriage returns to prevent command injection
- Change input field from textarea to text input in UI
- Add warning callout about prohibited shell operators
- Add comprehensive validation tests for both valid and malicious command patterns
2026-02-25 11:28:33 +01:00
Andras Bacsai 65d4005493 Merge remote-tracking branch 'origin/next' into 7765-healthcheck-investigation
# Conflicts:
#	app/Livewire/Project/Shared/HealthChecks.php
2026-02-25 11:02:38 +01:00
Andras Bacsai 30c0b37689 chore: prepare for PR 2026-02-25 10:58:29 +01:00
Aditya TripathiandGitHub 036f565785 Merge branch 'next' into feat/healthcheck-cmd 2026-02-24 22:22:02 +05:30
Andras Bacsai ec14b55f0a chore: prepare for PR 2026-02-23 14:28:28 +01:00
Andras Bacsai cb0f5cc812 chore: prepare for PR 2026-02-23 12:19:57 +01:00
Andras Bacsai 73170fdd33 chore: prepare for PR 2026-02-23 12:12:10 +01:00
Aditya TripathiandGitHub 04283a03a0 Merge branch 'next' into feat/healthcheck-cmd 2026-02-21 06:54:29 +05:30
Andras Bacsai 664b31212f chore: prepare for PR 2026-02-18 15:42:42 +01:00
Andras BacsaiandGitHub 4a0426ef88 fix(push-server-job): skip containers with empty service subId (#8361) 2026-02-15 13:43:54 +01:00
Andras BacsaiandGitHub 6d9dbb4ba1 fix(jobs): handle queue timeouts gracefully in Horizon (#8360) 2026-02-15 13:43:23 +01:00
Andras Bacsai e9323e3550 chore: prepare for PR 2026-02-15 13:43:08 +01:00
Andras Bacsai a34d1656f4 chore: prepare for PR 2026-02-15 13:42:58 +01:00
Andras Bacsai 1b2c03fc2d chore: prepare for PR 2026-02-15 13:28:52 +01:00
Andras BacsaiandGitHub 5dde97dac2 Merge branch 'next' into 8035-public-port-stays-open 2026-02-09 10:00:06 +01:00
peaklabs-dev 7485b1829c fix(parser): replace dashes and dots in auto generated envs 2026-02-04 18:29:15 +01:00
Andras Bacsai fc229c4889 chore: prepare for PR 2026-02-03 15:32:03 +01:00
🏔️ PeakandGitHub 51301fd12e feat(notifications): add mattermost notifications (#7963) 2026-01-15 21:59:51 +01:00
🏔️ PeakandGitHub 650186b1ab fix(preview): docker compose preview URLs (#7959) 2026-01-15 14:03:10 +01:00
Aditya TripathiandGitHub 33d5879160 Merge branch 'next' into feat/healthcheck-cmd 2026-01-15 16:37:54 +05:30
peaklabs-dev aeb9f3c852 fix(env): only show nixpacks plan variables section in dev 2026-01-13 16:58:57 +01:00
peaklabs-dev 23b5a3e561 fix(env): only cat .env file in dev 2026-01-13 12:43:18 +01:00
Hendrik KleinwaechterandGitHub 2f5e879b73 feat: add application logs link to preview deployments PR comment (#7906) 2026-01-10 17:34:13 +01:00
peaklabs-dev 54a834e042 fix(git): trigger deployments when watch_paths is empty 2026-01-07 19:15:16 +01:00
Andras BacsaiandClaude Opus 4.5 81780d652f fix(deployment): use mainServer consistently instead of redundant original_server
Remove the redundant $original_server property and use $mainServer throughout
ApplicationDeploymentJob. Both properties held the same value (the deployment
target server), causing unnecessary duplication.

Also fixes two bugs in generate_compose_file() where $this->server was used
instead of $this->mainServer for isSwarm() and isLogDrainEnabled() checks.
When using a build server, $this->server could point to the build server,
causing incorrect configuration for the deployment target.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 11:56:08 +01:00
Andras Bacsai 162eaa9f0d feat(github): implement processing for GitHub pull request webhooks and add helper functions for commit and PR file retrieval 2026-01-05 11:13:18 +01:00
Andras BacsaiandGitHub dd7962885c fix: use original_server for log drain config in generate_compose_file (#7619) 2026-01-02 17:12:41 +01:00
Aditya Tripathi 342e8e765d feat: add command healthcheck type 2025-12-25 08:11:11 +00:00
Andras BacsaiandGitHub f77a2674fc feat: Add manual Stripe subscription sync command (#7706) 2025-12-19 09:35:52 +01:00
Andras BacsaiandClaude Haiku 4.5 e6ed3130b5 feat(stripe): Add manual subscription sync command with dry-run support
Add cloud:sync-stripe-subscriptions command to manually check all
subscriptions against Stripe. By default it only reports discrepancies
without making changes. Use --fix flag to actually apply corrections.

This addresses race conditions where subscriptions can be cancelled in
Stripe but remain marked as active in Coolify's database.

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

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-19 09:34:39 +01:00
Andras BacsaiandClaude Haiku 4.5 c6c9d5a591 fix(deployment): Skip docker rm -f for builder containers with --rm flag
Builder containers are started with the --rm flag, which automatically removes them when stopped. The explicit docker rm -f is redundant and adds unnecessary steps to deployment logs.

This change adds a skipRemove parameter to graceful_shutdown_container() and sets it to true for builder container shutdowns (uuid-based) while keeping the default behavior for application containers.

Fixes #7566

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

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-18 19:36:54 +01:00
Andras BacsaiandGitHub 21ce75e4d4 Revert "fix(deployment): Remove redundant docker rm when using --rm flag" 2025-12-18 13:20:59 +01:00
Andras BacsaiandClaude Haiku 4.5 6379123f93 fix(deployment): Remove redundant docker rm when using --rm flag
Helper containers are started with --rm flag which automatically removes the container when it stops. Removed redundant docker rm commands from graceful_shutdown_container in ApplicationDeploymentJob and replaced docker rm with docker stop in DatabaseBackupJob.

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-18 12:30:34 +01:00
Andras BacsaiandClaude Haiku 4.5 6d47d24169 Fix standalone database "restarting" status flickering and add restart tracking
- Fix status flickering: Track databases in active/transient states (restarting, starting, created, paused) not just running
- Add isActiveOrTransient() helper to distinguish between active states and terminal states (exited, dead)
- Add safeguard: Protect updateNotFoundDatabaseStatus() from marking as exited when containers collection is empty
- Add restart_count tracking: New migration adds restart_count, last_restart_at, last_restart_type to all standalone database tables
- Update 8 database models with $casts for new restart tracking fields
- Update GetContainersStatus to extract RestartCount from Docker and update database models
- Reset restart tracking when database exits completely

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

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-17 16:25:41 +01:00
Andras BacsaiandClaude Haiku 4.5 0efa4af5c3 Optimize PushServerUpdateJob performance with batch updates and async jobs
- Eager load service applications and databases to eliminate N+1 queries
- Replace individual model updates with batch database updates for applications, previews, and services
- Move connectProxyToNetworks to async ConnectProxyToNetworksJob to avoid blocking status updates
- Optimize Server.databases() and applications() methods with efficient database queries
- Use flatMap for cleaner collection transformations

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-15 14:06:32 +01:00
OZCAP 80d432171d fix: use original_server for log drain config in generate_compose_file
When build server is enabled, $this->server points to the build server.
The log drain configuration check was using $this->server which would
incorrectly check the build server's settings instead of the deployment
server where the container actually runs.

This fix ensures log drain configuration is correctly applied based on
the deployment server's settings by using $this->original_server.
2025-12-13 10:43:35 +04:00
Andras BacsaiandGitHub 4afc58cb53 perf: Remove dead server filtering code from Kernel scheduler (#7585) 2025-12-11 10:55:21 +01:00
Andras BacsaiandClaude 3962f1a5b9 perf: Remove dead server filtering code from Kernel scheduler
Remove unused server filtering logic in Kernel.php that was querying servers
but never using the results. Simplify Sentinel update checks in ServerManagerJob
by reusing the $isSentinelEnabled variable and removing unnecessary timezone
parameter for hourly cron execution.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-11 10:33:55 +01:00
Andras BacsaiandGitHub 07153de68d Fix deployment marked as failed after healthy container rolling update (#7583) 2025-12-11 10:01:00 +01:00