fix
This commit is contained in:
parent
b7dffc8594
commit
604f6832da
@ -21,13 +21,16 @@ class InstanceAutoUpdateJob implements ShouldQueue
|
||||
|
||||
public function __construct(private bool $force = false, Server|null $server = null)
|
||||
{
|
||||
Log::info("InstanceAutoUpdateJob");
|
||||
if (is_null($server)) {
|
||||
Log::info("InstanceAutoUpdateJob: server is null");
|
||||
if (config('app.env') === 'local') {
|
||||
$server_name = 'testing-local-docker-container';
|
||||
} else {
|
||||
$server_name = 'localhost';
|
||||
}
|
||||
$this->server = Server::where('name', $server_name)->first();
|
||||
Log::info("InstanceAutoUpdateJob: server is " . $this->server->name);
|
||||
} else {
|
||||
$this->server = $server;
|
||||
}
|
||||
@ -35,6 +38,9 @@ class InstanceAutoUpdateJob implements ShouldQueue
|
||||
|
||||
$this->latest_version = get_latest_version_of_coolify();
|
||||
$this->current_version = config('version');
|
||||
Log::info("InstanceAutoUpdateJob: latest version is " . $this->latest_version);
|
||||
Log::info("InstanceAutoUpdateJob: current version is " . $this->current_version);
|
||||
|
||||
if (!$this->force) {
|
||||
if (!$instance_settings->is_auto_update_enabled) {
|
||||
return $this->delete();
|
||||
@ -50,15 +56,18 @@ class InstanceAutoUpdateJob implements ShouldQueue
|
||||
private function check_if_update_available()
|
||||
{
|
||||
if ($this->latest_version === $this->current_version) {
|
||||
Log::info("InstanceAutoUpdateJob: Already on latest version");
|
||||
throw new \Exception("Already on latest version");
|
||||
}
|
||||
if (version_compare($this->latest_version, $this->current_version, '<')) {
|
||||
Log::info("InstanceAutoUpdateJob: Already on latest version");
|
||||
throw new \Exception("Already on latest version");
|
||||
}
|
||||
}
|
||||
public function handle(): void
|
||||
{
|
||||
try {
|
||||
Log::info('InstanceAutoUpdateJob: Starting update process');
|
||||
if (config('app.env') === 'local') {
|
||||
instant_remote_process([
|
||||
"sleep 2"
|
||||
@ -67,9 +76,11 @@ class InstanceAutoUpdateJob implements ShouldQueue
|
||||
"sleep 10"
|
||||
], $this->server);
|
||||
} else {
|
||||
Log::info('InstanceAutoUpdateJob: Downloading upgrade script');
|
||||
instant_remote_process([
|
||||
"curl -fsSL https://coolify-cdn.b-cdn.net/files/upgrade.sh -o /data/coolify/source/upgrade.sh",
|
||||
], $this->server);
|
||||
Log::info('InstanceAutoUpdateJob: Running upgrade script');
|
||||
remote_process([
|
||||
"bash /data/coolify/source/upgrade.sh $this->latest_version"
|
||||
], $this->server);
|
||||
|
Loading…
x
Reference in New Issue
Block a user