diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php
index 44bee6f57..dffe1ec67 100644
--- a/app/Livewire/Project/Application/General.php
+++ b/app/Livewire/Project/Application/General.php
@@ -558,8 +558,11 @@ public function loadComposeFile($isInit = false, $showToast = true, ?string $res
$this->dispatch('refreshStorages');
$this->dispatch('refreshEnvs');
} catch (\Throwable $e) {
- $this->application->docker_compose_location = $this->initialDockerComposeLocation;
- $this->application->save();
+ // Refresh model to get restored values from Application::loadComposeFile
+ $this->application->refresh();
+ // Sync restored values back to component properties for UI update
+
+ $this->syncData();
return handleError($e, $this);
} finally {
diff --git a/app/Models/Application.php b/app/Models/Application.php
index 5006d0ff8..40e41c2a7 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -1584,6 +1584,11 @@ public function loadComposeFile($isInit = false, ?string $restoreBaseDirectory =
try {
$composeFileContent = instant_remote_process($commands, $this->destination->server);
} catch (\Exception $e) {
+ // Restore original values on failure only
+ $this->docker_compose_location = $initialDockerComposeLocation;
+ $this->base_directory = $initialBaseDirectory;
+ $this->save();
+
if (str($e->getMessage())->contains('No such file')) {
throw new \RuntimeException("Docker Compose file not found at: $workdir$composeFile
Check if you used the right extension (.yaml or .yml) in the compose file name.");
}
@@ -1595,9 +1600,7 @@ public function loadComposeFile($isInit = false, ?string $restoreBaseDirectory =
}
throw new \RuntimeException($e->getMessage());
} finally {
- $this->docker_compose_location = $initialDockerComposeLocation;
- $this->base_directory = $initialBaseDirectory;
- $this->save();
+ // Cleanup only - restoration happens in catch block
$commands = collect([
"rm -rf /tmp/{$uuid}",
]);
@@ -1643,6 +1646,11 @@ public function loadComposeFile($isInit = false, ?string $restoreBaseDirectory =
'initialDockerComposeLocation' => $this->docker_compose_location,
];
} else {
+ // Restore original values before throwing
+ $this->docker_compose_location = $initialDockerComposeLocation;
+ $this->base_directory = $initialBaseDirectory;
+ $this->save();
+
throw new \RuntimeException("Docker Compose file not found at: $workdir$composeFile
Check if you used the right extension (.yaml or .yml) in the compose file name.");
}
}
diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php
index 254f31ca6..cf9621462 100644
--- a/resources/views/livewire/project/application/general.blade.php
+++ b/resources/views/livewire/project/application/general.blade.php
@@ -46,10 +46,9 @@
@if ($buildPack === 'dockercompose')
@if (
- !is_null($parsedServices) &&
+ !is_null($parsedServices) &&
count($parsedServices) > 0 &&
- !$application->settings->is_raw_compose_deployment_enabled
- )
+ !$application->settings->is_raw_compose_deployment_enabled)
Your Ports Exposes field is empty. Consider setting it to - {{ $this->detectedPortInfo['port'] }} to ensure the proxy routes traffic - correctly.
-Your Ports Exposes field is empty. Consider setting it to + {{ $this->detectedPortInfo['port'] }} to ensure the proxy routes + traffic + correctly. +
Your PORT environment variable is set to - {{ $this->detectedPortInfo['port'] }}, but it's not in your Ports Exposes - configuration. Ensure they match for proper proxy routing.
-Your PORT environment variable is set to + {{ $this->detectedPortInfo['port'] }}, but it's not in your Ports + Exposes + configuration. Ensure they match for proper proxy routing. +
Your PORT environment variable ({{ $this->detectedPortInfo['port'] }}) matches - your Ports Exposes configuration.
-Your PORT environment variable + ({{ $this->detectedPortInfo['port'] }}) matches + your Ports Exposes configuration.