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