fix: improve build server functionalities

This commit is contained in:
Andras Bacsai
2024-05-24 12:01:04 +02:00
parent a01e604443
commit 5c72541044
6 changed files with 56 additions and 42 deletions

View File

@@ -22,7 +22,6 @@ class CheckProxy
} }
$proxyType = $server->proxyType(); $proxyType = $server->proxyType();
if (is_null($proxyType) || $proxyType === 'NONE' || $server->proxy->force_stop) { if (is_null($proxyType) || $proxyType === 'NONE' || $server->proxy->force_stop) {
ray('Not starting proxy');
return false; return false;
} }
['uptime' => $uptime, 'error' => $error] = $server->validateConnection(); ['uptime' => $uptime, 'error' => $error] = $server->validateConnection();

View File

@@ -15,7 +15,7 @@ class StartProxy
{ {
try { try {
$proxyType = $server->proxyType(); $proxyType = $server->proxyType();
if (is_null($proxyType) || $proxyType === 'NONE' || $server->proxy->force_stop) { if (is_null($proxyType) || $proxyType === 'NONE' || $server->proxy->force_stop || $server->isBuildServer()) {
return 'OK'; return 'OK';
} }
$commands = collect([]); $commands = collect([]);

View File

@@ -58,6 +58,12 @@ class Form extends Component
$this->server->refresh(); $this->server->refresh();
$this->server->settings->refresh(); $this->server->settings->refresh();
} }
public function updatedServerSettingsIsBuildServer()
{
$this->dispatch('serverInstalled');
$this->dispatch('serverRefresh');
$this->dispatch('proxyStatusUpdated');
}
public function instantSave() public function instantSave()
{ {
try { try {

View File

@@ -129,6 +129,9 @@ class ValidateAndInstall extends Component
} }
} }
if ($this->server->isBuildServer()) {
return;
}
$this->dispatch('startProxy'); $this->dispatch('startProxy');
} }
public function render() public function render()

View File

