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.

hmm

Andras Bacsaic81ec556db0c
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index 0760b404d5..e40d24a1a1 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -18,7 +18,7 @@ class Kernel extends ConsoleKernel
$schedule->command('horizon:snapshot')->everyFiveMinutes();
$schedule->job(new InstanceDockerCleanupJob)->everyFiveMinutes();
- // $schedule->job(new InstanceAutoUpdateJob)->everyFifteenMinutes();
+ $schedule->job(new InstanceAutoUpdateJob)->everyTenMinutes();
$schedule->job(new InstanceProxyCheckJob)->everyMinute();
}
diff --git a/app/Jobs/InstanceAutoUpdateJob.php b/app/Jobs/InstanceAutoUpdateJob.php
index e25fb76532..5cc11e20d6 100644
--- a/app/Jobs/InstanceAutoUpdateJob.php
+++ b/app/Jobs/InstanceAutoUpdateJob.php
@@ -16,10 +16,6 @@ class InstanceAutoUpdateJob implements ShouldQueue, ShouldBeUnique
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- private string $latest_version;
- private string $current_version;
- private Server $server;
- private string $localhost_name = 'localhost';
public $tries = 1;
public $timeout = 120;
public function uniqueId(): int
@@ -27,47 +23,43 @@ class InstanceAutoUpdateJob implements ShouldQueue, ShouldBeUnique
return 1;
}
public function __construct(private bool $force = false)
+ {
+ }
+
+ public function handle(): void
{
try {
+ $localhost_name = 'localhost';
if (config('app.env') === 'local') {
$localhost_name = 'testing-local-docker-container';
}
- $this->server = Server::where('name', $localhost_name)->firstOrFail();
- $this->latest_version = get_latest_version_of_coolify();
- $this->current_version = config('version');
+ $server = Server::where('name', $localhost_name)->firstOrFail();
+ $latest_version = get_latest_version_of_coolify();
+ $current_version = config('version');
- if (!$this->force) {
- $instance_settings = InstanceSettings::get();
- if (!$instance_settings->is_auto_update_enabled) {
- return $this->fail('Auto update is disabled');
- }
- $this->check_if_update_available();
- }
- } catch (\Exception $e) {
- $this->fail($e->getMessage());
- }
- }
- private function check_if_update_available()
- {
- if ($this->latest_version === $this->current_version) {
- $this->fail("Already on latest version");
- }
- if (version_compare($this->latest_version, $this->current_version, '<')) {
- $this->fail("Latest version is lower than current version?!");
- }
- }
- public function handle(): void
- {
- try {
if (config('app.env') === 'local') {
instant_remote_process([
"sleep 10"
- ], $this->server);
+ ], $server);
+ return;
} else {
+ if (!$this->force) {
+ $instance_settings = InstanceSettings::get();
+ if (!$instance_settings->is_auto_update_enabled) {
+ $this->fail('Auto update is disabled');
+ }
+ if ($latest_version === $current_version) {
+ $this->fail("Already on latest version");
+ }
+ if (version_compare($latest_version, $current_version, '<')) {
+ $this->fail("Latest version is lower than current version?!");
+ }
+ }
instant_remote_process([
"curl -fsSL https://coolify-cdn.b-cdn.net/files/upgrade.sh -o /data/coolify/source/upgrade.sh",
- "bash /data/coolify/source/upgrade.sh $this->latest_version"
- ], $this->server);
+ "bash /data/coolify/source/upgrade.sh $latest_version"
+ ], $server);
+ return;
}
} catch (\Exception $e) {
Log::error($e->getMessage());