diff --git a/app/Actions/Proxy/CheckProxy.php b/app/Actions/Proxy/CheckProxy.php
index 32673abc9..ccefa8681 100644
--- a/app/Actions/Proxy/CheckProxy.php
+++ b/app/Actions/Proxy/CheckProxy.php
@@ -21,7 +21,10 @@ class CheckProxy
$status = getContainerStatus($server, 'coolify-proxy_traefik');
$server->proxy->set('status', $status);
$server->save();
- return false;
+ if ($status === 'running') {
+ return false;
+ }
+ return true;
} else {
$status = getContainerStatus($server, 'coolify-proxy');
if ($status === 'running') {
diff --git a/app/Livewire/Project/New/Select.php b/app/Livewire/Project/New/Select.php
index b205467bf..80a41d7c7 100644
--- a/app/Livewire/Project/New/Select.php
+++ b/app/Livewire/Project/New/Select.php
@@ -123,7 +123,7 @@ class Select extends Component
$this->servers = $this->allServers->where('settings.is_swarm_worker', false)->where('settings.is_swarm_manager', false);
break;
}
- if (str($type)->startsWith('one-click-service')) {
+ if (str($type)->startsWith('one-click-service') || str($type)->startsWith('docker-compose-empty') || str($type)->startsWith('docker-image')) {
$this->isDatabase = true;
$this->includeSwarm = false;
$this->servers = $this->allServers->where('settings.is_swarm_worker', false)->where('settings.is_swarm_manager', false);
diff --git a/app/Livewire/Server/New/ByIp.php b/app/Livewire/Server/New/ByIp.php
index 98e7a99a7..1849cdfbc 100644
--- a/app/Livewire/Server/New/ByIp.php
+++ b/app/Livewire/Server/New/ByIp.php
@@ -23,8 +23,9 @@ class ByIp extends Component
public int $port = 22;
public bool $is_swarm_manager = false;
public bool $is_swarm_worker = false;
+ public $selected_swarm_cluster = null;
-
+ public $swarm_managers = [];
protected $rules = [
'name' => 'required|string',
'description' => 'nullable|string',
@@ -48,6 +49,10 @@ class ByIp extends Component
{
$this->name = generate_random_name();
$this->private_key_id = $this->private_keys->first()->id;
+ $this->swarm_managers = Server::isUsable()->get()->where('settings.is_swarm_manager', true);
+ if ($this->swarm_managers->count() > 0) {
+ $this->selected_swarm_cluster = $this->swarm_managers->first()->id;
+ }
}
public function setPrivateKey(string $private_key_id)
@@ -57,7 +62,7 @@ class ByIp extends Component
public function instantSave()
{
- $this->dispatch('success', 'Application settings updated!');
+ // $this->dispatch('success', 'Application settings updated!');
}
public function submit()
@@ -67,7 +72,7 @@ class ByIp extends Component
if (is_null($this->private_key_id)) {
return $this->dispatch('error', 'You must select a private key');
}
- $server = Server::create([
+ $payload = [
'name' => $this->name,
'description' => $this->description,
'ip' => $this->ip,
@@ -79,7 +84,11 @@ class ByIp extends Component
"type" => ProxyTypes::TRAEFIK_V2->value,
"status" => ProxyStatus::EXITED->value,
],
- ]);
+ ];
+ if ($this->is_swarm_worker) {
+ $payload['swarm_cluster'] = $this->selected_swarm_cluster;
+ }
+ $server = Server::create($payload);
$server->settings->is_swarm_manager = $this->is_swarm_manager;
$server->settings->is_swarm_worker = $this->is_swarm_worker;
$server->settings->save();
diff --git a/database/migrations/2023_12_19_124111_add_swarm_cluster_grouping.php b/database/migrations/2023_12_19_124111_add_swarm_cluster_grouping.php
new file mode 100644
index 000000000..668acb6fe
--- /dev/null
+++ b/database/migrations/2023_12_19_124111_add_swarm_cluster_grouping.php
@@ -0,0 +1,28 @@
+integer('swarm_cluster')->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('servers', function (Blueprint $table) {
+ $table->dropColumn('swarm_cluster');
+ });
+ }
+};
diff --git a/resources/views/components/status/index.blade.php b/resources/views/components/status/index.blade.php
index 050025f94..08d6b3cc2 100644
--- a/resources/views/components/status/index.blade.php
+++ b/resources/views/components/status/index.blade.php
@@ -1,6 +1,6 @@
@if (Str::of($status)->startsWith('running'))