Merge pull request #1936 from coollabsio/next

v4.0.0-beta.250
This commit is contained in:
Andras Bacsai 2024-04-05 16:50:08 +02:00 committed by GitHub
commit c71d5e2dfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 81 additions and 56 deletions

View File

@ -469,17 +469,17 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
$this->set_base_dir(); $this->set_base_dir();
$this->generate_image_names(); $this->generate_image_names();
$this->clone_repository(); $this->clone_repository();
// if (!$this->force_rebuild) { if (!$this->force_rebuild) {
// $this->check_image_locally_or_remotely(); $this->check_image_locally_or_remotely();
// if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) { if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) {
// $this->create_workdir(); $this->create_workdir();
// $this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped."); $this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped.");
// $this->generate_compose_file(); $this->generate_compose_file();
// $this->push_to_docker_registry(); $this->push_to_docker_registry();
// $this->rolling_update(); $this->rolling_update();
// return; return;
// } }
// } }
$this->cleanup_git(); $this->cleanup_git();
$this->generate_compose_file(); $this->generate_compose_file();
$this->generate_build_env_variables(); $this->generate_build_env_variables();

View File

@ -24,6 +24,16 @@ class ServiceApplicationView extends Component
{ {
return view('livewire.project.service.service-application-view'); return view('livewire.project.service.service-application-view');
} }
public function updatedApplicationFqdn()
{
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
$this->application->fqdn = str($this->application->fqdn)->replaceStart(',', '')->trim();
$this->application->fqdn = str($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {
return str($domain)->trim()->lower();
});
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
$this->application->save();
}
public function instantSave() public function instantSave()
{ {
$this->submit(); $this->submit();

View File

@ -502,9 +502,9 @@ class Application extends BaseModel
{ {
$newConfigHash = $this->fqdn . $this->git_repository . $this->git_branch . $this->git_commit_sha . $this->build_pack . $this->static_image . $this->install_command . $this->build_command . $this->start_command . $this->port_exposes . $this->port_mappings . $this->base_directory . $this->publish_directory . $this->dockerfile . $this->dockerfile_location . $this->custom_labels; $newConfigHash = $this->fqdn . $this->git_repository . $this->git_branch . $this->git_commit_sha . $this->build_pack . $this->static_image . $this->install_command . $this->build_command . $this->start_command . $this->port_exposes . $this->port_mappings . $this->base_directory . $this->publish_directory . $this->dockerfile . $this->dockerfile_location . $this->custom_labels;
if ($this->pull_request_id === 0 || $this->pull_request_id === null) { if ($this->pull_request_id === 0 || $this->pull_request_id === null) {
$newConfigHash .= json_encode($this->environment_variables()); $newConfigHash .= json_encode($this->environment_variables()->get('updated_at'));
} else { } else {
$newConfigHash .= json_encode($this->environment_variables_preview->all()); $newConfigHash .= json_encode($this->environment_variables_preview->get('updated_at'));
} }
$newConfigHash = md5($newConfigHash); $newConfigHash = md5($newConfigHash);
$oldConfigHash = data_get($this, 'config_hash'); $oldConfigHash = data_get($this, 'config_hash');

View File

@ -21,9 +21,11 @@ class Team extends Model implements SendsDiscord, SendsEmail
protected static function booted() protected static function booted()
{ {
// static::saved(function () { static::saving(function ($team) {
// refreshSession(); if (auth()->user()->isMember()) {
// }); throw new \Exception('You are not allowed to update this team.');
}
});
} }
public function routeNotificationForDiscord() public function routeNotificationForDiscord()

View File

@ -127,6 +127,10 @@ class User extends Authenticatable implements SendsEmail
{ {
return $this->role() === 'owner'; return $this->role() === 'owner';
} }
public function isMember()
{
return $this->role() === 'member';
}
public function isAdminFromSession() public function isAdminFromSession()
{ {
if (auth()->user()->id === 0) { if (auth()->user()->id === 0) {

View File

@ -7,7 +7,7 @@ return [
// The release version of your application // The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
'release' => '4.0.0-beta.249', 'release' => '4.0.0-beta.250',
// When left empty or `null` the Laravel environment will be used // When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'), 'environment' => config('app.env'),

View File

@ -1,3 +1,3 @@
<?php <?php
return '4.0.0-beta.249'; return '4.0.0-beta.250';

View File

@ -2,9 +2,10 @@
<h2>Servers</h2> <h2>Servers</h2>
<div class="">Server related configurations.</div> <div class="">Server related configurations.</div>
<div class="grid grid-cols-1 gap-4 py-4"> <div class="grid grid-cols-1 gap-4 py-4">
<div class="flex gap-2"> <div class="flex flex-col gap-2">
<div class="relative flex flex-col bg-white border cursor-default dark:text-white box-without-bg dark:bg-coolgray-100 w-96 dark:border-black"> <h3>Primary Server</h3>
<div class="text-xl font-bold">Primary Server</div> <div
class="relative flex flex-col bg-white border cursor-default dark:text-white box-without-bg dark:bg-coolgray-100 w-96 dark:border-black">
@if (str($resource->realStatus())->startsWith('running')) @if (str($resource->realStatus())->startsWith('running'))
<div title="{{ $resource->realStatus() }}" class="absolute bg-success -top-1 -left-1 badge "> <div title="{{ $resource->realStatus() }}" class="absolute bg-success -top-1 -left-1 badge ">
</div> </div>
@ -12,26 +13,29 @@
<div title="{{ $resource->realStatus() }}" class="absolute bg-error -top-1 -left-1 badge "> <div title="{{ $resource->realStatus() }}" class="absolute bg-error -top-1 -left-1 badge ">
</div> </div>
@endif @endif
<div> <div class="box-title">
Server: {{ data_get($resource, 'destination.server.name') }} Server: {{ data_get($resource, 'destination.server.name') }}
</div> </div>
<div> <div class="box-description">
Network: {{ data_get($resource, 'destination.network') }} Network: {{ data_get($resource, 'destination.network') }}
</div> </div>
</div> </div>
@if ($resource?->additional_networks?->count() > 0) @if ($resource?->additional_networks?->count() > 0)
<x-forms.button <div class="flex gap-2">
wire:click="redeploy('{{ data_get($resource, 'destination.id') }}','{{ data_get($resource, 'destination.server.id') }}')">Deploy</x-forms.button> <x-forms.button
@if (str($resource->realStatus())->startsWith('running')) wire:click="redeploy('{{ data_get($resource, 'destination.id') }}','{{ data_get($resource, 'destination.server.id') }}')">Deploy</x-forms.button>
<x-forms.button isError @if (str($resource->realStatus())->startsWith('running'))
wire:click="stop('{{ data_get($resource, 'destination.server.id') }}')">Stop</x-forms.button> <x-forms.button isError
@endif wire:click="stop('{{ data_get($resource, 'destination.server.id') }}')">Stop</x-forms.button>
@endif
</div>
@endif @endif
</div> </div>
@if ($resource?->additional_networks?->count() > 0) @if ($resource?->additional_networks?->count() > 0)
<h3>Additional Server(s)</h3>
@foreach ($resource->additional_networks as $destination) @foreach ($resource->additional_networks as $destination)
<div class="flex gap-2"> <div class="flex flex-col gap-2">
<div class="relative flex flex-col box w-96"> <div class="relative flex flex-col w-full box">
@if (str(data_get($destination, 'pivot.status'))->startsWith('running')) @if (str(data_get($destination, 'pivot.status'))->startsWith('running'))
<div title="{{ data_get($destination, 'pivot.status') }}" <div title="{{ data_get($destination, 'pivot.status') }}"
class="absolute bg-success -top-1 -left-1 badge "></div> class="absolute bg-success -top-1 -left-1 badge "></div>
@ -40,28 +44,31 @@
class="absolute bg-error -top-1 -left-1 badge "></div> class="absolute bg-error -top-1 -left-1 badge "></div>
@endif @endif
<div> <div>
Server: {{ data_get($destination, 'server.name') }} <div class="box-title">
</div> Server: {{ data_get($destination, 'server.name') }}
<div> </div>
Network: {{ data_get($destination, 'network') }} <div class="box-description">
Network: {{ data_get($destination, 'network') }}
</div>
</div> </div>
</div> </div>
<x-forms.button <div class="flex gap-2">
wire:click="redeploy('{{ data_get($destination, 'id') }}','{{ data_get($destination, 'server.id') }}')">Deploy</x-forms.button> <x-forms.button
<x-forms.button wire:click="redeploy('{{ data_get($destination, 'id') }}','{{ data_get($destination, 'server.id') }}')">Deploy</x-forms.button>
wire:click="promote('{{ data_get($destination, 'id') }}','{{ data_get($destination, 'server.id') }}')">Promote <x-forms.button
to Primary </x-forms.button> wire:click="promote('{{ data_get($destination, 'id') }}','{{ data_get($destination, 'server.id') }}')">Promote
@if (data_get_str($destination, 'pivot.status')->startsWith('running')) to Primary </x-forms.button>
<x-forms.button isError @if (data_get_str($destination, 'pivot.status')->startsWith('running'))
wire:click="stop('{{ data_get($destination, 'server.id') }}')">Stop</x-forms.button> <x-forms.button isError
@endif wire:click="stop('{{ data_get($destination, 'server.id') }}')">Stop</x-forms.button>
<x-modal-confirmation @endif
action="removeServer({{ data_get($destination, 'id') }},{{ data_get($destination, 'server.id') }})" <x-modal-confirmation
isErrorButton buttonTitle="Remove Server"> action="removeServer({{ data_get($destination, 'id') }},{{ data_get($destination, 'server.id') }})"
This will stop the running application in this server and remove it as a deployment isErrorButton buttonTitle="Remove Server">
destination.<br><br>Please think again. This will stop the running application in this server and remove it as a deployment
</x-modal-confirmation> destination.<br><br>Please think again.
</x-modal-confirmation>
</div>
</div> </div>
@endforeach @endforeach
@endif @endif
@ -75,10 +82,12 @@
<div wire:click="addServer('{{ $network->id }}','{{ data_get($network, 'server.id') }}')" <div wire:click="addServer('{{ $network->id }}','{{ data_get($network, 'server.id') }}')"
class="relative flex flex-col cursor-default dark:text-white box w-96"> class="relative flex flex-col cursor-default dark:text-white box w-96">
<div> <div>
Server: {{ data_get($network, 'server.name') }} <div class="box-title">
</div> Server: {{ data_get($network, 'server.name') }}
<div> </div>
Network: {{ data_get($network, 'name') }} <div class="box-description">
Network: {{ data_get($network, 'name') }}
</div>
</div> </div>
</div> </div>
@endforeach @endforeach

View File

@ -1,7 +1,7 @@
{ {
"coolify": { "coolify": {
"v4": { "v4": {
"version": "4.0.0-beta.249" "version": "4.0.0-beta.250"
} }
} }
} }