diff --git a/app/Livewire/Boarding/Index.php b/app/Livewire/Boarding/Index.php
index eee62c93d..8cb1dd7d2 100644
--- a/app/Livewire/Boarding/Index.php
+++ b/app/Livewire/Boarding/Index.php
@@ -3,6 +3,7 @@
namespace App\Livewire\Boarding;
use App\Actions\Server\InstallDocker;
+use App\Enums\ProxyTypes;
use App\Models\PrivateKey;
use App\Models\Project;
use App\Models\Server;
@@ -121,15 +122,16 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
}
$this->selectedExistingPrivateKey = $this->createdServer->privateKey->id;
$this->serverPublicKey = $this->createdServer->privateKey->publicKey();
- $this->validateServer();
+ $this->installServer();
}
public function getProxyType()
{
- $proxyTypeSet = $this->createdServer->proxy->type;
- if (!$proxyTypeSet) {
- $this->currentState = 'select-proxy';
- return;
- }
+ $this->selectProxy(ProxyTypes::TRAEFIK_V2->value);
+ // $proxyTypeSet = $this->createdServer->proxy->type;
+ // if (!$proxyTypeSet) {
+ // $this->currentState = 'select-proxy';
+ // return;
+ // }
$this->getProjects();
}
public function selectExistingPrivateKey()
@@ -193,7 +195,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
$this->createdServer->settings->is_cloudflare_tunnel = $this->isCloudflareTunnel;
$this->createdServer->settings->save();
$this->createdServer->addInitialNetwork();
- $this->validateServer();
+ $this->currentState = 'validate-server';
}
public function installServer()
{
@@ -219,7 +221,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
$dockerVersion = instant_remote_process(["docker version|head -2|grep -i version| awk '{print $2}'"], $this->createdServer, true);
$dockerVersion = checkMinimumDockerEngineVersion($dockerVersion);
if (is_null($dockerVersion)) {
- $this->currentState = 'install-docker';
+ $this->currentState = 'validate-server';
throw new \Exception('Docker not found or old version is installed.');
}
$this->createdServer->settings()->update([
@@ -227,27 +229,10 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
]);
$this->getProxyType();
} catch (\Throwable $e) {
- // $this->dockerInstallationStarted = false;
return handleError(error: $e, livewire: $this);
}
}
- public function installDocker()
- {
- try {
- $this->dockerInstallationStarted = true;
- $activity = InstallDocker::run($this->createdServer);
- $this->dispatch('installDocker');
- $this->dispatch('activityMonitor', $activity->id);
- } catch (\Throwable $e) {
- $this->dockerInstallationStarted = false;
- return handleError(error: $e, livewire: $this);
- }
- }
- public function dockerInstalledOrSkipped()
- {
- $this->validateServer();
- }
- public function selectProxy(string|null $proxyType = null)
+ public function selectProxy(?string $proxyType = null)
{
if (!$proxyType) {
return $this->getProjects();
diff --git a/app/Livewire/Project/Application/Heading.php b/app/Livewire/Project/Application/Heading.php
index 1b19c445a..01ab13c4e 100644
--- a/app/Livewire/Project/Application/Heading.php
+++ b/app/Livewire/Project/Application/Heading.php
@@ -56,15 +56,15 @@ class Heading extends Component
return;
}
if ($this->application->destination->server->isSwarm() && str($this->application->docker_registry_image_name)->isEmpty()) {
- $this->dispatch('error', 'Failed to deploy', 'To deploy to a Swarm cluster you must set a Docker image name first.');
+ $this->dispatch('error', 'Failed to deploy.', 'To deploy to a Swarm cluster you must set a Docker image name first.');
return;
}
if (data_get($this->application, 'settings.is_build_server_enabled') && str($this->application->docker_registry_image_name)->isEmpty()) {
- $this->dispatch('error', 'Failed to deploy', 'To use a build server, you must first set a Docker image.
More information here: documentation');
+ $this->dispatch('error', 'Failed to deploy.', 'To use a build server, you must first set a Docker image.
More information here: documentation');
return;
}
if ($this->application->additional_servers->count() > 0 && str($this->application->docker_registry_image_name)->isEmpty()) {
- $this->dispatch('error', 'Failed to deploy', 'To deploy to more than one server, you must first set a Docker image.
More information here: documentation');
+ $this->dispatch('error', 'Failed to deploy.', 'Before deploying to multiple servers, you must first set a Docker image in the General tab.
More information here: documentation');
return;
}
$this->setDeploymentUuid();
@@ -103,7 +103,7 @@ class Heading extends Component
public function restart()
{
if ($this->application->additional_servers->count() > 0 && str($this->application->docker_registry_image_name)->isEmpty()) {
- $this->dispatch('error', 'Failed to deploy', 'To deploy to more than one server, you must first set a Docker image.
More information here: documentation');
+ $this->dispatch('error', 'Failed to deploy', 'Before deploying to multiple servers, you must first set a Docker image in the General tab.
More information here: documentation');
return;
}
$this->setDeploymentUuid();
diff --git a/app/Livewire/Project/Shared/Destination.php b/app/Livewire/Project/Shared/Destination.php
index cf5e2632f..3d816149b 100644
--- a/app/Livewire/Project/Shared/Destination.php
+++ b/app/Livewire/Project/Shared/Destination.php
@@ -37,10 +37,13 @@ class Destination extends Component
$this->networks = $this->networks->reject(function ($network) use ($all_networks) {
return $all_networks->pluck('id')->contains($network->id);
});
-
}
public function redeploy(int $network_id, int $server_id)
{
+ if ($this->resource->additional_servers->count() > 0 && str($this->resource->docker_registry_image_name)->isEmpty()) {
+ $this->dispatch('error', 'Failed to deploy.', 'Before deploying to multiple servers, you must first set a Docker image in the General tab.
More information here: documentation');
+ return;
+ }
$deployment_uuid = new Cuid2(7);
$server = Server::find($server_id);
$destination = StandaloneDocker::find($network_id);
diff --git a/app/Livewire/Server/Proxy/Status.php b/app/Livewire/Server/Proxy/Status.php
index a41994c8f..bd0ffe431 100644
--- a/app/Livewire/Server/Proxy/Status.php
+++ b/app/Livewire/Server/Proxy/Status.php
@@ -12,7 +12,7 @@ class Status extends Component
public Server $server;
public bool $polling = false;
public int $numberOfPolls = 0;
- protected $listeners = ['proxyStatusUpdated', 'startProxyPolling'];
+ protected $listeners = ['proxyStatusUpdated' => '$refresh', 'startProxyPolling'];
public function startProxyPolling()
{
diff --git a/app/Livewire/Server/ValidateAndInstall.php b/app/Livewire/Server/ValidateAndInstall.php
index ca81487a8..4d37feca2 100644
--- a/app/Livewire/Server/ValidateAndInstall.php
+++ b/app/Livewire/Server/ValidateAndInstall.php
@@ -2,6 +2,7 @@
namespace App\Livewire\Server;
+use App\Actions\Proxy\StartProxy;
use App\Models\Server;
use Livewire\Component;
@@ -16,17 +17,21 @@ class ValidateAndInstall extends Component
public $docker_installed = null;
public $docker_compose_installed = null;
public $docker_version = null;
+ public $proxy_started = false;
public $error = null;
protected $listeners = ['validateServer' => 'init', 'validateDockerEngine', 'validateServerNow' => 'validateServer'];
public function init(bool $install = true)
{
+
$this->install = $install;
$this->uptime = null;
$this->supported_os_type = null;
$this->docker_installed = null;
$this->docker_version = null;
+ $this->docker_compose_installed = null;
+ $this->proxy_started = null;
$this->error = null;
$this->number_of_tries = 0;
$this->dispatch('validateServerNow');
@@ -44,6 +49,11 @@ class ValidateAndInstall extends Component
if ($swarmInstalled) {
$this->dispatch('success', 'Docker Swarm is initiated.');
}
+ } else {
+ $proxy = StartProxy::run($this->server);
+ if ($proxy) {
+ $this->proxy_started = true;
+ }
}
} catch (\Throwable $e) {
return handleError($e, $this);
diff --git a/app/Models/Application.php b/app/Models/Application.php
index 959d06d7f..0ba1d24d1 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -200,9 +200,6 @@ class Application extends BaseModel
set: fn ($value) => $value === "" ? null : $value,
);
}
-
- // Normal Deployments
-
public function portsMappingsArray(): Attribute
{
return Attribute::make(
@@ -214,7 +211,7 @@ class Application extends BaseModel
}
public function realStatus()
{
- return $this->getRawOriginal('status');
+ return $this->getRawOriginal('status');
}
public function status(): Attribute
{
diff --git a/resources/views/components/applications/links.blade.php b/resources/views/components/applications/links.blade.php
index a6e4b5c82..92acb01a2 100644
--- a/resources/views/components/applications/links.blade.php
+++ b/resources/views/components/applications/links.blade.php
@@ -28,8 +28,8 @@
- Port {{ $port }}
+ {{ $application->destination->server->ip }}:{{ explode(':', $port)[0] }}
+ @if (count($application->additional_servers) > 0)
+ @foreach ($application->additional_servers as $server)
+
{!! $error !!}