Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor(jobs): pull github changelogs from cdn instead of github

Andras Bacsaid2ed68e60591
diff --git a/app/Console/Commands/Init.php b/app/Console/Commands/Init.php
index b858292560..8aefdad0e5 100644
--- a/app/Console/Commands/Init.php
+++ b/app/Console/Commands/Init.php
@@ -5,7 +5,7 @@ namespace App\Console\Commands;
use App\Enums\ActivityTypes;
use App\Enums\ApplicationDeploymentStatus;
use App\Jobs\CheckHelperImageJob;
-use App\Jobs\PullChangelogFromGitHub;
+use App\Jobs\PullChangelog;
use App\Models\ApplicationDeploymentQueue;
use App\Models\Environment;
use App\Models\ScheduledDatabaseBackup;
@@ -140,7 +140,7 @@ class Init extends Command
private function pullChangelogFromGitHub()
{
try {
- PullChangelogFromGitHub::dispatch();
+ PullChangelog::dispatch();
echo "Changelog fetch initiated\n";
} catch (\Throwable $e) {
echo "Could not fetch changelog from GitHub: {$e->getMessage()}\n";
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index c5c4d7e7f9..c2ea27274e 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -6,7 +6,7 @@ use App\Jobs\CheckAndStartSentinelJob;
use App\Jobs\CheckForUpdatesJob;
use App\Jobs\CheckHelperImageJob;
use App\Jobs\CleanupInstanceStuffsJob;
-use App\Jobs\PullChangelogFromGitHub;
+use App\Jobs\PullChangelog;
use App\Jobs\PullTemplatesFromCDN;
use App\Jobs\RegenerateSslCertJob;
use App\Jobs\ScheduledJobManager;
@@ -68,7 +68,7 @@ class Kernel extends ConsoleKernel
$this->scheduleInstance->command('cleanup:unreachable-servers')->daily()->onOneServer();
$this->scheduleInstance->job(new PullTemplatesFromCDN)->cron($this->updateCheckFrequency)->timezone($this->instanceTimezone)->onOneServer();
- $this->scheduleInstance->job(new PullChangelogFromGitHub)->cron($this->updateCheckFrequency)->timezone($this->instanceTimezone)->onOneServer();
+ $this->scheduleInstance->job(new PullChangelog)->cron($this->updateCheckFrequency)->timezone($this->instanceTimezone)->onOneServer();
$this->scheduleInstance->job(new CleanupInstanceStuffsJob)->everyTwoMinutes()->onOneServer();
$this->scheduleUpdates();
diff --git a/app/Jobs/PullChangelogFromGitHub.php b/app/Jobs/PullChangelog.php
similarity index 77%
rename from app/Jobs/PullChangelogFromGitHub.php
rename to app/Jobs/PullChangelog.php
index e84766f7f4..052e6d557f 100644
--- a/app/Jobs/PullChangelogFromGitHub.php
+++ b/app/Jobs/PullChangelog.php
@@ -11,8 +11,9 @@ use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Http;
+use Illuminate\Support\Facades\Log;
-class PullChangelogFromGitHub implements ShouldBeEncrypted, ShouldQueue
+class PullChangelog implements ShouldBeEncrypted, ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
@@ -26,21 +27,36 @@ class PullChangelogFromGitHub implements ShouldBeEncrypted, ShouldQueue
public function handle(): void
{
try {
+ // Fetch from CDN instead of GitHub API to avoid rate limits
+ $cdnUrl = config('constants.coolify.releases_url');
+
$response = Http::retry(3, 1000)
->timeout(30)
- ->get('https://api.github.com/repos/coollabsio/coolify/releases?per_page=10');
+ ->get($cdnUrl);
if ($response->successful()) {
$releases = $response->json();
+
+ // Limit to 10 releases for processing (same as before)
+ $releases = array_slice($releases, 0, 10);
+
$changelog = $this->transformReleasesToChangelog($releases);
// Group entries by month and save them
$this->saveChangelogEntries($changelog);
} else {
- send_internal_notification('PullChangelogFromGitHub failed with: '.$response->status().' '.$response->body());
+ // Log error instead of sending notification
+ Log::error('PullChangelogFromGitHub: Failed to fetch from CDN', [
+ 'status' => $response->status(),
+ 'url' => $cdnUrl,
+ ]);
}
} catch (\Throwable $e) {
- send_internal_notification('PullChangelogFromGitHub failed with: '.$e->getMessage());
+ // Log error instead of sending notification
+ Log::error('PullChangelogFromGitHub: Exception occurred', [
+ 'message' => $e->getMessage(),
+ 'trace' => $e->getTraceAsString(),
+ ]);
}
}
diff --git a/app/Livewire/SettingsDropdown.php b/app/Livewire/SettingsDropdown.php
index 314957462b..a94e8a1d70 100644
--- a/app/Livewire/SettingsDropdown.php
+++ b/app/Livewire/SettingsDropdown.php
@@ -2,7 +2,7 @@
namespace App\Livewire;
-use App\Jobs\PullChangelogFromGitHub;
+use App\Jobs\PullChangelog;
use App\Services\ChangelogService;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
@@ -50,7 +50,7 @@ class SettingsDropdown extends Component
}
try {
- PullChangelogFromGitHub::dispatch();
+ PullChangelog::dispatch();
$this->dispatch('success', 'Changelog fetch initiated! Check back in a few moments.');
} catch (\Throwable $e) {
$this->dispatch('error', 'Failed to fetch changelog: '.$e->getMessage());
diff --git a/config/constants.php b/config/constants.php
index 022886df2a..9c1b8b2746 100644
--- a/config/constants.php
+++ b/config/constants.php
@@ -12,6 +12,7 @@ return [
'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'),
'is_windows_docker_desktop' => env('IS_WINDOWS_DOCKER_DESKTOP', false),
+ 'releases_url' => 'https://cdn.coollabs.io/coolify/releases.json',
],
'urls' => [