From 4dc3db3845843f78fb4b29ad44ca75735442bcaa Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 8 Nov 2023 09:07:30 +0100 Subject: [PATCH 1/3] Update versions and fix database replication (init values are changeable) in CloneProject.php --- app/Http/Livewire/Project/CloneProject.php | 1 + config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Livewire/Project/CloneProject.php b/app/Http/Livewire/Project/CloneProject.php index 215f494a7..48852b7ce 100644 --- a/app/Http/Livewire/Project/CloneProject.php +++ b/app/Http/Livewire/Project/CloneProject.php @@ -105,6 +105,7 @@ class CloneProject extends Component $newDatabase = $database->replicate()->fill([ 'uuid' => $uuid, 'status' => 'exited', + 'started_at' => null, 'environment_id' => $newEnvironment->id, 'destination_id' => $this->selectedServer, ]); diff --git a/config/sentry.php b/config/sentry.php index 8ffa05932..e6e07d06b 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // 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.112', + 'release' => '4.0.0-beta.113', // 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 b2220ad08..ef861eb3a 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Wed, 8 Nov 2023 09:30:38 +0100 Subject: [PATCH 2/3] Fix empty public port in database configuration --- app/Http/Livewire/Project/Database/Mariadb/General.php | 3 +++ app/Http/Livewire/Project/Database/Mongodb/General.php | 7 +++++-- app/Http/Livewire/Project/Database/Mysql/General.php | 3 +++ app/Http/Livewire/Project/Database/Postgresql/General.php | 4 +++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/Http/Livewire/Project/Database/Mariadb/General.php b/app/Http/Livewire/Project/Database/Mariadb/General.php index 4d04371d0..11b5fc42b 100644 --- a/app/Http/Livewire/Project/Database/Mariadb/General.php +++ b/app/Http/Livewire/Project/Database/Mariadb/General.php @@ -44,6 +44,9 @@ class General extends Component public function submit() { try { + if (str($this->database->public_port)->isEmpty()) { + $this->database->public_port = null; + } $this->validate(); $this->database->save(); $this->emit('success', 'Database updated successfully.'); diff --git a/app/Http/Livewire/Project/Database/Mongodb/General.php b/app/Http/Livewire/Project/Database/Mongodb/General.php index 2e6bed4a4..ce0ff14ea 100644 --- a/app/Http/Livewire/Project/Database/Mongodb/General.php +++ b/app/Http/Livewire/Project/Database/Mongodb/General.php @@ -42,10 +42,13 @@ class General extends Component public function submit() { try { - $this->validate(); - if ($this->database->mongo_conf === "") { + if (str($this->database->public_port)->isEmpty()) { + $this->database->public_port = null; + } + if (str($this->database->mongo_conf)->isEmpty()) { $this->database->mongo_conf = null; } + $this->validate(); $this->database->save(); $this->emit('success', 'Database updated successfully.'); } catch (Exception $e) { diff --git a/app/Http/Livewire/Project/Database/Mysql/General.php b/app/Http/Livewire/Project/Database/Mysql/General.php index ca7eb6ebe..416970ea9 100644 --- a/app/Http/Livewire/Project/Database/Mysql/General.php +++ b/app/Http/Livewire/Project/Database/Mysql/General.php @@ -44,6 +44,9 @@ class General extends Component public function submit() { try { + if (str($this->database->public_port)->isEmpty()) { + $this->database->public_port = null; + } $this->validate(); $this->database->save(); $this->emit('success', 'Database updated successfully.'); diff --git a/app/Http/Livewire/Project/Database/Postgresql/General.php b/app/Http/Livewire/Project/Database/Postgresql/General.php index 4e3bda418..7872764e3 100644 --- a/app/Http/Livewire/Project/Database/Postgresql/General.php +++ b/app/Http/Livewire/Project/Database/Postgresql/General.php @@ -91,7 +91,6 @@ class General extends Component $collection = collect($this->database->init_scripts); $found = $collection->firstWhere('filename', $script['filename']); if ($found) { - ray($collection->filter(fn ($s) => $s['filename'] !== $script['filename'])->toArray()); $this->database->init_scripts = $collection->filter(fn ($s) => $s['filename'] !== $script['filename'])->toArray(); $this->database->save(); $this->refresh(); @@ -135,6 +134,9 @@ class General extends Component public function submit() { try { + if (str($this->database->public_port)->isEmpty()) { + $this->database->public_port = null; + } $this->validate(); $this->database->save(); $this->emit('success', 'Database updated successfully.'); From 78a80c46dab2d3d471d514676c89b9c571a9542f Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 8 Nov 2023 10:13:20 +0100 Subject: [PATCH 3/3] Add nixpacks environment variables to deployment job --- app/Jobs/ApplicationDeploymentJob.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index d91334745..725b8cbc0 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -882,11 +882,17 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted foreach ($this->application->runtime_environment_variables as $env) { $environment_variables->push("$env->key=$env->value"); } + foreach ($this->application->nixpacks_environment_variables as $env) { + $environment_variables->push("$env->key=$env->value"); + } } else { // ray($this->application->runtime_environment_variables_preview)->green(); foreach ($this->application->runtime_environment_variables_preview as $env) { $environment_variables->push("$env->key=$env->value"); } + foreach ($this->application->nixpacks_environment_variables_preview as $env) { + $environment_variables->push("$env->key=$env->value"); + } } // Add PORT if not exists, use the first port as default if ($environment_variables->filter(fn ($env) => Str::of($env)->contains('PORT'))->isEmpty()) {