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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
improvement: only pull helper image if the version is newer than the one
Andras Bacsaid211362ab3e8
diff --git a/app/Jobs/PullHelperImageJob.php b/app/Jobs/PullHelperImageJob.phpindex 30a1b8026f..e1afec4b00 100644--- a/app/Jobs/PullHelperImageJob.php+++ b/app/Jobs/PullHelperImageJob.php@@ -2,6 +2,7 @@namespace App\Jobs;+use App\Models\InstanceSettings;use App\Models\Server;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldBeEncrypted;@@ -10,6 +11,8 @@ use Illuminate\Foundation\Bus\Dispatchable;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Queue\Middleware\WithoutOverlapping;use Illuminate\Queue\SerializesModels;+use Illuminate\Support\Facades\Http;+use Illuminate\Support\Facades\Log;class PullHelperImageJob implements ShouldBeEncrypted, ShouldQueue{@@ -32,10 +35,25 @@ class PullHelperImageJob implements ShouldBeEncrypted, ShouldQueuepublic function handle(): void{try {- $helperImage = config('coolify.helper_image');- ray("Pulling {$helperImage}");- instant_remote_process(["docker pull -q {$helperImage}"], $this->server, false);- ray('PullHelperImageJob done');+ $response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json');+ if ($response->successful()) {+ $versions = $response->json();+ $settings = InstanceSettings::get();+ $latest_version = data_get($versions, 'coolify.helper.version');+ $current_version = $settings->helper_version;+ Log::info('Latest version', $latest_version);+ Log::info('Current version', $current_version);+ if (version_compare($latest_version, $current_version, '>')) {+ // New version available+ Log::info('New version available', $latest_version);+ $helperImage = config('coolify.helper_image');+ // REMOVE -next+ instant_remote_process(["docker pull -q {$helperImage}:{$latest_version}-next"], $this->server);+ $settings->update(['helper_version' => $latest_version]);+ Log::info('Pulled helper image', $helperImage, $latest_version);+ }+ }+} catch (\Throwable $e) {send_internal_notification('PullHelperImageJob failed with: '.$e->getMessage());ray($e->getMessage());diff --git a/config/coolify.php b/config/coolify.phpindex a6d6d8581a..6e284fe9ec 100644--- a/config/coolify.php+++ b/config/coolify.php@@ -11,7 +11,7 @@ return ['dev_webhook' => env('SERVEO_URL'),'is_windows_docker_desktop' => env('IS_WINDOWS_DOCKER_DESKTOP', false),'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'),- 'helper_image' => env('HELPER_IMAGE', 'ghcr.io/coollabsio/coolify-helper:latest'),+ 'helper_image' => env('HELPER_IMAGE', 'ghcr.io/coollabsio/coolify-helper'),'is_horizon_enabled' => env('HORIZON_ENABLED', true),'is_scheduler_enabled' => env('SCHEDULER_ENABLED', true),];diff --git a/database/migrations/2024_09_05_085700_add_helper_version_to_instance_settings.php b/database/migrations/2024_09_05_085700_add_helper_version_to_instance_settings.phpnew file mode 100644index 0000000000..53ecce0f1d--- /dev/null+++ b/database/migrations/2024_09_05_085700_add_helper_version_to_instance_settings.php@@ -0,0 +1,28 @@+<?php++use Illuminate\Database\Migrations\Migration;+use Illuminate\Database\Schema\Blueprint;+use Illuminate\Support\Facades\Schema;++return new class extends Migration+{+ /**+ * Run the migrations.+ */+ public function up(): void+ {+ Schema::table('instance_settings', function (Blueprint $table) {+ $table->string('helper_version')->default('1.0.0');+ });+ }++ /**+ * Reverse the migrations.+ */+ public function down(): void+ {+ Schema::table('instance_settings', function (Blueprint $table) {+ $table->dropColumn('helper_version');+ });+ }+};diff --git a/other/nightly/versions.json b/other/nightly/versions.jsonindex 9ad8863086..7bb400bfd9 100644--- a/other/nightly/versions.json+++ b/other/nightly/versions.json@@ -1,10 +1,13 @@{"coolify": {"v4": {- "version": "4.0.0-beta.324"+ "version": "4.0.0-beta.330"},"nightly": {- "version": "4.0.0-beta.324"+ "version": "4.0.0-beta.331"+ },+ "helper": {+ "version": "1.0.0"}}-}\ No newline at end of file+}