diff --git a/app/Livewire/Boarding/Index.php b/app/Livewire/Boarding/Index.php index 147a1ad6f..7f913b79c 100644 --- a/app/Livewire/Boarding/Index.php +++ b/app/Livewire/Boarding/Index.php @@ -73,6 +73,8 @@ class Index extends Component } $this->privateKeyName = generate_random_name(); $this->remoteServerName = generate_random_name(); + $this->remoteServerPort = $this->remoteServerPort; + $this->remoteServerUser = $this->remoteServerUser; if (isDev()) { $this->privateKey = '-----BEGIN OPENSSH PRIVATE KEY----- b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW @@ -154,6 +156,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== $this->servers = Server::ownedByCurrentTeam(['name'])->where('id', '!=', 0)->get(); if ($this->servers->count() > 0) { $this->selectedExistingServer = $this->servers->first()->id; + $this->updateServerDetails(); $this->currentState = 'select-existing-server'; return; @@ -173,9 +176,18 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== } $this->selectedExistingPrivateKey = $this->createdServer->privateKey->id; $this->serverPublicKey = $this->createdServer->privateKey->publicKey(); + $this->updateServerDetails(); $this->currentState = 'validate-server'; } + private function updateServerDetails() + { + if ($this->createdServer) { + $this->remoteServerPort = $this->createdServer->port; + $this->remoteServerUser = $this->createdServer->user; + } + } + public function getProxyType() { // Set Default Proxy Type @@ -235,11 +247,12 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== public function saveServer() { $this->validate([ - 'remoteServerName' => 'required', - 'remoteServerHost' => 'required', + 'remoteServerName' => 'required|string', + 'remoteServerHost' => 'required|string', 'remoteServerPort' => 'required|integer', - 'remoteServerUser' => 'required', + 'remoteServerUser' => 'required|string', ]); + $this->privateKey = formatPrivateKey($this->privateKey); $foundServer = Server::whereIp($this->remoteServerHost)->first(); if ($foundServer) { @@ -269,7 +282,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== public function validateServer() { try { - config()->set('coolify.mux_enabled', false); + config()->set('coolify.mux_enabled', true); // EC2 does not have `uptime` command, lol instant_remote_process(['ls /'], $this->createdServer, true); @@ -277,9 +290,13 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== $this->createdServer->settings()->update([ 'is_reachable' => true, ]); + $this->serverReachable = true; } catch (\Throwable $e) { $this->serverReachable = false; - $this->createdServer->delete(); + $this->createdServer->settings()->update([ + 'is_reachable' => false, + ]); + return handleError(error: $e, livewire: $this); } @@ -296,6 +313,9 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== ]); $this->getProxyType(); } catch (\Throwable $e) { + $this->createdServer->settings()->update([ + 'is_usable' => false, + ]); return handleError(error: $e, livewire: $this); } } @@ -349,6 +369,21 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA== ); } + public function saveAndValidateServer() + { + $this->validate([ + 'remoteServerPort' => 'required|integer|min:1|max:65535', + 'remoteServerUser' => 'required|string', + ]); + + $this->createdServer->update([ + 'port' => $this->remoteServerPort, + 'user' => $this->remoteServerUser, + 'timezone' => 'UTC', + ]); + $this->validateServer(); + } + private function createNewPrivateKey() { $this->privateKeyName = generate_random_name(); diff --git a/app/Models/Server.php b/app/Models/Server.php index c72c7cc95..46536ed47 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -112,6 +112,16 @@ class Server extends BaseModel 'proxy', ]; + protected $fillable = [ + 'name', + 'ip', + 'port', + 'user', + 'description', + 'private_key_id', + 'team_id', + ]; + protected $guarded = []; public static function isReachable() diff --git a/resources/views/livewire/boarding/index.blade.php b/resources/views/livewire/boarding/index.blade.php index 2e5fa41c9..c826e7b98 100644 --- a/resources/views/livewire/boarding/index.blade.php +++ b/resources/views/livewire/boarding/index.blade.php @@ -1,20 +1,18 @@ @php use App\Enums\ProxyTypes; @endphp Onboarding | Coolify - -
-
- @if ($currentState === 'welcome') + +
+
+ @if ($currentState === 'welcome')

Welcome to Coolify

Let me help you set up the basics.
- Get + Get Started
- @elseif ($currentState === 'explanation') + @elseif ($currentState === 'explanation') Coolify is an all-in-one application to automate tasks on your servers, deploy application with @@ -28,12 +26,15 @@ -

You don't need to manage your servers anymore. +

+ You don't need to manage your servers anymore. Coolify does it for you.

-

All configurations are stored on your servers, so +

+ All configurations are stored on your servers, so everything works without a connection to Coolify (except integrations and automations).

-

You can get notified on your favourite platforms +

+ You can get notified on your favourite platforms (Discord, Telegram, Email, etc.) when something goes wrong, or an action is needed from your side.

@@ -42,70 +43,91 @@
- @elseif ($currentState === 'select-server-type') + @elseif ($currentState === 'select-server-type') - Do you want to deploy your resources to your - or to a ? + Do you want to deploy your resources to your + + or to a + ? - Localhost + Localhost - Remote Server + Remote Server + @if (!$serverReachable) - Localhost is not reachable with the following public key. -

- Please make sure you have the correct public key in your ~/.ssh/authorized_keys file for - user or skip the boarding process and add a new private key manually to Coolify and to the - server. -
- Check this documentation for further - help. - - Check again +
+

Server is not reachable

+

Please check the connection details below and correct them if they are incorrect.

+ +
+ +
+ +

+ Non-root user is experimental: + docs +

+
+
+ +
+

If the connection details are correct, please ensure:

+
    +
  • The correct public key is in your ~/.ssh/authorized_keys file for the specified user
  • +
  • Or skip the boarding process and manually add a new private key to Coolify and the server
  • +
+
+ +

+ For more help, check this documentation. +

+ + + + + Check again +
@endif

Servers are the main building blocks, as they will host your applications, databases, services, called resources. Any CPU intensive process will use the server's CPU where you are deploying your resources.

-

is the server where Coolify is running on. It is not +

+ is the server where Coolify is running on. It is not recommended to use one server for everything.

-

is a server reachable through SSH. It can be hosted +

+ is a server reachable through SSH. It can be hosted at home, or from any cloud provider.

- @elseif ($currentState === 'private-key') + @elseif ($currentState === 'private-key') Do you have your own SSH Private Key? - Yes + Yes - No (create one for me) + No (create one for me) @if (count($privateKeys) > 0) -
- - @foreach ($privateKeys as $privateKey) - - @endforeach - - Use this SSH Key -
+
+ + @foreach ($privateKeys as $privateKey) + + @endforeach + + Use this SSH Key +
@endif
@@ -117,7 +139,7 @@

- @elseif ($currentState === 'select-existing-server') + @elseif ($currentState === 'select-existing-server') There are already servers available for your Team. Do you want to use one of them? @@ -125,19 +147,15 @@
- No - (create - one - for - me) + No (create one for me)
@foreach ($servers as $server) - + @endforeach Use this Server @@ -145,20 +163,39 @@
@if (!$serverReachable) - This server is not reachable with the following public key. -

- Please make sure you have the correct public key in your ~/.ssh/authorized_keys file for - user or skip the boarding process and add a new private key manually to Coolify and to the - server. -
- Check this documentation for further - help. - - Check - again +
+

Server is not reachable

+

Please check the connection details below and correct them if they are incorrect.

+ +
+ +
+ +

+ Non-root user is experimental: + docs +

+
+
+ +
+

If the connection details are correct, please ensure:

+
    +
  • The correct public key is in your ~/.ssh/authorized_keys file for the specified user
  • +
  • Or skip the boarding process and manually add a new private key to Coolify and the server
  • +
+
+ +

+ For more help, check this documentation. +

+ + + + + Check again +
@endif
@@ -169,25 +206,22 @@

- @elseif ($currentState === 'create-private-key') + @elseif ($currentState === 'create-private-key') Please let me know your key details. - - - + + + @if ($privateKeyType === 'create') - - ACTION REQUIRED: Copy the 'Public Key' to your - server's - ~/.ssh/authorized_keys - file. + + ACTION REQUIRED: Copy the 'Public Key' to your + server's + ~/.ssh/authorized_keys + file. @endif Save @@ -200,7 +234,7 @@

- @elseif ($currentState === 'create-server') + @elseif ($currentState === 'create-server') Please let me know your server details. @@ -208,34 +242,33 @@
- - + +
- - -
- -
Non-root user is experimental: docs. + +
+
+ +
+ +
+ +
Non-root user is experimental: docs. +
- +
Continue - @elseif ($currentState === 'validate-server') + @elseif ($currentState === 'validate-server') I need to validate your server (connection, Docker Engine, etc) and configure if something is @@ -247,8 +280,7 @@ - + Let's do it! @@ -257,20 +289,19 @@

This will install the latest Docker Engine on your server, configure a few things to be able to run optimal.

Minimum Docker Engine version is: 22

To manually install Docker - Engine, check this + Engine, check this documentation.

- @elseif ($currentState === 'create-project') + @elseif ($currentState === 'create-project') @if (count($projects) > 0) - You already have some projects. Do you want to use one of them or should I create a new one - for - you? + You already have some projects. Do you want to use one of them or should I create a new one + for + you? @else - Let's create an initial project for you. You can change all the details later on. + Let's create an initial project for you. You can change all the details later on. @endif @@ -278,15 +309,15 @@ project!
@if (count($projects) > 0) -
- - @foreach ($projects as $project) - - @endforeach - - Use this Project -
+
+ + @foreach ($projects as $project) + + @endforeach + + Use this Project +
@endif
@@ -297,7 +328,7 @@ staging version of the same application, but grouped separately.

- @elseif ($currentState === 'create-resource') + @elseif ($currentState === 'create-resource') Let's go to the new resource page, where you can create your first resource. @@ -310,24 +341,23 @@

A resource could be an application, a database or a service (like WordPress).

- @endif -
-
-
-
Skip - onboarding
-
Restart - onboarding
+ @endif
- - -
- Feedback -
-
- -
-
-
-
+
+
+
Skip + onboarding
+
Restart + onboarding
+
+ + +
+ Feedback +
+
+ +
+
+
+