coolify/config
Andras Bacsai 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
..
api.php refactor(core): rename API rate limit ENV 2025-06-18 15:23:44 +02:00
app.php refactor(configuration): centralize configuration management in ConfigurationRepository 2025-03-24 21:01:27 +01:00
auth.php better emails 2023-09-01 15:52:18 +02:00
broadcasting.php rename soketi container to realtime 2023-12-08 14:57:11 +01:00
cache.php Fix styling 2024-06-10 20:43:34 +00:00
chunk-upload.php feat(core): You can validate compose files with docker compose config 2025-02-27 11:29:04 +01:00
constants.php Fix: Prevent version downgrades and centralize CDN configuration (#7383) 2025-11-28 15:20:33 +01:00
cors.php init of v4 🌮 2023-03-17 15:33:48 +01:00
database.php fix(config): Update default PostgreSQL host to coolify-db instead of postgres 2025-02-27 11:56:51 +01:00
debugbar.php feat(core): You can validate compose files with docker compose config 2025-02-27 11:29:04 +01:00
filesystems.php Fix styling 2024-06-10 20:43:34 +00:00
fortify.php rate limit things 2023-08-15 14:27:45 +02:00
hashing.php init of v4 🌮 2023-03-17 15:33:48 +01:00
horizon.php feat(queues): improve Horizon config to reduce CPU and RAM usage (#6212) 2025-07-18 19:17:28 +02:00
livewire.php Disable legacy_model_binding flag in Livewire config 2025-10-13 15:44:23 +02:00
logging.php feat(jobs): improve scheduled tasks with retry logic and queue cleanup 2025-11-10 11:11:18 +01:00
mail.php fix(mail): Set default mailer to array when not specified 2025-02-27 12:56:44 +01:00
purify.php feat: Purify for better sanitization 2025-01-07 13:47:16 +01:00
queue.php Add dynamic timeout for deployments 2024-02-08 12:34:01 +01:00
ray.php chore: Enable Ray by default and update Dockerfile with latest versions of PACK and NIXPACKS 2024-09-06 10:21:02 +02:00
sanctum.php update packages 2024-07-10 13:10:21 +02:00
sentry.php use config instead of env() 2024-11-12 15:53:05 +01:00
services.php feat(user): add changelog read tracking and unread count method 2025-08-12 10:06:19 +02:00
session.php chore: switch to database sessions from redis 2024-06-12 09:56:13 +02:00
subscription.php remove unnecessary things 2024-11-11 10:23:03 +01:00
telescope.php add min process for horizon 2024-11-02 18:32:45 +01:00
testing.php Added a basic login test and also added 2 small variables to dev .env file 2024-09-06 14:16:40 +02:00
view.php init of v4 🌮 2023-03-17 15:33:48 +01:00