coolify/config/constants.php

125 lines
4.4 KiB
PHP
Raw Normal View History

2023-06-12 10:00:01 +00:00
<?php
2024-06-10 20:43:34 +00:00
2023-06-12 10:00:01 +00:00
return [
2024-11-12 14:19:06 +00:00
'coolify' => [
2026-03-12 12:26:59 +00:00
'version' => '4.0.0-beta.468',
'helper_version' => '1.0.12',
'realtime_version' => '1.0.11',
2024-11-12 14:19:06 +00:00
'self_hosted' => env('SELF_HOSTED', true),
2024-11-15 20:06:57 +00:00
'autoupdate' => env('AUTOUPDATE'),
2024-11-12 14:19:06 +00:00
'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'),
'registry_url' => env('REGISTRY_URL', 'ghcr.io'),
'helper_image' => env('HELPER_IMAGE', env('REGISTRY_URL', 'ghcr.io').'/coollabsio/coolify-helper'),
'realtime_image' => env('REALTIME_IMAGE', env('REGISTRY_URL', 'ghcr.io').'/coollabsio/coolify-realtime'),
2024-11-12 14:19:06 +00:00
'is_windows_docker_desktop' => env('IS_WINDOWS_DOCKER_DESKTOP', false),
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 14:20:13 +00:00
'cdn_url' => env('CDN_URL', 'https://cdn.coollabs.io'),
'versions_url' => env('VERSIONS_URL', env('CDN_URL', 'https://cdn.coollabs.io').'/coolify/versions.json'),
'upgrade_script_url' => env('UPGRADE_SCRIPT_URL', env('CDN_URL', 'https://cdn.coollabs.io').'/coolify/upgrade.sh'),
'releases_url' => 'https://cdn.coolify.io/releases.json',
2024-11-12 14:19:06 +00:00
],
'urls' => [
'docs' => 'https://coolify.io/docs',
2023-09-28 09:01:00 +00:00
'contact' => 'https://coolify.io/docs/contact',
],
2024-11-12 14:19:06 +00:00
'services' => [
// Temporary disabled until cache is implemented
// 'official' => 'https://cdn.coollabs.io/coolify/service-templates.json',
'official' => 'https://raw.githubusercontent.com/coollabsio/coolify/v4.x/templates/service-templates-latest.json',
'file_name' => 'service-templates-latest.json',
2024-11-12 14:19:06 +00:00
],
'terminal' => [
'protocol' => env('TERMINAL_PROTOCOL'),
'host' => env('TERMINAL_HOST'),
'port' => env('TERMINAL_PORT'),
],
'pusher' => [
'host' => env('PUSHER_HOST'),
2024-11-12 14:53:05 +00:00
'port' => env('PUSHER_PORT'),
2024-11-12 14:19:06 +00:00
'app_key' => env('PUSHER_APP_KEY'),
],
2024-12-11 16:01:06 +00:00
'migration' => [
'is_migration_enabled' => env('MIGRATION_ENABLED', true),
],
'seeder' => [
'is_seeder_enabled' => env('SEEDER_ENABLED', true),
],
2024-11-12 14:19:06 +00:00
'horizon' => [
'is_horizon_enabled' => env('HORIZON_ENABLED', true),
'is_scheduler_enabled' => env('SCHEDULER_ENABLED', true),
],
'docker' => [
'minimum_required_version' => '24.0',
2024-11-12 14:19:06 +00:00
],
2023-09-28 09:01:00 +00:00
'ssh' => [
2024-09-17 13:54:22 +00:00
'mux_enabled' => env('MUX_ENABLED', env('SSH_MUX_ENABLED', true)),
'mux_persist_time' => env('SSH_MUX_PERSIST_TIME', 3600),
'mux_health_check_enabled' => env('SSH_MUX_HEALTH_CHECK_ENABLED', true),
'mux_health_check_timeout' => env('SSH_MUX_HEALTH_CHECK_TIMEOUT', 5),
'mux_max_age' => env('SSH_MUX_MAX_AGE', 1800), // 30 minutes
2023-09-13 11:00:16 +00:00
'connection_timeout' => 10,
'server_interval' => 20,
'command_timeout' => 3600,
'max_retries' => env('SSH_MAX_RETRIES', 3),
'retry_base_delay' => env('SSH_RETRY_BASE_DELAY', 2), // seconds
'retry_max_delay' => env('SSH_RETRY_MAX_DELAY', 30), // seconds
'retry_multiplier' => env('SSH_RETRY_MULTIPLIER', 2),
2023-09-13 11:00:16 +00:00
],
2024-11-12 14:19:06 +00:00
2023-06-12 10:00:01 +00:00
'invitation' => [
'link' => [
'base_url' => '/invitations/',
2024-11-08 09:52:24 +00:00
'expiration_days' => 3,
2023-06-12 10:00:01 +00:00
],
],
2024-11-12 14:19:06 +00:00
'email_change' => [
'verification_code_expiry_minutes' => 10,
],
2024-11-12 14:53:05 +00:00
'sentry' => [
'sentry_dsn' => env('SENTRY_DSN'),
],
'webhooks' => [
'feedback_discord_webhook' => env('FEEDBACK_DISCORD_WEBHOOK'),
'dev_webhook' => env('SERVEO_URL'),
],
'bunny' => [
'storage_api_key' => env('BUNNY_STORAGE_API_KEY'),
'api_key' => env('BUNNY_API_KEY'),
],
'server_checks' => [
// Notification delay configuration for parallel server checks
// Used for Traefik version checks and other future server check jobs
// These settings control how long to wait before sending notifications
// after dispatching parallel check jobs for all servers
// Minimum delay in seconds (120s = 2 minutes)
// Accounts for job processing time, retries, and network latency
'notification_delay_min' => 120,
// Maximum delay in seconds (300s = 5 minutes)
// Prevents excessive waiting for very large server counts
'notification_delay_max' => 300,
// Scaling factor: seconds to add per server (0.2)
// Formula: delay = min(max, max(min, serverCount * scaling))
// Examples:
// - 100 servers: 120s (uses minimum)
// - 1000 servers: 200s
// - 2000 servers: 300s (hits maximum)
'notification_delay_scaling' => 0.2,
],
2023-06-12 10:00:01 +00:00
];