diff --git a/app/Actions/Server/InstallDocker.php b/app/Actions/Server/InstallDocker.php new file mode 100644 index 000000000..55c1fcc4b --- /dev/null +++ b/app/Actions/Server/InstallDocker.php @@ -0,0 +1,24 @@ + /etc/docker/daemon.json", + "echo Restarting Docker...", + "systemctl restart docker" + ], $server, ActivityTypes::INLINE->value); + + return $activity; + } +} diff --git a/app/Http/Controllers/ServerController.php b/app/Http/Controllers/ServerController.php deleted file mode 100644 index b76acefa0..000000000 --- a/app/Http/Controllers/ServerController.php +++ /dev/null @@ -1,16 +0,0 @@ - $server, - ]); - } -} diff --git a/app/Http/Livewire/PrivateKey/Create.php b/app/Http/Livewire/PrivateKey/Create.php index ee73827ea..b888a2122 100644 --- a/app/Http/Livewire/PrivateKey/Create.php +++ b/app/Http/Livewire/PrivateKey/Create.php @@ -3,6 +3,8 @@ namespace App\Http\Livewire\PrivateKey; use App\Models\PrivateKey; +use Illuminate\Routing\Route as RoutingRoute; +use Illuminate\Support\Facades\Route; use Livewire\Component; class Create extends Component @@ -10,6 +12,12 @@ class Create extends Component public $private_key_value; public $private_key_name; public $private_key_description; + public string $currentRoute; + + public function mount() + { + $this->currentRoute = Route::current()->uri(); + } public function createPrivateKey() { $this->private_key_value = trim($this->private_key_value); @@ -23,6 +31,8 @@ class Create extends Component 'team_id' => session('currentTeam')->id ]); session('currentTeam')->privateKeys = PrivateKey::where('team_id', session('currentTeam')->id)->get(); - redirect()->route('private-key.show', $new_private_key->uuid); + if ($this->currentRoute !== 'server/new') { + redirect()->route('private-key.show', $new_private_key->uuid); + } } } diff --git a/app/Http/Livewire/Server/Form.php b/app/Http/Livewire/Server/Form.php index 1c01345bb..0cb6bf7f0 100644 --- a/app/Http/Livewire/Server/Form.php +++ b/app/Http/Livewire/Server/Form.php @@ -2,9 +2,8 @@ namespace App\Http\Livewire\Server; -use App\Enums\ActivityTypes; +use App\Actions\Server\InstallDocker; use App\Models\Server; -use Illuminate\Support\Facades\Validator; use Livewire\Component; class Form extends Component @@ -28,12 +27,9 @@ class Form extends Component } public function installDocker() { - $config = base64_encode('{ "live-restore": true }'); - remoteProcess([ - "curl https://releases.rancher.com/install-docker/23.0.sh | sh", - "echo '{$config}' | base64 -d > /etc/docker/daemon.json", - "systemctl restart docker" - ], $this->server, ActivityTypes::INLINE->value); + $activity = resolve(InstallDocker::class)($this->server); + + $this->emit('newMonitorActivity', $activity->id); } public function checkServer() { diff --git a/app/Jobs/DeployApplicationJob.php b/app/Jobs/DeployApplicationJob.php index 5eb1f5f75..471457254 100644 --- a/app/Jobs/DeployApplicationJob.php +++ b/app/Jobs/DeployApplicationJob.php @@ -37,7 +37,7 @@ class DeployApplicationJob implements ShouldQueue protected string $workdir; protected string $docker_compose; public static int $batch_counter = 0; - + public $timeout = 3600; /** * Create a new job instance. */ diff --git a/resources/views/livewire/activity-monitor.blade.php b/resources/views/livewire/activity-monitor.blade.php index 7c46bc9d3..33a55da53 100644 --- a/resources/views/livewire/activity-monitor.blade.php +++ b/resources/views/livewire/activity-monitor.blade.php @@ -1,4 +1,4 @@ -
Docker Compose: {{ $dockerComposeVersion }}
@endisset -