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,28 +87,32 @@
<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
<h3 class="pt-6">Swarm <span class="text-xs text-neutral-500">(experimental)</span></h3> @if (!$server->isBuildServer())
<div class="pb-4">Read the docs <a class='underline dark:text-white' <h3 class="pt-6">Swarm <span class="text-xs text-neutral-500">(experimental)</span></h3>
href='https://coolify.io/docs/knowledge-base/docker/swarm' target='_blank'>here</a>. <div class="pb-4">Read the docs <a class='underline dark:text-white'
</div> href='https://coolify.io/docs/knowledge-base/docker/swarm' target='_blank'>here</a>.
@if ($server->settings->is_swarm_worker) </div>
<x-forms.checkbox disabled instantSave type="checkbox" id="server.settings.is_swarm_manager" @if ($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>." <x-forms.checkbox disabled instantSave type="checkbox"
label="Is it a Swarm Manager?" /> id="server.settings.is_swarm_manager"
@else 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>."
<x-forms.checkbox instantSave type="checkbox" id="server.settings.is_swarm_manager" label="Is it a 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>." @else
label="Is it a Swarm Manager?" /> <x-forms.checkbox instantSave type="checkbox" id="server.settings.is_swarm_manager"
@endif 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?" />
@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"
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>." id="server.settings.is_swarm_worker"
label="Is it a 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>."
@else label="Is it a Swarm Worker?" />
<x-forms.checkbox instantSave type="checkbox" id="server.settings.is_swarm_worker" @else
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>." <x-forms.checkbox instantSave type="checkbox" id="server.settings.is_swarm_worker"
label="Is it a 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>."
label="Is it a Swarm Worker?" />
@endif
@endif @endif
@endif @endif
@else @else
@ -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,26 +99,28 @@
@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 ($proxy_started) @if (!$server->isBuildServer())
<div class="flex w-64 gap-2">Proxy started: <svg class="w-5 h-5 text-success" viewBox="0 0 256 256" @if ($proxy_started)
xmlns="http://www.w3.org/2000/svg"> <div class="flex w-64 gap-2">Proxy started: <svg class="w-5 h-5 text-success"
<g fill="currentColor">
<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"
opacity=".2" />
<path
d="m243.28 68.24l-24-23.56a16 16 0 0 0-22.58 0L104 136l-.11-.11l-36.64-35.27a16 16 0 0 0-22.57.06l-24 24a16 16 0 0 0 0 22.61l71.62 72a16 16 0 0 0 22.63 0l128.4-128.38a16 16 0 0 0-.05-22.67M103.62 208L32 136l24-24l.11.11l36.64 35.27a16 16 0 0 0 22.52 0L208.06 56L232 79.6Z" />
</g>
</svg></div>
@else
@if ($error)
<div class="flex w-64 gap-2">Proxy started: <svg class="w-5 h-5 text-error"
viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg"> viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
<path fill="currentColor" <g fill="currentColor">
d="M208.49 191.51a12 12 0 0 1-17 17L128 145l-63.51 63.49a12 12 0 0 1-17-17L111 128L47.51 64.49a12 12 0 0 1 17-17L128 111l63.51-63.52a12 12 0 0 1 17 17L145 128Z" /> <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"
opacity=".2" />
<path
d="m243.28 68.24l-24-23.56a16 16 0 0 0-22.58 0L104 136l-.11-.11l-36.64-35.27a16 16 0 0 0-22.57.06l-24 24a16 16 0 0 0 0 22.61l71.62 72a16 16 0 0 0 22.63 0l128.4-128.38a16 16 0 0 0-.05-22.67M103.62 208L32 136l24-24l.11.11l36.64 35.27a16 16 0 0 0 22.52 0L208.06 56L232 79.6Z" />
</g>
</svg></div> </svg></div>
@else @else
<div class="w-64"><x-loading text="Proxy started:" /></div> @if ($error)
<div class="flex w-64 gap-2">Proxy started: <svg class="w-5 h-5 text-error"
viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
<path fill="currentColor"
d="M208.49 191.51a12 12 0 0 1-17 17L128 145l-63.51 63.49a12 12 0 0 1-17-17L111 128L47.51 64.49a12 12 0 0 1 17-17L128 111l63.51-63.52a12 12 0 0 1 17 17L145 128Z" />
</svg></div>
@else
<div class="w-64"><x-loading text="Proxy started:" /></div>
@endif
@endif @endif
@endif @endif
@else @else