fix update script
This commit is contained in:
parent
7ea73c3db2
commit
1d2b5d5b15
@ -7,21 +7,21 @@ use Illuminate\Http\Client\PendingRequest;
|
|||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Http\Client\Pool;
|
use Illuminate\Http\Client\Pool;
|
||||||
|
|
||||||
class SyncToBunnyCDN extends Command
|
class SyncBunny extends Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The name and signature of the console command.
|
* The name and signature of the console command.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'app:sync-to-bunny-cdn';
|
protected $signature = 'sync:bunny';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $description = 'Command description';
|
protected $description = 'Sync files to BunnyCDN';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
@ -67,10 +67,10 @@ class SyncToBunnyCDN extends Command
|
|||||||
"url" => "$bunny_cdn/$bunny_cdn_path/$production_env"
|
"url" => "$bunny_cdn/$bunny_cdn_path/$production_env"
|
||||||
]);
|
]);
|
||||||
if ($res->ok()) {
|
if ($res->ok()) {
|
||||||
echo 'All files uploaded & purged...';
|
echo "All files uploaded & purged...\n";
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
echo 'Something went wrong.';
|
echo "Something went wrong.\n";
|
||||||
echo $e->getMessage();
|
echo $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,9 +15,7 @@ class CheckUpdate extends Component
|
|||||||
|
|
||||||
public function checkUpdate()
|
public function checkUpdate()
|
||||||
{
|
{
|
||||||
$response = Http::get('https://get.coollabs.io/versions.json');
|
$this->latestVersion = getLatestVersionOfCoolify();
|
||||||
$versions = $response->json();
|
|
||||||
$this->latestVersion = data_get($versions, 'coolify.v4.version');
|
|
||||||
$this->currentVersion = config('coolify.version');
|
$this->currentVersion = config('coolify.version');
|
||||||
if ($this->latestVersion === 'latest') {
|
if ($this->latestVersion === 'latest') {
|
||||||
$this->updateAvailable = true;
|
$this->updateAvailable = true;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class ForceUpgrade extends Component
|
class ForceUpgrade extends Component
|
||||||
@ -22,6 +23,8 @@ class ForceUpgrade extends Component
|
|||||||
], $server);
|
], $server);
|
||||||
$this->emit('updateInitiated');
|
$this->emit('updateInitiated');
|
||||||
} else {
|
} else {
|
||||||
|
$latestVersion = getLatestVersionOfCoolify();
|
||||||
|
|
||||||
$cdn = "https://coolify-cdn.b-cdn.net/files";
|
$cdn = "https://coolify-cdn.b-cdn.net/files";
|
||||||
$server = Server::where('ip', 'host.docker.internal')->first();
|
$server = Server::where('ip', 'host.docker.internal')->first();
|
||||||
if (!$server) {
|
if (!$server) {
|
||||||
@ -39,7 +42,7 @@ class ForceUpgrade extends Component
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
remoteProcess([
|
remoteProcess([
|
||||||
"bash /data/coolify/source/upgrade.sh $this->latestVersion"
|
"bash /data/coolify/source/upgrade.sh $latestVersion"
|
||||||
], $server);
|
], $server);
|
||||||
|
|
||||||
$this->emit('updateInitiated');
|
$this->emit('updateInitiated');
|
||||||
|
@ -6,6 +6,7 @@ use App\Enums\ActivityTypes;
|
|||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Process;
|
use Illuminate\Support\Facades\Process;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
@ -133,3 +134,12 @@ if (!function_exists('runRemoteCommandSync')) {
|
|||||||
return $output;
|
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:"
|
echo "Tasks:"
|
||||||
compgen -A function | cat -n
|
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 {
|
function queue {
|
||||||
bash vendor/bin/spin exec -u webuser coolify php artisan queue:listen
|
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
|
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 {
|
function default {
|
||||||
help
|
help
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user