Skip to content

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.

fix(application): clear Docker Compose specific data when switching away from dockercompose

Andras Bacsai460198bb0577
diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php
index db22cf1d00..6ee9dcaad2 100644
--- a/app/Livewire/Project/Application/General.php
+++ b/app/Livewire/Project/Application/General.php
@@ -312,6 +312,18 @@ class General extends Component
if ($this->application->build_pack === 'dockercompose') {
$this->application->fqdn = null;
$this->application->settings->save();
+ } else {
+ // Clear Docker Compose specific data when switching away from dockercompose
+ if ($this->application->getOriginal('build_pack') === 'dockercompose') {
+ $this->application->docker_compose_domains = null;
+ $this->application->docker_compose_raw = null;
+
+ // Remove SERVICE_FQDN_* and SERVICE_URL_* environment variables
+ $this->application->environment_variables()->where('key', 'LIKE', 'SERVICE_FQDN_%')->delete();
+ $this->application->environment_variables()->where('key', 'LIKE', 'SERVICE_URL_%')->delete();
+ $this->application->environment_variables_preview()->where('key', 'LIKE', 'SERVICE_FQDN_%')->delete();
+ $this->application->environment_variables_preview()->where('key', 'LIKE', 'SERVICE_URL_%')->delete();
+ }
}
if ($this->application->build_pack === 'static') {
$this->application->ports_exposes = $this->ports_exposes = 80;
diff --git a/bootstrap/helpers/parsers.php b/bootstrap/helpers/parsers.php
index 310d71c5dd..f35e73390a 100644
--- a/bootstrap/helpers/parsers.php
+++ b/bootstrap/helpers/parsers.php
@@ -635,6 +635,11 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
} else {
$domains = collect(json_decode(data_get($resource, 'docker_compose_domains'))) ?? collect([]);
}
+
+ // Only process domains for dockercompose applications to prevent SERVICE variable recreation
+ if ($resource->build_pack !== 'dockercompose') {
+ $domains = collect([]);
+ }
$fqdns = data_get($domains, "$serviceName.domain");
// Generate SERVICE_FQDN & SERVICE_URL for dockercompose
if ($resource->build_pack === 'dockercompose') {