diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index e92a29fc2..e3d8420ab 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -48,23 +48,6 @@ public function license()
public function force_passoword_reset() {
return view('auth.force-password-reset');
}
- // public function dashboard()
- // {
- // $projects = Project::ownedByCurrentTeam()->get();
- // $servers = Server::ownedByCurrentTeam()->get();
- // $s3s = S3Storage::ownedByCurrentTeam()->get();
- // $resources = 0;
- // foreach ($projects as $project) {
- // $resources += $project->applications->count();
- // $resources += $project->postgresqls->count();
- // }
- // return view('dashboard', [
- // 'servers' => $servers->count(),
- // 'projects' => $projects->count(),
- // 'resources' => $resources,
- // 's3s' => $s3s,
- // ]);
- // }
public function boarding() {
if (currentTeam()->boarding || isDev()) {
return view('boarding');
diff --git a/app/Http/Livewire/Boarding/Index.php b/app/Http/Livewire/Boarding/Index.php
new file mode 100644
index 000000000..d704f4f02
--- /dev/null
+++ b/app/Http/Livewire/Boarding/Index.php
@@ -0,0 +1,183 @@
+privateKeyName = generate_random_name();
+ $this->remoteServerName = generate_random_name();
+ if (isDev()) {
+ $this->privateKey = '-----BEGIN OPENSSH PRIVATE KEY-----
+b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
+QyNTUxOQAAACBbhpqHhqv6aI67Mj9abM3DVbmcfYhZAhC7ca4d9UCevAAAAJi/QySHv0Mk
+hwAAAAtzc2gtZWQyNTUxOQAAACBbhpqHhqv6aI67Mj9abM3DVbmcfYhZAhC7ca4d9UCevA
+AAAECBQw4jg1WRT2IGHMncCiZhURCts2s24HoDS0thHnnRKVuGmoeGq/pojrsyP1pszcNV
+uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
+-----END OPENSSH PRIVATE KEY-----';
+ $this->privateKeyDescription = 'Created by Coolify';
+ $this->remoteServerDescription = 'Created by Coolify';
+ $this->remoteServerHost = 'coolify-testing-host';
+ }
+ }
+ public function restartBoarding()
+ {
+ if ($this->createdServer) {
+ $this->createdServer->delete();
+ }
+ if ($this->createdPrivateKey) {
+ $this->createdPrivateKey->delete();
+ }
+ return redirect()->route('boarding');
+ }
+ public function skipBoarding()
+ {
+ currentTeam()->update([
+ 'show_boarding' => false
+ ]);
+ refreshSession();
+ return redirect()->route('dashboard');
+ }
+ public function setServer(string $type)
+ {
+ if ($type === 'localhost') {
+ $this->createdServer = Server::find(0);
+ if (!$this->createdServer) {
+ return $this->emit('error', 'Localhost server is not found. Something went wrong during installation. Please try to reinstall or contact support.');
+ }
+ $this->currentState = 'select-proxy';
+ } elseif ($type === 'remote') {
+ $this->currentState = 'private-key';
+ }
+ }
+ public function setPrivateKey(string $type)
+ {
+ $this->privateKeyType = $type;
+ if ($type === 'create' && !isDev()) {
+ $this->createNewPrivateKey();
+ }
+ $this->currentState = 'create-private-key';
+ }
+ public function savePrivateKey()
+ {
+ $this->validate([
+ 'privateKeyName' => 'required',
+ 'privateKey' => 'required',
+ ]);
+ $this->currentState = 'create-server';
+ }
+ public function saveServer()
+ {
+ $this->validate([
+ 'remoteServerName' => 'required',
+ 'remoteServerHost' => 'required',
+ 'remoteServerPort' => 'required',
+ 'remoteServerUser' => 'required',
+ ]);
+ $this->privateKey = formatPrivateKey($this->privateKey);
+ $this->createdPrivateKey = PrivateKey::create([
+ 'name' => $this->privateKeyName,
+ 'description' => $this->privateKeyDescription,
+ 'private_key' => $this->privateKey,
+ 'team_id' => currentTeam()->id
+ ]);
+ $this->createdServer = Server::create([
+ 'name' => $this->remoteServerName,
+ 'ip' => $this->remoteServerHost,
+ 'port' => $this->remoteServerPort,
+ 'user' => $this->remoteServerUser,
+ 'description' => $this->remoteServerDescription,
+ 'private_key_id' => $this->createdPrivateKey->id,
+ 'team_id' => currentTeam()->id
+ ]);
+ try {
+ ['uptime' => $uptime, 'dockerVersion' => $dockerVersion] = validateServer($this->createdServer);
+ if (!$uptime) {
+ $this->createdServer->delete();
+ $this->createdPrivateKey->delete();
+ throw new \Exception('Server is not reachable.');
+ } else {
+ $this->createdServer->settings->update([
+ 'is_reachable' => true,
+ ]);
+ $this->emit('success', 'Server is reachable.');
+ }
+ if ($dockerVersion) {
+ $this->emit('error', 'Docker is not installed on the server.');
+ $this->currentState = 'install-docker';
+ return;
+ }
+ } catch (\Exception $e) {
+ return general_error_handler(customErrorMessage: "Server is not reachable. Reason: {$e->getMessage()}", that: $this);
+ }
+ }
+ public function installDocker()
+ {
+ $activity = resolve(InstallDocker::class)($this->createdServer, currentTeam());
+ $this->emit('newMonitorActivity', $activity->id);
+ $this->currentState = 'select-proxy';
+ }
+ public function selectProxy(string|null $proxyType = null)
+ {
+ if (!$proxyType) {
+ return $this->currentState = 'create-project';
+ }
+ $this->createdServer->proxy->type = $proxyType;
+ $this->createdServer->proxy->status = 'exited';
+ $this->createdServer->save();
+ $this->currentState = 'create-project';
+ }
+ public function createNewProject()
+ {
+ $this->createdProject = Project::create([
+ 'name' => "My first project",
+ 'team_id' => currentTeam()->id
+ ]);
+ $this->currentState = 'create-resource';
+ }
+ public function showNewResource()
+ {
+ $this->skipBoarding();
+ return redirect()->route(
+ 'project.resources.new',
+ [
+ 'project_uuid' => $this->createdProject->uuid,
+ 'environment_name' => 'production',
+
+ ]
+ );
+ }
+ private function createNewPrivateKey()
+ {
+ $this->privateKeyName = generate_random_name();
+ $this->privateKeyDescription = 'Created by Coolify';
+ ['private' => $this->privateKey, 'public'=> $this->publicKey] = generateSSHKey();
+ }
+ public function render()
+ {
+ return view('livewire.boarding.index')->layout('layouts.boarding');
+ }
+}
diff --git a/resources/views/boarding.blade.php b/resources/views/boarding.blade.php
deleted file mode 100644
index bdf229935..000000000
--- a/resources/views/boarding.blade.php
+++ /dev/null
@@ -1,13 +0,0 @@
-
Let me help you to set the basics.
-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.
-Localhost is the server where Coolify is running on. It is not recommended to use one server - for everyting.
-Remote Server is a server reachable through SSH. It can be hosted at home, or from any cloud - provider.
-SSH Keys are used to connect to a remote server through a secure shell, called SSH.
-You can use your own ssh private key, or you can let Coolify to create one for you.
-In both ways, you need to add the public version of your ssh private key to the remote
- server's
- ~/.ssh/authorized_keys
file.
-
Private Keys are used to connect to a remote server through a secure shell, called SSH.
-You can use your own private key, or you can let Coolify to create one for you.
-In both ways, you need to add the public version of your private key to the remote server's
- ~/.ssh/authorized_keys
file.
-
Username should be
This will install the latest Docker Engine on your server, configure a few things to be able - to run optimal.
-This will install the latest Docker Engine on your server, configure a few things to be able - to run optimal.
-Projects are bound together several resources into one virtual group. There are no - limitations on the number of projects you could have.
-Each project should have at least one environment. This helps you to create a production & - staging version of the same application, but grouped separately.
-A resource could be an application, a database or a service (like WordPress).
-Let me help you to set the basics.
+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.
+Localhost is the server where Coolify is running on. It is not recommended to use one server + for everyting.
+Remote Server is a server reachable through SSH. It can be hosted at home, or from any cloud + provider.
+SSH Keys are used to connect to a remote server through a secure shell, called SSH.
+You can use your own ssh private key, or you can let Coolify to create one for you.
+In both ways, you need to add the public version of your ssh private key to the remote
+ server's
+ ~/.ssh/authorized_keys
file.
+
Private Keys are used to connect to a remote server through a secure shell, called SSH.
+You can use your own private key, or you can let Coolify to create one for you.
+In both ways, you need to add the public version of your private key to the remote server's
+ ~/.ssh/authorized_keys
file.
+
Username should be
This will install the latest Docker Engine on your server, configure a few things to be able + to run optimal.
+This will install the latest Docker Engine on your server, configure a few things to be able + to run optimal.
+Projects are bound together several resources into one virtual group. There are no + limitations on the number of projects you could have.
+Each project should have at least one environment. This helps you to create a production & + staging version of the same application, but grouped separately.
+A resource could be an application, a database or a service (like WordPress).
+