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: predefined content for files
Andras Bacsai9701c652976f
diff --git a/app/Http/Livewire/Project/Service/Show.php b/app/Http/Livewire/Project/Service/Show.phpindex ebeb24ebce..958fd595a0 100644--- a/app/Http/Livewire/Project/Service/Show.php+++ b/app/Http/Livewire/Project/Service/Show.php@@ -33,9 +33,6 @@ class Show extends Component$this->serviceDatabase = $this->service->databases()->whereName($this->parameters['service_name'])->first();$this->serviceDatabase->getFilesFromServer();}- if (is_null($service)) {- throw new \Exception("Service not found.");- }} catch(\Throwable $e) {return handleError($e, $this);}diff --git a/app/Models/Service.php b/app/Models/Service.phpindex a430dc2dd7..c23ff075a3 100644--- a/app/Models/Service.php+++ b/app/Models/Service.php@@ -287,7 +287,10 @@ class Service extends BaseModel$isDirectory = (bool) data_get($volume, 'isDirectory', false);$foundConfig = $savedService->fileStorages()->whereMountPath($target)->first();if ($foundConfig) {- $content = data_get($foundConfig, 'content');+ $contentNotNull = data_get($foundConfig, 'content');+ if ($contentNotNull) {+ $content = $contentNotNull;+ }$isDirectory = (bool) data_get($foundConfig, 'is_directory');}}@@ -343,7 +346,7 @@ class Service extends BaseModel]);}- $savedService->getFilesFromServer();+ $savedService->getFilesFromServer(isInit: true);return $volume;});data_set($service, 'volumes', $serviceVolumes->toArray());diff --git a/app/Models/ServiceApplication.php b/app/Models/ServiceApplication.phpindex 58569b6bd1..284453c42d 100644--- a/app/Models/ServiceApplication.php+++ b/app/Models/ServiceApplication.php@@ -36,8 +36,8 @@ class ServiceApplication extends BaseModel);}- public function getFilesFromServer()+ public function getFilesFromServer(bool $isInit = false){- getFilesystemVolumesFromServer($this);+ getFilesystemVolumesFromServer($this, $isInit);}}diff --git a/app/Models/ServiceDatabase.php b/app/Models/ServiceDatabase.phpindex a94bca40a7..057db8e678 100644--- a/app/Models/ServiceDatabase.php+++ b/app/Models/ServiceDatabase.php@@ -26,8 +26,8 @@ class ServiceDatabase extends BaseModel{return $this->morphMany(LocalFileVolume::class, 'resource');}- public function getFilesFromServer()+ public function getFilesFromServer(bool $isInit = false){- getFilesystemVolumesFromServer($this);+ getFilesystemVolumesFromServer($this, $isInit);}}diff --git a/bootstrap/helpers/services.php b/bootstrap/helpers/services.phpindex 7977d4d26c..306ca172fa 100644--- a/bootstrap/helpers/services.php+++ b/bootstrap/helpers/services.php@@ -64,7 +64,7 @@ function serviceStatus(Service $service)}return 'exited';}-function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase $oneService)+function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase $oneService, bool $isInit = false){// TODO: make this asynctry {@@ -87,6 +87,10 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase $oneS}$isFile = instant_remote_process(["test -f $fileLocation && echo OK || echo NOK"], $server);$isDir = instant_remote_process(["test -d $fileLocation && echo OK || echo NOK"], $server);+ if ($isFile === 'NOK' &&!$fileVolume->is_directory && $isInit) {+ $fileVolume->saveStorageOnServer($oneService);+ continue;+ }if ($isFile == 'OK' && !$fileVolume->is_directory) {$filesystemContent = instant_remote_process(["cat $fileLocation"], $server);if (base64_encode($filesystemContent) != base64_encode($content)) {