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
wip
Andras Bacsaiee211aba5140
diff --git a/app/Http/Livewire/Project/Application/General.php b/app/Http/Livewire/Project/Application/General.phpindex eeef8020bf..c7f84258dc 100644--- a/app/Http/Livewire/Project/Application/General.php+++ b/app/Http/Livewire/Project/Application/General.php@@ -20,7 +20,7 @@ class General extends Componentpublic string|null $git_commit_sha;public string $build_pack;public string|null $wildcard_domain = null;- public string|null $project_wildcard_domain = null;+ public string|null $server_wildcard_domain = null;public string|null $global_wildcard_domain = null;public bool $is_static;@@ -81,9 +81,9 @@ class General extends Componentprotected function checkWildCardDomain(){$coolify_instance_settings = InstanceSettings::get();- $this->project_wildcard_domain = data_get($this->application, 'environment.project.settings.wildcard_domain');+ $this->server_wildcard_domain = data_get($this->application, 'destination.server.settings.wildcard_domain');$this->global_wildcard_domain = data_get($coolify_instance_settings, 'wildcard_domain');- $this->wildcard_domain = $this->project_wildcard_domain ?? $this->global_wildcard_domain ?? null;+ $this->wildcard_domain = $this->server_wildcard_domain ?? $this->global_wildcard_domain ?? null;}public function mount(){@@ -107,10 +107,10 @@ class General extends Component$this->application->save();$this->emit('success', 'Application settings updated!');}- public function generateProjectRandomDomain()+ public function generateServerRandomDomain(){- // Set wildcard domain based on Project wildcard domain- $url = Url::fromString($this->project_wildcard_domain);+ // Set wildcard domain based on Server wildcard domain+ $url = Url::fromString($this->server_wildcard_domain);$host = $url->getHost();$path = $url->getPath() === '/' ? '' : $url->getPath();$scheme = $url->getScheme();diff --git a/app/Http/Livewire/Project/Edit.php b/app/Http/Livewire/Project/Edit.phpindex 79652607c1..60702ca3ee 100644--- a/app/Http/Livewire/Project/Edit.php+++ b/app/Http/Livewire/Project/Edit.php@@ -8,22 +8,15 @@ use Livewire\Component;class Edit extends Component{public Project $project;- public string|null $wildcard_domain = null;protected $rules = ['project.name' => 'required|min:3|max:255','project.description' => 'nullable|string|max:255',- 'wildcard_domain' => 'nullable|string|max:255',];- public function mount()- {- $this->wildcard_domain = $this->project->settings->wildcard_domain;- }+public function submit(){$this->validate();try {- $this->project->settings->wildcard_domain = $this->wildcard_domain;- $this->project->settings->save();$this->project->save();$this->emit('saved');} catch (\Exception $e) {diff --git a/app/Http/Livewire/Server/Form.php b/app/Http/Livewire/Server/Form.phpindex 2c4f2260fa..961fde6a86 100644--- a/app/Http/Livewire/Server/Form.php+++ b/app/Http/Livewire/Server/Form.php@@ -11,6 +11,7 @@ class Form extends Componentpublic Server $server;public $uptime;public $dockerVersion;+ public string|null $wildcard_domain = null;protected $rules = ['server.name' => 'required|min:6',@@ -19,7 +20,8 @@ class Form extends Component'server.user' => 'required','server.port' => 'required','server.settings.is_reachable' => 'required',- 'server.settings.is_part_of_swarm' => 'required'+ 'server.settings.is_part_of_swarm' => 'required',+ 'wildcard_domain' => 'nullable|string'];protected $validationAttributes = ['server.name' => 'name',@@ -30,6 +32,10 @@ class Form extends Component'server.settings.is_reachable' => 'is reachable','server.settings.is_part_of_swarm' => 'is part of swarm'];+ public function mount()+ {+ $this->wildcard_domain = $this->server->settings->wildcard_domain;+ }public function installDocker(){$activity = resolve(InstallDocker::class)($this->server);@@ -81,6 +87,8 @@ class Form extends Component// }// return;// }+ $this->server->settings->wildcard_domain = $this->wildcard_domain;+ $this->server->settings->save();$this->server->save();$this->emit('success', 'Server updated successfully.');}diff --git a/database/migrations/2023_06_22_131459_move_wildcard_to_server.php b/database/migrations/2023_06_22_131459_move_wildcard_to_server.phpnew file mode 100644index 0000000000..cd258fbea1--- /dev/null+++ b/database/migrations/2023_06_22_131459_move_wildcard_to_server.php@@ -0,0 +1,34 @@+<?php++use Illuminate\Database\Migrations\Migration;+use Illuminate\Database\Schema\Blueprint;+use Illuminate\Support\Facades\Schema;++return new class extends Migration+{+ /**+ * Run the migrations.+ */+ public function up(): void+ {+ Schema::table('project_settings', function (Blueprint $table) {+ $table->dropColumn('wildcard_domain');+ });+ Schema::table('server_settings', function (Blueprint $table) {+ $table->string('wildcard_domain')->nullable();+ });+ }++ /**+ * Reverse the migrations.+ */+ public function down(): void+ {+ Schema::table('project_settings', function (Blueprint $table) {+ $table->string('wildcard_domain')->nullable();+ });+ Schema::table('server_settings', function (Blueprint $table) {+ $table->dropColumn('wildcard_domain');+ });+ }+};diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.phpindex ec8ee781fe..9db650e241 100644--- a/resources/views/livewire/project/application/general.blade.php+++ b/resources/views/livewire/project/application/general.blade.php@@ -15,11 +15,11 @@@if ($wildcard_domain)<div class="flex flex-row gap-2">@if ($global_wildcard_domain)- <x-forms.button wire:click="generateGlobalRandomDomain">Global Wildcard+ <x-forms.button wire:click="generateGlobalRandomDomain">Set Global Wildcard</x-forms.button>@endif- @if ($project_wildcard_domain)- <x-forms.button wire:click="generateProjectRandomDomain">Project Wildcard+ @if ($server_wildcard_domain)+ <x-forms.button wire:click="generateServerRandomDomain">Set Server Wildcard</x-forms.button>@endif</div>diff --git a/resources/views/livewire/project/edit.blade.php b/resources/views/livewire/project/edit.blade.phpindex ad58e3c59e..dfcab8d224 100644--- a/resources/views/livewire/project/edit.blade.php+++ b/resources/views/livewire/project/edit.blade.php@@ -8,7 +8,6 @@<div class="flex gap-2"><x-forms.input label="Name" id="project.name" /><x-forms.input label="Description" id="project.description" />- <x-forms.input label="Wildcard Domain" id="wildcard_domain" /></div></form></div>diff --git a/resources/views/livewire/server/form.blade.php b/resources/views/livewire/server/form.blade.phpindex 8f1aeeb5ad..9e0372c024 100644--- a/resources/views/livewire/server/form.blade.php+++ b/resources/views/livewire/server/form.blade.php@@ -15,6 +15,8 @@<x-forms.input id="server.name" label="Name" required /><x-forms.input id="server.description" label="Description" />@endif+ <x-forms.input id="wildcard_domain" label="Wildcard Domain"+ helper="Wildcard domain for your applications. If you set this, you will get a random generated domain for your new applications.<br><span class='font-bold text-white'>Example</span>In case you set:<span class='text-helper'>https://example.com</span>your applications will get: <span class='text-helper'>https://randomId.example.com</span>" />{{-- <x-forms.checkbox disabled type="checkbox" id="server.settings.is_part_of_swarm"label="Is it part of a Swarm cluster?" /> --}}diff --git a/routes/web.php b/routes/web.phpindex 49d82dc77a..61abd0e8df 100644--- a/routes/web.php+++ b/routes/web.php@@ -52,9 +52,7 @@ Route::middleware(['auth'])->group(function () {Route::get('/project/{project_uuid}/{environment_name}/new', [ProjectController::class, 'new'])->name('project.resources.new');Route::get('/project/{project_uuid}/{environment_name}', [ProjectController::class, 'resources'])->name('project.resources');Route::get('/project/{project_uuid}/{environment_name}/application/{application_uuid}', [ApplicationController::class, 'configuration'])->name('project.application.configuration');-- Route::get('/project/{project_uuid}/{environment_name}/application/{application_uuid}/deployment', [ApplicationController::class, 'deployments'])->name('project.application.deployments');-+ Route::get('/project/{project_uuid}/{environment_name}/application/{application_uuid}/deployment', [ApplicationController::class, 'deployments'])->name('project.application.deployments');Route::get('/project/{project_uuid}/{environment_name}/application/{application_uuid}/deployment/{deployment_uuid}',[ApplicationController::class, 'deployment']