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: base_dir wip & outputs
Andras Bacsaif38a9f36a16a
diff --git a/app/Http/Livewire/Project/Application/General.php b/app/Http/Livewire/Project/Application/General.phpindex f49cc9698e..f632a4431a 100644--- a/app/Http/Livewire/Project/Application/General.php+++ b/app/Http/Livewire/Project/Application/General.php@@ -132,7 +132,12 @@ class General extends Component$domains = Str::of($this->application->fqdn)->trim()->explode(',')->map(function ($domain) {return Str::of($domain)->trim()->lower();});-+ if ($this->application->base_directory && $this->application->base_directory !== '/') {+ $this->application->base_directory = rtrim($this->application->base_directory, '/');+ }+ if ($this->application->publish_directory && $this->application->publish_directory !== '/') {+ $this->application->publish_directory = rtrim($this->application->publish_directory, '/');+ }$this->application->fqdn = $domains->implode(',');$this->application->save();$this->emit('success', 'Application settings updated!');diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.phpindex b8837b0743..36a08fa030 100644--- a/app/Jobs/ApplicationDeploymentJob.php+++ b/app/Jobs/ApplicationDeploymentJob.php@@ -19,6 +19,7 @@ use Illuminate\Foundation\Bus\Dispatchable;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Queue\SerializesModels;use Illuminate\Support\Collection;+use Illuminate\Support\Facades\Storage;use Spatie\Url\Url;use Illuminate\Support\Str;use Symfony\Component\Yaml\Yaml;@@ -48,6 +49,7 @@ class ApplicationDeploymentJob implements ShouldQueueprivate string $container_name;private string $workdir;+ private string $build_workdir;private string $build_image_name;private string $production_image_name;private bool $is_debug_enabled;@@ -76,6 +78,7 @@ class ApplicationDeploymentJob implements ShouldQueue$this->private_key_location = save_private_key_for_server($this->server);$this->workdir = "/artifacts/{$this->deployment_uuid}";+ $this->build_workdir = "{$this->workdir}" . rtrim($this->application->base_directory, '/');$this->is_debug_enabled = $this->application->settings->is_debug_enabled;$this->container_name = generate_container_name($this->application->uuid, $this->pull_request_id);@@ -104,6 +107,7 @@ class ApplicationDeploymentJob implements ShouldQueuepublic function handle(): void{+ ray()->measure();$this->application_deployment_queue->update(['status' => ApplicationDeploymentStatus::IN_PROGRESS->value,]);@@ -116,31 +120,32 @@ class ApplicationDeploymentJob implements ShouldQueue$this->next(ApplicationDeploymentStatus::FINISHED->value);} catch (\Exception $e) {ray($e);- $this->execute_remote_command([- ["echo '\nOops something is not okay, are you okay? 😢'"],- ["echo '\n\n{$e->getMessage()}'"]- ]);- $this->fail($e->getMessage());+ $this->fail($e);} finally {- // if (isset($this->docker_compose)) {- // Storage::disk('deployments')->put(Str::kebab($this->application->name) . '/docker-compose.yml', $this->docker_compose);- // }+ if (isset($this->docker_compose)) {+ Storage::disk('deployments')->put(Str::kebab($this->application->name) . '/docker-compose.yml', $this->docker_compose);+ }$this->execute_remote_command(["docker rm -f {$this->deployment_uuid} >/dev/null 2>&1","hidden" => true,]);+ ray()->measure();}}public function failed(Throwable $exception): void{- ray($exception);+ $this->execute_remote_command(+ ["echo 'Oops something is not okay, are you okay? 😢'"],+ ["echo '{$exception->getMessage()}'"]+ );$this->next(ApplicationDeploymentStatus::FAILED->value);}private function execute_in_builder(string $command){- return "docker exec {$this->deployment_uuid} bash -c '{$command} |& tee -a /proc/1/fd/1'";+ return "docker exec {$this->deployment_uuid} bash -c '{$command}'";+ // return "docker exec {$this->deployment_uuid} bash -c '{$command} |& tee -a /proc/1/fd/1; [ \$PIPESTATUS -eq 0 ] || exit \$PIPESTATUS'";}private function deploy(){@@ -384,7 +389,6 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");}$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;}- ray('local_persistent_volumes', $local_persistent_volumes)->green();return $local_persistent_volumes;}private function generate_local_persistent_volumes_only_volume_names()diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.phpindex 72f64b58ac..76bb140b22 100644--- a/resources/views/livewire/project/application/general.blade.php+++ b/resources/views/livewire/project/application/general.blade.php@@ -44,7 +44,7 @@</div><div class="flex flex-col gap-2 xl:flex-row"><x-forms.input placeholder="/" id="application.base_directory" label="Base Directory"- helper="Directory to use as root. Useful for monorepos." />+ helper="Directory to use as root. Useful for monorepos. WIP" disabled />@if ($application->settings->is_static)<x-forms.input placeholder="/dist" id="application.publish_directory" label="Publish Directory"required />