@@ -72,7 +72,7 @@
<div class="w-64"> <div class="w-64">
@if ($server->isFunctional()) @if ($server->isFunctional())
@if (!$server->isLocalhost()) @if (!$server->isLocalhost())
<x-forms.checkbox instantSave disabled id="server.settings.is_build_server" <x-forms.checkbox instantSave id="server.settings.is_build_server"
label="Use it as a build server?" /> label="Use it as a build server?" />
<div class="flex items-center gap-1 pt-6"> <div class="flex items-center gap-1 pt-6">
<h3 class="">Cloudflare Tunnels <h3 class="">Cloudflare Tunnels
@@ -87,12 +87,14 @@
<livewire:server.configure-cloudflare-tunnels :server_id="$server->id" /> <livewire:server.configure-cloudflare-tunnels :server_id="$server->id" />
</x-modal-input> </x-modal-input>
@endif @endif
@if (!$server->isBuildServer())
<h3 class="pt-6">Swarm <span class="text-xs text-neutral-500">(experimental)</span></h3> <h3 class="pt-6">Swarm <span class="text-xs text-neutral-500">(experimental)</span></h3>
<div class="pb-4">Read the docs <a class='underline dark:text-white' <div class="pb-4">Read the docs <a class='underline dark:text-white'
href='https://coolify.io/docs/knowledge-base/docker/swarm' target='_blank'>here</a>. href='https://coolify.io/docs/knowledge-base/docker/swarm' target='_blank'>here</a>.
</div> </div>
@if ($server->settings->is_swarm_worker) @if ($server->settings->is_swarm_worker)
<x-forms.checkbox disabled instantSave type="checkbox" id="server.settings.is_swarm_manager" <x-forms.checkbox disabled instantSave type="checkbox"
id="server.settings.is_swarm_manager"
helper="For more information, please read the documentation <a class='dark:text-white' href='https://coolify.io/docs/knowledge-base/docker/swarm' target='_blank'>here</a>." helper="For more information, please read the documentation <a class='dark:text-white' href='https://coolify.io/docs/knowledge-base/docker/swarm' target='_blank'>here</a>."
label="Is it a Swarm Manager?" /> label="Is it a Swarm Manager?" />
@else @else
@@ -102,7 +104,8 @@
@endif @endif
@if ($server->settings->is_swarm_manager) @if ($server->settings->is_swarm_manager)
<x-forms.checkbox disabled instantSave type="checkbox" id="server.settings.is_swarm_worker" <x-forms.checkbox disabled instantSave type="checkbox"
id="server.settings.is_swarm_worker"
helper="For more information, please read the documentation <a class='dark:text-white' href='https://coolify.io/docs/knowledge-base/docker/swarm' target='_blank'>here</a>." helper="For more information, please read the documentation <a class='dark:text-white' href='https://coolify.io/docs/knowledge-base/docker/swarm' target='_blank'>here</a>."
label="Is it a Swarm Worker?" /> label="Is it a Swarm Worker?" />
@else @else
@@ -111,6 +114,7 @@
label="Is it a Swarm Worker?" /> label="Is it a Swarm Worker?" />
@endif @endif
@endif @endif
@endif
@else @else
<div class="flex items-center gap-1 pt-6"> <div class="flex items-center gap-1 pt-6">
<h3 class="">Cloudflare Tunnels <h3 class="">Cloudflare Tunnels
@@ -132,7 +136,7 @@
@if ($server->isFunctional()) @if ($server->isFunctional())
<h3 class="py-4">Settings</h3> <h3 class="py-4">Settings</h3>
<div class="flex gap-2 flex-wrap sm:flex-nowrap"> <div class="flex flex-wrap gap-2 sm:flex-nowrap">
<x-forms.input id="cleanup_after_percentage" label="Disk cleanup threshold (%)" required <x-forms.input id="cleanup_after_percentage" label="Disk cleanup threshold (%)" required
helper="The disk cleanup task will run when the disk usage exceeds this threshold." /> helper="The disk cleanup task will run when the disk usage exceeds this threshold." />
<x-forms.input id="server.settings.concurrent_builds" label="Number of concurrent builds" required <x-forms.input id="server.settings.concurrent_builds" label="Number of concurrent builds" required

View File

@@ -99,9 +99,10 @@
@else @else
<div class="w-64"><x-loading text="Minimum Docker version:" /></div> <div class="w-64"><x-loading text="Minimum Docker version:" /></div>
@endisset @endisset
@if (!$server->isBuildServer())
@if ($proxy_started) @if ($proxy_started)
<div class="flex w-64 gap-2">Proxy started: <svg class="w-5 h-5 text-success" viewBox="0 0 256 256" <div class="flex w-64 gap-2">Proxy started: <svg class="w-5 h-5 text-success"
xmlns="http://www.w3.org/2000/svg"> viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
<g fill="currentColor"> <g fill="currentColor">
<path <path
d="m237.66 85.26l-128.4 128.4a8 8 0 0 1-11.32 0l-71.6-72a8 8 0 0 1 0-11.31l24-24a8 8 0 0 1 11.32 0l36.68 35.32a8 8 0 0 0 11.32 0l92.68-91.32a8 8 0 0 1 11.32 0l24 23.6a8 8 0 0 1 0 11.31" d="m237.66 85.26l-128.4 128.4a8 8 0 0 1-11.32 0l-71.6-72a8 8 0 0 1 0-11.31l24-24a8 8 0 0 1 11.32 0l36.68 35.32a8 8 0 0 0 11.32 0l92.68-91.32a8 8 0 0 1 11.32 0l24 23.6a8 8 0 0 1 0 11.31"
@@ -121,6 +122,7 @@
<div class="w-64"><x-loading text="Proxy started:" /></div> <div class="w-64"><x-loading text="Proxy started:" /></div>
@endif @endif
@endif @endif
@endif
@else @else
@if ($error) @if ($error)
<div class="flex w-64 gap-2">Docker Compose is installed: <svg class="w-5 h-5 text-error" <div class="flex w-64 gap-2">Docker Compose is installed: <svg class="w-5 h-5 text-error"