fix update script
This commit is contained in:
parent
7ea73c3db2
commit
1d2b5d5b15
@ -7,21 +7,21 @@
|
||||
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 @@ public function handle()
|
||||
"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();
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
@ -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 @@ public function upgrade()
|
||||
], $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 @@ public function upgrade()
|
||||
]);
|
||||
|
||||
remoteProcess([
|
||||
"bash /data/coolify/source/upgrade.sh $this->latestVersion"
|
||||
"bash /data/coolify/source/upgrade.sh $latestVersion"
|
||||
], $server);
|
||||
|
||||
$this->emit('updateInitiated');
|
||||
|
@ -6,6 +6,7 @@
|
||||
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 @@ function runRemoteCommandSync($server, array $command)
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
14
scripts/run
14
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user