This commit is contained in:
Andras Bacsai
2023-06-15 10:48:13 +02:00
parent fe51f8fbf7
commit 8b6598ea6b
22 changed files with 380 additions and 231 deletions

View File

@@ -59,7 +59,7 @@ class General extends Component
$this->application->settings->is_force_https_enabled = $this->is_force_https_enabled;
$this->application->settings->save();
$this->application->refresh();
$this->emit('saved', 'Application settings updated!');
$this->emit('success', 'Application settings updated!');
$this->checkWildCardDomain();
}
protected function checkWildCardDomain()

View File

@@ -40,6 +40,6 @@ class Source extends Component
$this->application->git_commit_sha = 'HEAD';
}
$this->application->save();
$this->emit('saved', 'Application source updated!');
$this->emit('success', 'Application source updated!');
}
}

View File

@@ -157,6 +157,6 @@ class GithubPrivateRepository extends Component
$this->port = 3000;
$this->publish_directory = null;
}
$this->emit('saved', 'Application settings updated!');
$this->emit('success', 'Application settings updated!');
}
}

View File

@@ -56,7 +56,7 @@ class PublicGitRepository extends Component
$this->port = 3000;
$this->publish_directory = null;
}
$this->emit('saved', 'Application settings updated!');
$this->emit('success', 'Application settings updated!');
}
public function load_branches()
{

View File

@@ -39,7 +39,7 @@ class ByIp extends Component
}
public function instantSave()
{
$this->emit('saved', 'Application settings updated!');
$this->emit('success', 'Application settings updated!');
}
public function submit()
{

View File

@@ -37,7 +37,7 @@ class Configuration extends Component
$this->settings->is_auto_update_enabled = $this->is_auto_update_enabled;
$this->settings->is_registration_enabled = $this->is_registration_enabled;
$this->settings->save();
$this->emit('saved', 'Settings updated!');
$this->emit('success', 'Settings updated!');
}
private function setup_instance_fqdn()
{

View File

@@ -59,9 +59,9 @@ class InviteLink extends Component
]);
if ($isEmail) {
$user->first()->notify(new InvitationLinkEmail());
$this->emit('message', 'Invitation sent via email successfully.');
$this->emit('success', 'Invitation sent via email successfully.');
} else {
$this->emit('message', 'Invitation link generated.');
$this->emit('success', 'Invitation link generated.');
}
$this->emit('refreshInvitations');
} catch (\Throwable $e) {

View File

@@ -2,17 +2,19 @@
namespace App\Http\Livewire;
use Masmerise\Toaster\Toaster;
use App\Jobs\InstanceAutoUpdateJob;
use Livewire\Component;
class ForceUpgrade extends Component
class Upgrade extends Component
{
public bool $visible = false;
public bool $showProgress = false;
public function upgrade()
{
try {
$this->visible = true;
$this->showProgress = true;
dispatch(new InstanceAutoUpdateJob(force: true));
Toaster::success('Update started.');
} catch (\Exception $e) {
return general_error_handler(err: $e, that: $this);
}

View File

@@ -1,15 +0,0 @@
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class Upgrading extends Component
{
public bool $visible = false;
protected $listeners = ['updateInitiated'];
public function updateInitiated()
{
$this->visible = true;
}
}

View File

@@ -27,24 +27,6 @@ class InstanceAutoUpdateJob implements ShouldQueue, ShouldBeUnique
public function __construct(private bool $force = false)
{
}
private function update()
{
if (config('app.env') === 'local') {
ray('Running update on local docker container');
instant_remote_process([
"sleep 10"
], $this->server);
ray('Update done');
return;
} else {
ray('Running update on production server');
instant_remote_process([
"curl -fsSL https://cdn.coollabs.io/coolify/upgrade.sh -o /data/coolify/source/upgrade.sh",
"bash /data/coolify/source/upgrade.sh $this->latest_version"
], $this->server);
return;
}
}
public function handle(): void
{
try {
@@ -81,6 +63,25 @@ class InstanceAutoUpdateJob implements ShouldQueue, ShouldBeUnique
return;
}
}
private function update()
{
if (config('app.env') === 'local') {
ray('Running update on local docker container');
instant_remote_process([
"sleep 10"
], $this->server);
ray('Update done');
return;
} else {
ray('Running update on production server');
instant_remote_process([
"curl -fsSL https://cdn.coollabs.io/coolify/upgrade.sh -o /data/coolify/source/upgrade.sh",
"bash /data/coolify/source/upgrade.sh $this->latest_version"
], $this->server);
return;
}
}
public function failed(Exception $exception)
{
return;