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.

fix update script

Andras Bacsai1d2b5d5b1550
diff --git a/app/Console/Commands/SyncToBunnyCDN.php b/app/Console/Commands/SyncBunny.php
similarity index 91%
rename from app/Console/Commands/SyncToBunnyCDN.php
rename to app/Console/Commands/SyncBunny.php
index 2333a8d8c6..7757a7e6c5 100644
--- a/app/Console/Commands/SyncToBunnyCDN.php
+++ b/app/Console/Commands/SyncBunny.php
@@ -7,21 +7,21 @@ use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Http;
use Illuminate\Http\Client\Pool;
-class SyncToBunnyCDN extends Command
+class SyncBunny extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
- protected $signature = 'app:sync-to-bunny-cdn';
+ protected $signature = 'sync:bunny';
/**
* The console command description.
*
* @var string
*/
- protected $description = 'Command description';
+ protected $description = 'Sync files to BunnyCDN';
/**
* Execute the console command.
@@ -67,10 +67,10 @@ class SyncToBunnyCDN extends Command
"url" => "$bunny_cdn/$bunny_cdn_path/$production_env"
]);
if ($res->ok()) {
- echo 'All files uploaded & purged...';
+ echo "All files uploaded & purged...\n";
}
} catch (\Exception $e) {
- echo 'Something went wrong.';
+ echo "Something went wrong.\n";
echo $e->getMessage();
}
}
diff --git a/app/Http/Livewire/CheckUpdate.php b/app/Http/Livewire/CheckUpdate.php
index 9d56700de0..fac16e3e22 100644
--- a/app/Http/Livewire/CheckUpdate.php
+++ b/app/Http/Livewire/CheckUpdate.php
@@ -15,9 +15,7 @@ class CheckUpdate extends Component
public function checkUpdate()
{
- $response = Http::get('https://get.coollabs.io/versions.json');
- $versions = $response->json();
- $this->latestVersion = data_get($versions, 'coolify.v4.version');
+ $this->latestVersion = getLatestVersionOfCoolify();
$this->currentVersion = config('coolify.version');
if ($this->latestVersion === 'latest') {
$this->updateAvailable = true;
diff --git a/app/Http/Livewire/ForceUpgrade.php b/app/Http/Livewire/ForceUpgrade.php
index 0af7c690eb..ad6dd2ba49 100644
--- a/app/Http/Livewire/ForceUpgrade.php
+++ b/app/Http/Livewire/ForceUpgrade.php
@@ -3,6 +3,7 @@
namespace App\Http\Livewire;
use App\Models\Server;
+use Illuminate\Support\Facades\Http;
use Livewire\Component;
class ForceUpgrade extends Component
@@ -22,6 +23,8 @@ class ForceUpgrade extends Component
], $server);
$this->emit('updateInitiated');
} else {
+ $latestVersion = getLatestVersionOfCoolify();
+
$cdn = "https://coolify-cdn.b-cdn.net/files";
$server = Server::where('ip', 'host.docker.internal')->first();
if (!$server) {
@@ -39,7 +42,7 @@ class ForceUpgrade extends Component
]);
remoteProcess([
- "bash /data/coolify/source/upgrade.sh $this->latestVersion"
+ "bash /data/coolify/source/upgrade.sh $latestVersion"
], $server);
$this->emit('updateInitiated');
diff --git a/bootstrap/helpers.php b/bootstrap/helpers.php
index 46028e545a..8afc290e43 100644
--- a/bootstrap/helpers.php
+++ b/bootstrap/helpers.php
@@ -6,6 +6,7 @@ use App\Enums\ActivityTypes;
use App\Models\Server;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Process;
use Illuminate\Support\Facades\Storage;
@@ -133,3 +134,12 @@ if (!function_exists('runRemoteCommandSync')) {
return $output;
}
}
+
+if (!function_exists('getLatestVersionOfCoolify')) {
+ function getLatestVersionOfCoolify()
+ {
+ $response = Http::get('https://get.coollabs.io/versions.json');
+ $versions = $response->json();
+ return data_get($versions, 'coolify.v4.version');
+ }
+}
diff --git a/scripts/run b/scripts/run
index e0b42e0354..fca172e01d 100755
--- a/scripts/run
+++ b/scripts/run
@@ -20,6 +20,10 @@ function help {
echo "Tasks:"
compgen -A function | cat -n
}
+function sync-bunny {
+ bash vendor/bin/spin exec -u webuser coolify php artisan sync:bunny --env=secret ||
+ php artisan sync:bunny --env=secrets
+}
function queue {
bash vendor/bin/spin exec -u webuser coolify php artisan queue:listen
}
@@ -42,16 +46,6 @@ function vite {
bash vendor/bin/spin exec vite bash
}
-function build-prod {
- if [ "$1" ]; then
- echo "Building version $1"
- docker build -t ghcr.io/coollabsio/coolify:$1 -f docker/prod-ssu/Dockerfile .
- else
- echo "Building version 4.0.0-nightly.1"
- docker build -t ghcr.io/coollabsio/coolify:4.0.0-nightly.1 -f docker/prod-ssu/Dockerfile .
- fi
-}
-
function default {
help
}