An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
feat: show if config is not applied
Andras Bacsaia61a86dc3b34
diff --git a/app/Http/Livewire/Project/Application/General.php b/app/Http/Livewire/Project/Application/General.phpindex 810c7cc42f..71d75a7c55 100644--- a/app/Http/Livewire/Project/Application/General.php+++ b/app/Http/Livewire/Project/Application/General.php@@ -22,6 +22,7 @@ class General extends Componentpublic $customLabels;public bool $labelsChanged = false;+ public bool $isConfigurationChanged = false;public bool $is_static;public bool $is_git_submodules_enabled;@@ -79,6 +80,7 @@ class General extends Componentpublic function mount(){+ $this->isConfigurationChanged = $this->application->isConfigurationChanged();if (is_null(data_get($this->application, 'custom_labels'))) {$this->customLabels = str(implode(",", generateLabelsApplication($this->application)))->replace(',', "\n");} else {@@ -131,6 +133,7 @@ class General extends Component$this->application->refresh();$this->emit('success', 'Application settings updated!');$this->checkLabelUpdates();+ $this->isConfigurationChanged = $this->application->isConfigurationChanged();}public function getWildcardDomain()@@ -192,6 +195,7 @@ class General extends Componentreturn handleError($e, $this);} finally {$this->checkLabelUpdates();+ $this->isConfigurationChanged = $this->application->isConfigurationChanged();}}}diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex 636adb35ac..a6d6050bf1 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -78,7 +78,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncryptedpublic $tries = 1;public function __construct(int $application_deployment_queue_id){- ray()->clearScreen();+ // ray()->clearScreen();$this->application_deployment_queue = ApplicationDeploymentQueue::find($application_deployment_queue_id);$this->log_model = $this->application_deployment_queue;$this->application = Application::find($this->application_deployment_queue->application_id);@@ -185,6 +185,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypteddispatch(new ContainerStatusJob($this->server));}$this->next(ApplicationDeploymentStatus::FINISHED->value);+ $this->application->isConfigurationChanged(true);} catch (Exception $e) {ray($e);$this->fail($e);@@ -353,14 +354,19 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted$this->execute_remote_command(["docker images -q {$this->production_image_name} 2>/dev/null", "hidden" => true, "save" => "local_image_found"]);- if (Str::of($this->saved_outputs->get('local_image_found'))->isNotEmpty()) {+ if (Str::of($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) {$this->execute_remote_command([- "echo 'Docker Image found locally with the same Git Commit SHA {$this->application->uuid}:{$this->commit}. Build step skipped...'"+ "echo 'No configuration changed & Docker Image found locally with the same Git Commit SHA {$this->application->uuid}:{$this->commit}. Build step skipped.'",]);$this->generate_compose_file();$this->rolling_update();return;}+ if ($this->application->isConfigurationChanged()) {+ $this->execute_remote_command([+ "echo 'Configuration changed. Rebuilding image.'",+ ]);+ }}$this->cleanup_git();$this->generate_nixpacks_confs();diff --git a/app/Models/Application.php b/app/Models/Application.phpindex e5bf9db07e..2e6c2814d9 100644--- a/app/Models/Application.php+++ b/app/Models/Application.php@@ -277,4 +277,31 @@ class Application extends BaseModel}return false;}+ public function isConfigurationChanged($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->health_check_path . $this->health_check_port . $this->health_check_host . $this->health_check_method . $this->health_check_return_code . $this->health_check_scheme . $this->health_check_response_text . $this->health_check_interval . $this->health_check_timeout . $this->health_check_retries . $this->health_check_start_period . $this->health_check_enabled . $this->limits_memory . $this->limits_swap . $this->limits_swappiness . $this->limits_reservation . $this->limits_cpus . $this->limits_cpuset . $this->limits_cpu_shares . $this->dockerfile . $this->dockerfile_location . $this->custom_labels;+ if ($this->pull_request_id === 0) {+ $newConfigHash .= json_encode($this->environment_variables->all());+ } else {+ $newConfigHash .= json_encode($this->environment_variables_preview->all());+ }+ $newConfigHash = md5($newConfigHash);+ $oldConfigHash = data_get($this, 'config_hash');+ if ($oldConfigHash === null) {+ if ($save) {+ $this->config_hash = $newConfigHash;+ $this->save();+ }+ return true;+ }+ if ($oldConfigHash === $newConfigHash) {+ return false;+ } else {+ if ($save) {+ $this->config_hash = $newConfigHash;+ $this->save();+ }+ return true;+ }+ }}diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.phpindex b554b8ff58..71a63248b7 100644--- a/resources/views/livewire/project/application/general.blade.php+++ b/resources/views/livewire/project/application/general.blade.php@@ -5,8 +5,12 @@<x-forms.button type="submit">Save</x-forms.button>+ @if ($isConfigurationChanged)+ <div class="font-bold text-warning">Configuration not applied to the running application. You need to+ redeploy.</div>+ @endif</div>- <div class="">General configuration for your application.</div>+ <div>General configuration for your application.</div><div class="flex flex-col gap-2 py-4"><div class="flex flex-col items-end gap-2 xl:flex-row"><x-forms.input id="application.name" label="Name" required />@@ -81,7 +85,6 @@@if ($application->dockerfile)<x-forms.textarea label="Dockerfile" id="application.dockerfile" rows="6"> </x-forms.textarea>@endif-<h3>Network</h3><div class="flex flex-col gap-2 xl:flex-row">@if ($application->settings->is_static)