Commit Graph
62 Commits
Author SHA1 Message Date
Andras BacsaiandClaude Opus 5.5 dbc3fb91bf fix(cdn): fetch versions.json once per hour, spread evenly across instances
- Retry CDN requests only for transient errors and honor Retry-After
  (Cloudflare error 1200 sends 60 s), with jitter.
- Read helper and Sentinel versions from the local versions.json, which
  the hourly update check refreshes, instead of fetching per job/server.
- Replace the random 0-600 s delay with a stable per-instance offset
  inside the cron interval (max 1 h).
- Manual update checks and upgrades make one CDN attempt only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 18:10:48 +02:00
Andras Bacsai 83384a7b95 Merge remote-tracking branch 'origin/release/v4.5' into automation/sync-main-to-release-v4.5 2026-10-12 22:30:41 +02:00
Andras Bacsai 200af07225 Merge remote-tracking branch 'origin/release/v4.5' into automation/sync-main-to-release-v4.5 2026-10-12 21:38:45 +02:00
🏔️ Peak 856735613d feat(backups): back up the coolify database before an update (#12093) 2026-10-12 00:59:14 +02:00
Andras Bacsai 5246427b03 fix(upgrade): remove disk space checks that block Coolify updates 2026-10-09 20:03:49 +02:00
Andras BacsaiandClaude Opus 5.5 376e7aab24 feat(upgrade): block upgrades when the disk is almost full
An upgrade pulls new images and recreates the Coolify containers. A full
disk during an upgrade can leave Coolify broken.

- Measure free space on the Docker root dir and /data/coolify of localhost;
  require 5 GB. An unknown value does not block.
- Manual upgrade: show the free and required space, with Run Docker cleanup,
  Check again, and a confirmed Upgrade anyway override.
- Automatic upgrade: skip it and notify the team (disk usage channels, at
  most once per 24 hours per server).
- upgrade.sh: stop before any change when the disk is low. A new 5th
  argument skips the check (used by the override).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 13:26:53 +02:00
Andras Bacsai df953bdcd1 fix(upgrade): prevent duplicate upgrades and stalled progress polling
Block new upgrades while a recent upgrade is running, allowing retries after 15 minutes without a status update.

Add request timeouts and polling guards to keep upgrade progress responsive during restarts.
2026-10-09 08:01:20 +02:00
Andras Bacsai cf6f5a2678 feat(registry): add configurable docker registry url (#9017) 2026-07-02 18:52:46 +02:00
Andras BacsaiandClaude Opus 4.5 6a9027dcbf Add human-friendly output to upgrade script
- Show clear progress with numbered steps (1/6 through 6/6)
- Display header and footer banners
- Show individual image pull progress
- Show which containers are being stopped
- Display final success message with version and log location
- Keep detailed logging to file for debugging

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 15:18:57 +01:00
Andras BacsaiandClaude cd10796612 Fix: Version downgrade prevention - validate cache and add running version checks
## Changes
- **CheckForUpdatesJob**: Add triple version comparison (CDN vs cache vs running)
  - Never allows version downgrade from currently running version
  - Uses data_set() for safer nested array mutation
  - Prevents incorrect new_version_available flag setting

- **UpdateCoolify**: Add cache validation before fallback
  - Validates cache against running version on CDN failure
  - Throws exception if cache is corrupted/older than running
  - Applies to both manual and automated updates

- **Tests**: Add comprehensive test coverage
  - tests/Unit/CheckForUpdatesJobTest.php (5 tests)
  - tests/Unit/UpdateCoolifyTest.php (3 tests)

## Impact
- Prevents all downgrade scenarios (CDN rollback, corrupted cache, etc.)
- Maintains backward compatibility
- Provides clear logging for debugging

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 16:05:41 +01:00
Andras BacsaiandClaude d9774d2968 Fix: Prevent version downgrades and centralize CDN configuration (#7383)
## Root Cause
Between Nov 25-26, a CDN redirect was added without curl's `-L` flag,
causing version cache corruption and automatic downgrades.

## Three Critical Bugs Fixed

### Bug #1: CheckForUpdatesJob could overwrite newer cached version
- Problem: CDN serving older version would overwrite local cache
- Solution: Smart version merge - keep max Coolify version, update other components
- Location: app/Jobs/CheckForUpdatesJob.php:33-52

### Bug #2: Manual updates bypassed downgrade protection
- Problem: Downgrade guard only applied to auto-updates
- Solution: Always block downgrades for both manual and auto-updates
- Location: app/Actions/Server/UpdateCoolify.php:65-75

### Bug #3: Updates used stale local cache
- Problem: Never validated cache against CDN at update time
- Solution: Fetch fresh CDN data before executing updates
- Location: app/Actions/Server/UpdateCoolify.php:34-49

## Additional Improvement: Centralized CDN Configuration

Added three new config keys for easy CDN management:
- `cdn_url` - Base CDN URL (default: https://cdn.coollabs.io)
- `versions_url` - Full versions.json URL
- `upgrade_script_url` - Full upgrade.sh URL

All configurable via environment variables:
```bash
CDN_URL=https://cdn.coolify.io
VERSIONS_URL=https://custom-cdn.example.com/versions.json
UPGRADE_SCRIPT_URL=https://custom-cdn.example.com/upgrade.sh
```

## Files Modified
- config/constants.php - CDN configuration
- app/Jobs/CheckForUpdatesJob.php - Smart version merge + centralized URL
- app/Actions/Server/UpdateCoolify.php - Downgrade protection + fresh fetch + centralized URLs
- app/Jobs/CheckHelperImageJob.php - Centralized URL
- bootstrap/helpers/shared.php - Centralized URL

## Testing
- ✅ All modified files pass Pint formatting
- ✅ 78 unit tests pass (2 pre-existing failures unrelated to changes)

## Impact
- No breaking changes - defaults to current CDN
- Easy CDN migration via environment variables
- Prevents all downgrade scenarios
- Maintains independent Sentinel/Helper/Traefik updates

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:20:33 +01:00
Andras Bacsai 318cd18dde fix: remove PullHelperImageJob and mass server scheduling
Stop dispatching PullHelperImageJob to thousands of servers when the helper image version changes. Instead, rely on Docker's automatic image pulling during actual deployments and backups. Inline the helper image pull in UpdateCoolify for the single use case.

This eliminates queue flooding on cloud instances while maintaining all functionality through Docker's built-in image management.
2025-11-14 11:31:08 +01:00
🏔️ Peak 2a526c54d5 fix(docker): volumes get delete when stopping a service if Delete Unused Volumes is activated (#6317) 2025-08-04 21:15:56 +02:00
Andras Bacsai 3f9fd1404b refactor(docker): update image references to use centralized registry URL 2025-03-25 08:17:13 +01:00
Andras Bacsai 1fe4dd722b Revert "rector: arrrrr"
This reverts commit 16c0cd10d8.
2025-01-07 15:31:43 +01:00
Andras Bacsai 16c0cd10d8 rector: arrrrr 2025-01-07 14:52:08 +01:00
Andras Bacsai 37d4d5f98c fix: version should come from constants + fix stripe webhook error reporting 2024-11-25 11:28:08 +01:00
Andras Bacsai 7dc65dfd79 fix: make sure important jobs/actions are running on high prio queue 2024-11-22 11:16:01 +01:00
Andras Bacsai 47e9e69ce0 fixes 2024-11-10 22:07:41 +01:00
Andras Bacsai 60de7dc711 fix: upgrade.sh 2024-11-10 21:44:34 +01:00
Andras Bacsai 704e25100a fix: manual update should be executed only once + better UX 2024-11-10 21:26:52 +01:00
Lucas Michot 5b6e466e0c Remove some useless catch blocks 2024-10-28 14:37:00 +01:00
Andras Bacsai 83549965ca Refactor instanceSettings() function for improved code readability 2024-10-01 10:37:40 +02:00
Vahor 0739e0f5e7 trigger pull helper image job when upgrading coolify 2024-09-15 14:23:57 +02:00
Andras Bacsai 4888f4c405 refactor: upgrade process of Coolify 2024-09-05 10:15:22 +02:00
Vahor 02f950edc7 fix: pull coolify image only when the app needs to be updated 2024-09-04 19:38:13 +02:00
Andras Bacsai 3f9f197282 fix: docker cleanup job 2024-08-21 10:50:05 +02:00
Andras Bacsai e2726d9dfb fix: manual update process 2024-08-08 13:32:15 +02:00
ayntk-ai 38976dac12 fixes and check for valid cron expressions 2024-08-05 20:05:38 +02:00
Andras Bacsai a849c25672 improve: update process 2024-06-25 12:48:56 +02:00
Thijmen d86274cc37 Fix styling 2024-06-10 20:43:34 +00:00
Andras Bacsai 294721eef9 fix: autoupdate process 2024-06-04 21:57:00 +02:00
Andras Bacsai e3e938c8eb refactor: Remove unnecessary logging statements from UpdateCoolify 2024-05-30 20:32:07 +02:00
Andras Bacsai 46a500f5e5 async update process 2024-05-30 20:02:11 +02:00
Andras Bacsai cd58e0d01e fixes 2024-05-30 19:45:36 +02:00
Andras Bacsai 30a9783348 feat: Add manual update option to UpdateCoolify handle method 2024-05-30 19:38:33 +02:00
Andras Bacsai c839cf50af fix: spamming :D 2024-05-30 19:35:44 +02:00
Andras Bacsai 622095ebc4 fix: throw exception 2024-05-28 15:11:25 +02:00
Andras Bacsai 397b7fefe3 fix: test new upgrade process? 2024-05-28 15:05:18 +02:00
Andras Bacsai 70a4b7c863 feat: new manual update process + remove next_channel 2024-05-17 09:52:19 +02:00
Andras Bacsai 4ae4e88800 Update instance update process 2024-04-08 13:04:38 +02:00
Andras Bacsai 43fed96af1 fix: autoupdater 2024-03-27 11:35:57 +01:00
Andras Bacsai fb3991321a Update Coolify version and Sentry configuration 2024-02-14 08:53:13 +01:00
Andras Bacsai 79e0df1d43 fix: cleanup docker stuffs before upgrading 2024-01-12 08:45:24 +01:00
Andras Bacsai 4ea8916d53 fix: update Coolify script 2023-12-13 11:55:08 +01:00
Andras Bacsai 5c27f43b3d move autoupdate job to actions 2023-10-12 08:56:29 +02:00
Andras Bacsai 3749970831 fix: update process if server has been renamed 2023-09-29 09:48:20 +02:00
Andras Bacsai 64a65e2018 fix: errors 2023-09-11 17:36:30 +02:00
Andras Bacsai 8e86ce671c fix: dockerimage jobs are not overlapping 2023-09-01 10:11:00 +02:00
Andras Bacsai f48a912287 update cloud no localhost server 2023-08-28 18:02:31 +02:00