diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 356006983..51c024af6 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -469,17 +469,17 @@ private function deploy_dockerfile_buildpack() $this->set_base_dir(); $this->generate_image_names(); $this->clone_repository(); - // if (!$this->force_rebuild) { - // $this->check_image_locally_or_remotely(); - // if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) { - // $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->generate_compose_file(); - // $this->push_to_docker_registry(); - // $this->rolling_update(); - // return; - // } - // } + if (!$this->force_rebuild) { + $this->check_image_locally_or_remotely(); + if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) { + $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->generate_compose_file(); + $this->push_to_docker_registry(); + $this->rolling_update(); + return; + } + } $this->cleanup_git(); $this->generate_compose_file(); $this->generate_build_env_variables(); diff --git a/app/Livewire/Project/Service/ServiceApplicationView.php b/app/Livewire/Project/Service/ServiceApplicationView.php index 70a8662d5..0986987f9 100644 --- a/app/Livewire/Project/Service/ServiceApplicationView.php +++ b/app/Livewire/Project/Service/ServiceApplicationView.php @@ -24,6 +24,16 @@ public function render() { 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() { $this->submit(); diff --git a/app/Models/Application.php b/app/Models/Application.php index 4aef5db69..4d330a00c 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -502,9 +502,9 @@ public function isConfigurationChanged(bool $save = false) { $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) { - $newConfigHash .= json_encode($this->environment_variables()); + $newConfigHash .= json_encode($this->environment_variables()->get('updated_at')); } else { - $newConfigHash .= json_encode($this->environment_variables_preview->all()); + $newConfigHash .= json_encode($this->environment_variables_preview->get('updated_at')); } $newConfigHash = md5($newConfigHash); $oldConfigHash = data_get($this, 'config_hash'); diff --git a/app/Models/Team.php b/app/Models/Team.php index a3dd4e473..e08ba7f5b 100644 --- a/app/Models/Team.php +++ b/app/Models/Team.php @@ -21,9 +21,11 @@ class Team extends Model implements SendsDiscord, SendsEmail protected static function booted() { - // static::saved(function () { - // refreshSession(); - // }); + static::saving(function ($team) { + if (auth()->user()->isMember()) { + throw new \Exception('You are not allowed to update this team.'); + } + }); } public function routeNotificationForDiscord() diff --git a/app/Models/User.php b/app/Models/User.php index e2ecae56a..0fa8ead2f 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -127,6 +127,10 @@ public function isOwner() { return $this->role() === 'owner'; } + public function isMember() + { + return $this->role() === 'member'; + } public function isAdminFromSession() { if (auth()->user()->id === 0) { diff --git a/config/sentry.php b/config/sentry.php index bef8d46c8..9561601c1 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ // The release version of your application // 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 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index cabb9ad06..bcd3a45f5 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Servers
Server related configurations.
-
-
-
Primary Server
+
+

Primary Server

+
@if (str($resource->realStatus())->startsWith('running'))
@@ -12,26 +13,29 @@
@endif -
+
Server: {{ data_get($resource, 'destination.server.name') }}
-
+
Network: {{ data_get($resource, 'destination.network') }}
@if ($resource?->additional_networks?->count() > 0) - Deploy - @if (str($resource->realStatus())->startsWith('running')) - Stop - @endif +
+ Deploy + @if (str($resource->realStatus())->startsWith('running')) + Stop + @endif +
@endif
@if ($resource?->additional_networks?->count() > 0) +

Additional Server(s)

@foreach ($resource->additional_networks as $destination) -
-
+
+
@if (str(data_get($destination, 'pivot.status'))->startsWith('running'))
@@ -40,28 +44,31 @@ class="absolute bg-success -top-1 -left-1 badge ">
class="absolute bg-error -top-1 -left-1 badge ">
@endif
- Server: {{ data_get($destination, 'server.name') }} -
-
- Network: {{ data_get($destination, 'network') }} +
+ Server: {{ data_get($destination, 'server.name') }} +
+
+ Network: {{ data_get($destination, 'network') }} +
- Deploy - Promote - to Primary - @if (data_get_str($destination, 'pivot.status')->startsWith('running')) - Stop - @endif - - This will stop the running application in this server and remove it as a deployment - destination.

Please think again. -
- +
+ Deploy + Promote + to Primary + @if (data_get_str($destination, 'pivot.status')->startsWith('running')) + Stop + @endif + + This will stop the running application in this server and remove it as a deployment + destination.

Please think again. +
+
@endforeach @endif @@ -75,10 +82,12 @@ class="absolute bg-error -top-1 -left-1 badge ">
- Server: {{ data_get($network, 'server.name') }} -
-
- Network: {{ data_get($network, 'name') }} +
+ Server: {{ data_get($network, 'server.name') }} +
+
+ Network: {{ data_get($network, 'name') }} +
@endforeach diff --git a/versions.json b/versions.json index a88c686c8..8b412b664 100644 --- a/versions.json +++ b/versions.json @@ -1,7 +1,7 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.249" + "version": "4.0.0-beta.250" } } }