fix: boarding again
This commit is contained in:
parent
af57b2aa73
commit
9cba0a6df3
@ -7,7 +7,7 @@ use App\Models\StandaloneDocker;
|
|||||||
|
|
||||||
class InstallDocker
|
class InstallDocker
|
||||||
{
|
{
|
||||||
public function __invoke(Server $server, bool $instant = false)
|
public function __invoke(Server $server)
|
||||||
{
|
{
|
||||||
$dockerVersion = '24.0';
|
$dockerVersion = '24.0';
|
||||||
$config = base64_encode('{
|
$config = base64_encode('{
|
||||||
@ -55,9 +55,6 @@ class InstallDocker
|
|||||||
"echo '####### Done!'"
|
"echo '####### Done!'"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if ($instant) {
|
|
||||||
return instant_remote_process($command, $server);
|
|
||||||
}
|
|
||||||
return remote_process($command, $server);
|
return remote_process($command, $server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,11 @@ class CoolifyTaskArgs extends Data
|
|||||||
public string $type,
|
public string $type,
|
||||||
public ?string $type_uuid = null,
|
public ?string $type_uuid = null,
|
||||||
public ?Model $model = null,
|
public ?Model $model = null,
|
||||||
public string $status = ProcessStatus::QUEUED->value,
|
public ?string $status = null ,
|
||||||
public bool $ignore_errors = false,
|
public bool $ignore_errors = false,
|
||||||
) {
|
) {
|
||||||
|
if(is_null($status)){
|
||||||
|
$this->status = ProcessStatus::QUEUED->value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ use App\Models\Server;
|
|||||||
use App\Models\Team;
|
use App\Models\Team;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Visus\Cuid2\Cuid2;
|
|
||||||
|
|
||||||
class Index extends Component
|
class Index extends Component
|
||||||
{
|
{
|
||||||
@ -40,8 +39,8 @@ class Index extends Component
|
|||||||
|
|
||||||
public bool $dockerInstallationStarted = false;
|
public bool $dockerInstallationStarted = false;
|
||||||
|
|
||||||
public string $localhostPublicKey;
|
public string $serverPublicKey;
|
||||||
public bool $localhostReachable = true;
|
public bool $serverReachable = true;
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
@ -98,7 +97,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
if (!$this->createdServer) {
|
if (!$this->createdServer) {
|
||||||
return $this->emit('error', 'Localhost server is not found. Something went wrong during installation. Please try to reinstall or contact support.');
|
return $this->emit('error', 'Localhost server is not found. Something went wrong during installation. Please try to reinstall or contact support.');
|
||||||
}
|
}
|
||||||
$this->localhostPublicKey = $this->createdServer->privateKey->publicKey();
|
$this->serverPublicKey = $this->createdServer->privateKey->publicKey();
|
||||||
return $this->validateServer('localhost');
|
return $this->validateServer('localhost');
|
||||||
} elseif ($this->selectedServerType === 'remote') {
|
} elseif ($this->selectedServerType === 'remote') {
|
||||||
$this->privateKeys = PrivateKey::ownedByCurrentTeam(['name'])->where('id', '!=', 0)->get();
|
$this->privateKeys = PrivateKey::ownedByCurrentTeam(['name'])->where('id', '!=', 0)->get();
|
||||||
@ -123,6 +122,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->selectedExistingPrivateKey = $this->createdServer->privateKey->id;
|
$this->selectedExistingPrivateKey = $this->createdServer->privateKey->id;
|
||||||
|
$this->serverPublicKey = $this->createdServer->privateKey->publicKey();
|
||||||
$this->validateServer();
|
$this->validateServer();
|
||||||
}
|
}
|
||||||
public function getProxyType()
|
public function getProxyType()
|
||||||
@ -201,11 +201,11 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
|
|
||||||
instant_remote_process(['uptime'], $this->createdServer, true);
|
instant_remote_process(['uptime'], $this->createdServer, true);
|
||||||
|
|
||||||
$this->createdServer->settings->update([
|
$this->createdServer->settings()->update([
|
||||||
'is_reachable' => true,
|
'is_reachable' => true,
|
||||||
]);
|
]);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->localhostReachable = false;
|
$this->serverReachable = false;
|
||||||
return handleError(error: $e, customErrorMessage: $customErrorMessage, livewire: $this);
|
return handleError(error: $e, customErrorMessage: $customErrorMessage, livewire: $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,8 +216,12 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
$this->currentState = 'install-docker';
|
$this->currentState = 'install-docker';
|
||||||
throw new \Exception('Docker version is not supported or not installed.');
|
throw new \Exception('Docker version is not supported or not installed.');
|
||||||
}
|
}
|
||||||
$this->dockerInstalledOrSkipped();
|
$this->createdServer->settings()->update([
|
||||||
|
'is_usable' => true,
|
||||||
|
]);
|
||||||
|
$this->getProxyType();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
$this->dockerInstallationStarted = false;
|
||||||
return handleError(error: $e, customErrorMessage: $customErrorMessage, livewire: $this);
|
return handleError(error: $e, customErrorMessage: $customErrorMessage, livewire: $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,10 +233,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
|||||||
}
|
}
|
||||||
public function dockerInstalledOrSkipped()
|
public function dockerInstalledOrSkipped()
|
||||||
{
|
{
|
||||||
$this->createdServer->settings->update([
|
$this->validateServer();
|
||||||
'is_usable' => true,
|
|
||||||
]);
|
|
||||||
$this->getProxyType();
|
|
||||||
}
|
}
|
||||||
public function selectProxy(string|null $proxyType = null)
|
public function selectProxy(string|null $proxyType = null)
|
||||||
{
|
{
|
||||||
|
@ -18,12 +18,14 @@ use Spatie\Activitylog\Contracts\Activity;
|
|||||||
function remote_process(
|
function remote_process(
|
||||||
array $command,
|
array $command,
|
||||||
Server $server,
|
Server $server,
|
||||||
string $type = ActivityTypes::INLINE->value,
|
?string $type = null,
|
||||||
?string $type_uuid = null,
|
?string $type_uuid = null,
|
||||||
?Model $model = null,
|
?Model $model = null,
|
||||||
bool $ignore_errors = false,
|
bool $ignore_errors = false,
|
||||||
): Activity {
|
): Activity {
|
||||||
|
if (is_null($type)) {
|
||||||
|
$type = ActivityTypes::INLINE->value;
|
||||||
|
}
|
||||||
$command_string = implode("\n", $command);
|
$command_string = implode("\n", $command);
|
||||||
if (auth()->user()) {
|
if (auth()->user()) {
|
||||||
$teams = auth()->user()->teams->pluck('id');
|
$teams = auth()->user()->teams->pluck('id');
|
||||||
|
@ -138,5 +138,6 @@ function allowedPathsForBoardingAccounts()
|
|||||||
...allowedPathsForUnsubscribedAccounts(),
|
...allowedPathsForUnsubscribedAccounts(),
|
||||||
'boarding',
|
'boarding',
|
||||||
'livewire/message/boarding.index',
|
'livewire/message/boarding.index',
|
||||||
|
'livewire/message/activity-monitor'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
@extends('layouts.base')
|
@extends('layouts.base')
|
||||||
@section('body')
|
@section('body')
|
||||||
|
<x-modal noSubmit modalId="installDocker">
|
||||||
|
<x-slot:modalBody>
|
||||||
|
<livewire:activity-monitor header="Docker Installation Logs" />
|
||||||
|
</x-slot:modalBody>
|
||||||
|
<x-slot:modalSubmit>
|
||||||
|
<x-forms.button onclick="installDocker.close()" type="submit">
|
||||||
|
Close
|
||||||
|
</x-forms.button>
|
||||||
|
</x-slot:modalSubmit>
|
||||||
|
</x-modal>
|
||||||
<main class="min-h-screen hero">
|
<main class="min-h-screen hero">
|
||||||
<div class="hero-content">
|
<div class="hero-content">
|
||||||
<x-modal modalId="installDocker">
|
|
||||||
<x-slot:modalBody>
|
|
||||||
<livewire:activity-monitor header="Docker Installation Logs" />
|
|
||||||
</x-slot:modalBody>
|
|
||||||
<x-slot:modalSubmit>
|
|
||||||
<x-forms.button onclick="installDocker.close()" type="submit">
|
|
||||||
Close
|
|
||||||
</x-forms.button>
|
|
||||||
</x-slot:modalSubmit>
|
|
||||||
</x-modal>
|
|
||||||
{{ $slot }}
|
{{ $slot }}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
@ -50,13 +50,13 @@
|
|||||||
<x-forms.button class="justify-center box" wire:target="setServerType('remote')"
|
<x-forms.button class="justify-center box" wire:target="setServerType('remote')"
|
||||||
wire:click="setServerType('remote')">Remote Server
|
wire:click="setServerType('remote')">Remote Server
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
@if (!$localhostReachable)
|
@if (!$serverReachable)
|
||||||
Localhost is not reachable with the following public key.
|
Localhost is not reachable with the following public key.
|
||||||
<br /> <br />
|
<br /> <br />
|
||||||
Please make sure you have the correct public key in your ~/.ssh/authorized_keys file for user
|
Please make sure you have the correct public key in your ~/.ssh/authorized_keys file for user
|
||||||
'root' or skip the boarding process and add a new private key manually to Coolify and to the
|
'root' or skip the boarding process and add a new private key manually to Coolify and to the
|
||||||
server.
|
server.
|
||||||
<x-forms.input readonly id="localhostPublicKey"></x-forms.input>
|
<x-forms.input readonly id="serverPublicKey"></x-forms.input>
|
||||||
<x-forms.button class="box" wire:target="setServerType('localhost')"
|
<x-forms.button class="box" wire:target="setServerType('localhost')"
|
||||||
wire:click="setServerType('localhost')">Check again
|
wire:click="setServerType('localhost')">Check again
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
@ -130,6 +130,17 @@
|
|||||||
<x-forms.button type="submit">Use this Server</x-forms.button>
|
<x-forms.button type="submit">Use this Server</x-forms.button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@if (!$serverReachable)
|
||||||
|
This server is not reachable with the following public key.
|
||||||
|
<br /> <br />
|
||||||
|
Please make sure you have the correct public key in your ~/.ssh/authorized_keys file for user
|
||||||
|
'root' or skip the boarding process and add a new private key manually to Coolify and to the
|
||||||
|
server.
|
||||||
|
<x-forms.input readonly id="serverPublicKey"></x-forms.input>
|
||||||
|
<x-forms.button class="box" wire:target="validateServer"
|
||||||
|
wire:click="validateServer">Check again
|
||||||
|
</x-forms.button>
|
||||||
|
@endif
|
||||||
</x-slot:actions>
|
</x-slot:actions>
|
||||||
<x-slot:explanation>
|
<x-slot:explanation>
|
||||||
<p>Private Keys are used to connect to a remote server through a secure shell, called SSH.</p>
|
<p>Private Keys are used to connect to a remote server through a secure shell, called SSH.</p>
|
||||||
@ -214,10 +225,10 @@
|
|||||||
Could not find Docker Engine on your server. Do you want me to install it for you?
|
Could not find Docker Engine on your server. Do you want me to install it for you?
|
||||||
</x-slot:question>
|
</x-slot:question>
|
||||||
<x-slot:actions>
|
<x-slot:actions>
|
||||||
|
@if ($dockerInstallationStarted)
|
||||||
<x-forms.button class="justify-center box" wire:click="installDocker"
|
<x-forms.button class="justify-center box" wire:click="installDocker"
|
||||||
onclick="installDocker.showModal()">
|
onclick="installDocker.showModal()">
|
||||||
Let's do it!</x-forms.button>
|
Let's do it!</x-forms.button>
|
||||||
@if ($dockerInstallationStarted)
|
|
||||||
<x-forms.button class="justify-center box" wire:click="dockerInstalledOrSkipped">
|
<x-forms.button class="justify-center box" wire:click="dockerInstalledOrSkipped">
|
||||||
Next</x-forms.button>
|
Next</x-forms.button>
|
||||||
@endif
|
@endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user