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
fix(service): persist service database public access (#11633)
🏔️ Peak94bf7910ad5c
diff --git a/app/Livewire/Project/Service/Index.php b/app/Livewire/Project/Service/Index.phpindex 7980e07056..3b8ca7af19 100644--- a/app/Livewire/Project/Service/Index.php+++ b/app/Livewire/Project/Service/Index.php@@ -307,36 +307,48 @@ class Index extends Componentpublic function instantSave(){+ $this->authorize('update', $this->serviceDatabase);try {- $this->authorize('update', $this->serviceDatabase);- if ($this->isPublic && ! $this->publicPort) {- $this->dispatch('error', 'Public port is required.');- $this->isPublic = false;+ if ($this->isPublic) {+ if (! $this->publicPort) {+ $this->dispatch('error', 'Public port is required.');+ $this->isPublic = false;- return;- }- $this->syncDatabaseData(true);- if ($this->serviceDatabase->is_public) {+ return;+ }if (! str($this->serviceDatabase->status)->startsWith('running')) {$this->dispatch('error', 'Database must be started to be publicly accessible.');$this->isPublic = false;- $this->serviceDatabase->is_public = false;return;}+ $this->persistPublicAccess();StartDatabaseProxy::run($this->serviceDatabase);$this->db_url_public = $this->serviceDatabase->getServiceDatabaseUrl();$this->dispatch('success', 'Database is now publicly accessible.');} else {+ $this->persistPublicAccess();StopDatabaseProxy::run($this->serviceDatabase);$this->db_url_public = null;$this->dispatch('success', 'Database is no longer publicly accessible.');}} catch (\Throwable $e) {+ $this->isPublic = ! $this->isPublic;+ $this->persistPublicAccess();+return handleError($e, $this);}}+ private function persistPublicAccess(): void+ {+ $this->serviceDatabase->update([+ 'is_public' => $this->isPublic,+ 'public_port' => $this->publicPort ?: null,+ 'public_port_timeout' => $this->publicPortTimeout ?: null,+ ]);+ }+public function submitDatabase(){try {