move autoupdate job to actions

This commit is contained in:
Andras Bacsai 2023-10-12 08:56:29 +02:00
parent a2f4d4ed6d
commit 5c27f43b3d
4 changed files with 5 additions and 7 deletions

View File

@ -2,16 +2,18 @@
namespace App\Actions\Server;
use Lorisleiva\Actions\Concerns\AsAction;
use App\Models\InstanceSettings;
use App\Models\Server;
class UpdateCoolify
{
use AsAction;
public ?Server $server = null;
public ?string $latestVersion = null;
public ?string $currentVersion = null;
public function __invoke(bool $force)
public function handle(bool $force)
{
try {
$settings = InstanceSettings::get();

View File

@ -37,7 +37,7 @@ public function upgrade()
return;
}
$this->showProgress = true;
resolve(UpdateCoolify::class)(true);
UpdateCoolify::run(true);
$this->emit('success', "Upgrading to {$this->latestVersion} version...");
} catch (\Throwable $e) {
return handleError($e, $this);

View File

@ -23,6 +23,6 @@ public function __construct(private bool $force = false)
public function handle(): void
{
resolve(UpdateCoolify::class)($this->force);
UpdateCoolify::run($this->force);
}
}

View File

@ -16,10 +16,6 @@ public function run(): void
'ip' => "coolify-testing-host",
'team_id' => 0,
'private_key_id' => 0,
// 'proxy' => ServerMetadata::from([
// 'type' => ProxyTypes::TRAEFIK_V2->value,
// 'status' => ProxyStatus::EXITED->value
// ]),
]);
}
}