An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix set custom port or user during boarding
peaklabs-dev91c845732e24
diff --git a/app/Livewire/Boarding/Index.php b/app/Livewire/Boarding/Index.phpindex 147a1ad6fc..bb01160f44 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@@ -173,6 +175,8 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==}$this->selectedExistingPrivateKey = $this->createdServer->privateKey->id;$this->serverPublicKey = $this->createdServer->privateKey->publicKey();+ $this->remoteServerPort = $this->createdServer->port;+ $this->remoteServerUser = $this->createdServer->user;$this->currentState = 'validate-server';}@@ -269,7 +273,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==public function validateServer(){try {- config()->set('coolify.mux_enabled', false);+ config()->set('coolify.mux_enabled', true);// EC2 does not have `uptime` command, lolinstant_remote_process(['ls /'], $this->createdServer, true);@@ -277,9 +281,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 +304,9 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==]);$this->getProxyType();} catch (\Throwable $e) {+ $this->createdServer->settings()->update([+ 'is_usable' => false,+ ]);return handleError(error: $e, livewire: $this);}}@@ -349,6 +360,33 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==);}+ public function saveAndValidateServer()+ {+ $this->validate([+ 'remoteServerPort' => 'required|integer|min:1|max:65535',+ 'remoteServerUser' => 'required|string',+ ]);++ if (!$this->createdServer) {+ $this->createdServer = Server::create([+ 'name' => $this->remoteServerName ?? 'New Server',+ 'ip' => $this->remoteServerHost,+ 'port' => $this->remoteServerPort,+ 'user' => $this->remoteServerUser,+ 'team_id' => currentTeam()->id,+ 'timezone' => 'UTC',+ ]);+ } else {+ $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.phpindex c72c7cc95b..d30cdc9d61 100644--- a/app/Models/Server.php+++ b/app/Models/Server.php@@ -112,6 +112,11 @@ class Server extends BaseModel'proxy',];+ protected $fillable = [+ 'port',+ 'user',+ ];+protected $guarded = [];public static function isReachable()@@ -143,7 +148,11 @@ class Server extends BaseModelpublic function settings(){- return $this->hasOne(ServerSetting::class);+ return $this->hasOne(ServerSetting::class)->withDefault([+ 'force_disabled' => false,+ 'is_reachable' => false,+ 'is_usable' => false,+ ]);}public function setupDefault404Redirect()diff --git a/resources/views/livewire/boarding/index.blade.php b/resources/views/livewire/boarding/index.blade.phpindex cd7ef4c869..4b1da05da7 100644--- a/resources/views/livewire/boarding/index.blade.php+++ b/resources/views/livewire/boarding/index.blade.php@@ -64,9 +64,9 @@<p class="mb-4">Please check the connection details below and correct them if they are incorrect.</p><div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">- <x-forms.input placeholder="Default is 22" label="Port" id="remoteServerPort" wire:model="remoteServerPort" value="{{ $createdServer->port }}" />+ <x-forms.input placeholder="Default is 22" label="Port" id="remoteServerPort" wire:model.live="remoteServerPort" /><div>- <x-forms.input placeholder="Default is root" label="User" id="remoteServerUser" wire:model="remoteServerUser" value="{{ $createdServer->user }}" />+ <x-forms.input placeholder="Default is root" label="User" id="remoteServerUser" wire:model.live="remoteServerUser" /><p class="text-xs mt-1">Non-root user is experimental:<a class="font-bold underline" target="_blank" href="https://coolify.io/docs/knowledge-base/server/non-root-user">docs</a>@@ -88,7 +88,7 @@<x-forms.input readonly id="serverPublicKey" class="mb-4" label="Current Public Key"></x-forms.input>- <x-forms.button class="w-full md:w-auto box-boarding" wire:target="setServerType('localhost')" wire:click="setServerType('localhost')">+ <x-forms.button class="w-full md:w-auto box-boarding" wire:click="saveAndValidateServer">Check again</x-forms.button></div>@@ -236,9 +236,9 @@Advanced Settings</button><div x-show="showAdvanced" class="flex flex-col gap-2 lg:flex-row">- <x-forms.input placeholder="Port number of your server. Default is 22." label="Port" id="remoteServerPort" wire:model="remoteServerPort" />+ <x-forms.input placeholder="Port number of your server. Default is 22." label="Port" id="remoteServerPort" wire:model.lazy="remoteServerPort" /><div class="w-full">- <x-forms.input placeholder="User to connect to your server. Default is root." label="User" id="remoteServerUser" wire:model="remoteServerUser" />+ <x-forms.input placeholder="User to connect to your server. Default is root." label="User" id="remoteServerUser" wire:model.lazy="remoteServerUser" /><div class="text-xs text-gray-600 dark:text-gray-300">Non-root user is experimental: <a class="font-bold underline" target="_blank" href="https://coolify.io/docs/knowledge-base/server/non-root-user">docs</a>.</div></div>