This commit is contained in:
Andras Bacsai
2023-04-27 13:02:24 +02:00
parent 4d69094a1f
commit c0c9dacac6
2 changed files with 9 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ use Livewire\Component;
class CheckUpdate extends Component class CheckUpdate extends Component
{ {
public $updateAvailable = false; public $updateAvailable = false;
public $latestVersion = '4.0.0-nightly.1'; public $latestVersion = 'latest';
protected $currentVersion; protected $currentVersion;
protected $image = 'ghcr.io/coollabsio/coolify'; protected $image = 'ghcr.io/coollabsio/coolify';
@@ -20,7 +20,7 @@ class CheckUpdate extends Component
return; return;
} }
runRemoteCommandSync($server, ['curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/v4/scripts/upgrade.sh -o /data/coolify/source/upgrade.sh']); runRemoteCommandSync($server, ['curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/v4/scripts/upgrade.sh -o /data/coolify/source/upgrade.sh']);
runRemoteCommandSync($server, ['bash /data/coolify/source/upgrade.sh']); runRemoteCommandSync($server, ["bash /data/coolify/source/upgrade.sh $this->latestVersion"]);
} }
public function forceUpgrade() public function forceUpgrade()
{ {
@@ -30,8 +30,12 @@ class CheckUpdate extends Component
{ {
$response = Http::get('https://get.coollabs.io/versions.json'); $response = Http::get('https://get.coollabs.io/versions.json');
$versions = $response->json(); $versions = $response->json();
// $this->latestVersion = data_get($versions, 'coolify.main.version'); $this->latestVersion = data_get($versions, 'coolify.v4.version');
$this->currentVersion = config('coolify.version'); $this->currentVersion = config('coolify.version');
if ($this->latestVersion === 'latest') {
$this->updateAvailable = true;
return;
}
version_compare($this->currentVersion, $this->latestVersion, '<') ? $this->updateAvailable = true : $this->updateAvailable = false; version_compare($this->currentVersion, $this->latestVersion, '<') ? $this->updateAvailable = true : $this->updateAvailable = false;
} }
} }

View File

@@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
## Do not modify this file. You will lost the ability to autoupdate! ## Do not modify this file. You will lost the ability to autoupdate!
docker compose --env-file /data/coolify/source/.env -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml up --pull always export APP_TAG=$1
docker compose --env-file /data/coolify/source/.env -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml up -d --pull always --remove-orphans --force-recreate