From cf0dbef3b5868ba66675f6e610021fe68ce64338 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 4 Jul 2023 13:08:27 +0200 Subject: [PATCH 01/18] fix: show github app secrets --- config/version.php | 2 +- resources/views/livewire/source/github/change.blade.php | 8 +++++--- routes/web.php | 2 +- versions.json | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/config/version.php b/config/version.php index 8de13f6e7..3a9c12a30 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@
Your Private GitHub App for private repositories.
@if ($github_app->app_id) +
+ +
- @else
diff --git a/routes/web.php b/routes/web.php index ade352398..18f09484e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -116,7 +116,7 @@ Route::middleware(['auth'])->group(function () { ]); })->name('source.all'); Route::get('/source/github/{github_app_uuid}', function (Request $request) { - $github_app = GithubApp::where('uuid', request()->github_app_uuid)->first(); + $github_app = GithubApp::where('uuid', request()->github_app_uuid)->first()->makeVisible('client_secret')->makeVisible('webhook_secret'); $settings = InstanceSettings::get(); $name = Str::of(Str::kebab($github_app->name)); if ($settings->public_ipv4) { diff --git a/versions.json b/versions.json index 684123a62..6c8e94817 100644 --- a/versions.json +++ b/versions.json @@ -4,7 +4,7 @@ "version": "3.12.32" }, "v4": { - "version": "4.0.0-beta.16" + "version": "4.0.0-beta.17" } } } \ No newline at end of file From 67eaf8c70d88f73332314e6f935b5edbde3dd6f2 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 4 Jul 2023 13:40:37 +0200 Subject: [PATCH 02/18] add v3 sync script --- scripts/run | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/scripts/run b/scripts/run index 01c643e38..5535014f1 100755 --- a/scripts/run +++ b/scripts/run @@ -20,40 +20,47 @@ function help { compgen -A function | cat -n } +function sync:v3 { + if [ -z "$1" ]; then + echo -e "Please provide a version.\n\nExample: run sync:v3 3.12.32" + exit 1 + fi + skopeo copy --all docker://ghcr.io/coollabsio/coolify:$1 docker://coollabsio/coolify:$1 +} function sync:bunny { php artisan sync:bunny --env=secrets } function queue { - bash vendor/bin/spin exec -u webuser coolify php artisan queue:listen + bash spin exec -u webuser coolify php artisan queue:listen } function horizon { - bash vendor/bin/spin exec -u webuser coolify php artisan horizon -vvv + bash spin exec -u webuser coolify php artisan horizon -vvv } function schedule { - bash vendor/bin/spin exec -u webuser coolify php artisan schedule:work + bash spin exec -u webuser coolify php artisan schedule:work } function schedule:run { - bash vendor/bin/spin exec -u webuser coolify php artisan schedule:run + bash spin exec -u webuser coolify php artisan schedule:run } function db:reset { - bash vendor/bin/spin exec -u webuser coolify php artisan migrate:fresh --seed + bash spin exec -u webuser coolify php artisan migrate:fresh --seed } function db { - bash vendor/bin/spin exec -u webuser coolify php artisan db + bash spin exec -u webuser coolify php artisan db } function db:migrate { - bash vendor/bin/spin exec -u webuser coolify php artisan migrate + bash spin exec -u webuser coolify php artisan migrate } function db:reset-prod { - bash vendor/bin/spin exec -u webuser coolify php artisan migrate:fresh --force --seed --seeder=ProductionSeeder || + bash spin exec -u webuser coolify php artisan migrate:fresh --force --seed --seeder=ProductionSeeder || php artisan migrate:fresh --force --seed --seeder=ProductionSeeder } @@ -62,11 +69,11 @@ function mfs { } function coolify { - bash vendor/bin/spin exec -u webuser coolify bash + bash spin exec -u webuser coolify bash } function coolify:root { - bash vendor/bin/spin exec coolify bash + bash spin exec coolify bash } function coolify:proxy { docker exec -ti coolify-proxy sh @@ -77,11 +84,11 @@ function redis { } function vite { - bash vendor/bin/spin exec vite bash + bash spin exec vite bash } function tinker { - bash vendor/bin/spin exec -u webuser coolify php artisan tinker + bash spin exec -u webuser coolify php artisan tinker } From 4fc3ada42e8a9ced1262b391bf3f7d339838c913 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 4 Jul 2023 13:41:18 +0200 Subject: [PATCH 03/18] fix: do not force next version updates --- app/Actions/Server/UpdateCoolify.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Actions/Server/UpdateCoolify.php b/app/Actions/Server/UpdateCoolify.php index 047a06e81..71231cd36 100644 --- a/app/Actions/Server/UpdateCoolify.php +++ b/app/Actions/Server/UpdateCoolify.php @@ -26,7 +26,6 @@ class UpdateCoolify ray('latest version:' . $this->latest_version . " current version: " . $this->current_version . ' force: ' . $force); if ($settings->next_channel) { ray('next channel enabled'); - $force = true; $this->latest_version = 'next'; } if ($force) { From d757134ceda9df7abfaac027579113cb77c3ea56 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 4 Jul 2023 14:29:52 +0200 Subject: [PATCH 04/18] fix: debug log button --- .../Project/Application/DeploymentNavbar.php | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/Http/Livewire/Project/Application/DeploymentNavbar.php b/app/Http/Livewire/Project/Application/DeploymentNavbar.php index 5daa2f84f..4f2e61851 100644 --- a/app/Http/Livewire/Project/Application/DeploymentNavbar.php +++ b/app/Http/Livewire/Project/Application/DeploymentNavbar.php @@ -5,6 +5,7 @@ namespace App\Http\Livewire\Project\Application; use App\Enums\ApplicationDeploymentStatus; use App\Models\Application; use App\Models\ApplicationDeploymentQueue; +use App\Models\Server; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Process; use Livewire\Component; @@ -15,29 +16,34 @@ class DeploymentNavbar extends Component protected $listeners = ['deploymentFinished']; public ApplicationDeploymentQueue $application_deployment_queue; + private Application $application; + private Server $server; public bool $is_debug_enabled = false; + public function mount() + { + $this->application = Application::find($this->application_deployment_queue->application_id); + $this->server = $this->application->destination->server; + $this->is_debug_enabled = $this->application->settings->is_debug_enabled; + } public function deploymentFinished() { $this->application_deployment_queue->refresh(); } public function show_debug() { - $application = Application::find($this->application_deployment_queue->application_id); - $application->settings->is_debug_enabled = !$application->settings->is_debug_enabled; - $application->settings->save(); - $this->is_debug_enabled = $application->settings->is_debug_enabled; + $this->application->settings->is_debug_enabled = !$this->application->settings->is_debug_enabled; + $this->application->settings->save(); + $this->is_debug_enabled = $this->application->settings->is_debug_enabled; $this->emit('refreshQueue'); } public function cancel() { try { $kill_command = "kill -9 {$this->application_deployment_queue->current_process_id}"; - $application = Application::find($this->application_deployment_queue->application_id); - $server = $application->destination->server; if ($this->application_deployment_queue->current_process_id) { $process = Process::run("ps -p {$this->application_deployment_queue->current_process_id} -o command --no-headers"); - if (Str::of($process->output())->contains([$server->ip, 'EOF-COOLIFY-SSH'])) { + if (Str::of($process->output())->contains([$this->server->ip, 'EOF-COOLIFY-SSH'])) { Process::run($kill_command); } $previous_logs = json_decode($this->application_deployment_queue->logs, associative: true, flags: JSON_THROW_ON_ERROR); From 1342634907d4f6b886e7e7df1996621af0d5e6af Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 5 Jul 2023 21:26:21 +0200 Subject: [PATCH 05/18] ui upgrades --- app/Http/Livewire/Upgrade.php | 2 +- resources/css/app.css | 22 +- resources/views/components/layout.blade.php | 192 ++++++++-------- resources/views/components/navbar.blade.php | 237 +++++++++----------- resources/views/livewire/upgrade.blade.php | 16 +- 5 files changed, 227 insertions(+), 242 deletions(-) diff --git a/app/Http/Livewire/Upgrade.php b/app/Http/Livewire/Upgrade.php index 5b6b5db3f..8bd647f1d 100644 --- a/app/Http/Livewire/Upgrade.php +++ b/app/Http/Livewire/Upgrade.php @@ -40,4 +40,4 @@ class Upgrade extends Component return general_error_handler(err: $e, that: $this); } } -} +} \ No newline at end of file diff --git a/resources/css/app.css b/resources/css/app.css index 1ed610d1c..b788c6e6d 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -3,32 +3,32 @@ @tailwind utilities; .scrollbar { - @apply scrollbar-thumb-coollabs-100 scrollbar-track-coolgray-200 scrollbar-w-1; + @apply scrollbar-thumb-coollabs-100 scrollbar-track-coolgray-200 scrollbar-w-2; } html { @apply text-neutral-400; } body { - @apply scrollbar antialiased text-sm; + @apply text-sm antialiased scrollbar; } .main { - @apply pl-24 pr-10 mx-auto max-w-screen-xl pt-4; + @apply max-w-screen-xl pt-4 pl-24 pr-10 mx-auto; } input { - @apply input input-sm h-7 outline-none placeholder:text-neutral-700 text-white rounded bg-coolgray-200 w-full read-only:bg-coolgray-200/50 read-only:text-opacity-25; + @apply w-full text-white rounded outline-none input input-sm h-7 placeholder:text-neutral-700 bg-coolgray-200 read-only:bg-coolgray-200/50 read-only:text-opacity-25; } input:not(input[type="checkbox"]) { @apply border-none disabled:border-none; } input[type="checkbox"] { - @apply toggle toggle-warning toggle-xs rounded disabled:toggle-warning; + @apply rounded toggle toggle-warning toggle-xs disabled:toggle-warning; } textarea { - @apply textarea read-only:bg-coolgray-200/50 disabled:border-none read-only:text-opacity-25 placeholder:text-neutral-700 text-white rounded scrollbar bg-coolgray-200 leading-5 text-xs; + @apply text-xs leading-5 text-white rounded textarea read-only:bg-coolgray-200/50 disabled:border-none read-only:text-opacity-25 placeholder:text-neutral-700 scrollbar bg-coolgray-200; } select { - @apply h-7 select select-xs disabled:bg-coolgray-200 border-none disabled:opacity-50 font-normal placeholder:text-neutral-700 text-white rounded bg-coolgray-200; + @apply font-normal text-white border-none rounded h-7 select select-xs disabled:bg-coolgray-200 disabled:opacity-50 placeholder:text-neutral-700 bg-coolgray-200; } .label-text, label { @@ -43,7 +43,7 @@ button[isWarning] { @apply bg-red-600 hover:bg-red-500; } button[isHighlighted] { - @apply btn-primary text-white; + @apply text-white btn-primary; } h1 { @apply text-3xl font-bold text-white; @@ -61,7 +61,7 @@ a { @apply text-neutral-400 hover:text-white link link-hover hover:bg-transparent; } .kbd-custom { - @apply px-2 text-xs border border-dashed rounded border-neutral-700 text-warning; + @apply px-2 text-xs border border-dashed rounded border-neutral-700 text-warning; } .icon { @apply w-6 h-6; @@ -70,7 +70,7 @@ a { @apply text-white; } .box { - @apply flex items-center justify-center rounded min-h-12 bg-coolgray-200 hover:bg-coollabs-100 hover:text-white p-2 hover:no-underline transition-colors; + @apply flex items-center justify-center p-2 transition-colors rounded min-h-12 bg-coolgray-200 hover:bg-coollabs-100 hover:text-white hover:no-underline; } .lds-heart { @@ -124,5 +124,5 @@ tr td { @apply px-3 py-4 whitespace-nowrap; } tr td:first-child { - @apply pl-4 pr-3 sm:pl-6 font-bold; + @apply pl-4 pr-3 font-bold sm:pl-6; } diff --git a/resources/views/components/layout.blade.php b/resources/views/components/layout.blade.php index 5d6f10796..36668c6a2 100644 --- a/resources/views/components/layout.blade.php +++ b/resources/views/components/layout.blade.php @@ -17,9 +17,9 @@ @vite(['resources/js/app.js', 'resources/css/app.css']) @livewireStyles @@ -27,107 +27,107 @@ @livewireScripts @auth - - -
- -
-
- {{ $slot }} -
- - + function copyToClipboard(text) { + navigator.clipboard.writeText(text); + Livewire.emit('message', 'Copied to clipboard.'); + } + Livewire.on('reloadWindow', () => { + window.location.reload(); + }) + Livewire.on('info', (message) => { + if (message) Toaster.info(message) + }) + Livewire.on('error', (message) => { + if (message) Toaster.error(message) + }) + Livewire.on('warning', (message) => { + if (message) Toaster.warning(message) + }) + Livewire.on('success', (message) => { + if (message) Toaster.success(message) + }) + @endauth @guest - {{ $slot }} + {{ $slot }} @endguest - + \ No newline at end of file diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php index 257589db7..d4ce26fda 100644 --- a/resources/views/components/navbar.blade.php +++ b/resources/views/components/navbar.blade.php @@ -1,137 +1,110 @@ @auth - +@endauth \ No newline at end of file diff --git a/resources/views/livewire/upgrade.blade.php b/resources/views/livewire/upgrade.blade.php index 3d9b76d9c..9738a9cfb 100644 --- a/resources/views/livewire/upgrade.blade.php +++ b/resources/views/livewire/upgrade.blade.php @@ -1,4 +1,4 @@ -
  • +
  • @if ($isUpgradeAvailable) -
  • + @else + @endif From 4f98cef7cbcb39cc96fcaa72b512531f960ade40 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 5 Jul 2023 22:10:10 +0200 Subject: [PATCH 06/18] fix: deployment key based works --- app/Jobs/ApplicationDeploymentJob.php | 4 ++-- app/Models/Application.php | 5 ++++- database/seeders/ServerSeeder.php | 2 +- database/seeders/ServerSettingSeeder.php | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 18b7dc6d1..05fa56ef2 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -566,7 +566,7 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory} if ($this->pull_request_id !== 0) { $pr_branch_name = "pr-{$this->pull_request_id}-coolify"; } - + if ($this->application->deploymentType() === 'source') { $source_html_url = data_get($this->application, 'source.html_url'); $url = parse_url(filter_var($source_html_url, FILTER_SANITIZE_URL)); @@ -619,4 +619,4 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory} ); $this->commit = $this->saved_outputs->get('git_commit_sha'); } -} +} \ No newline at end of file diff --git a/app/Models/Application.php b/app/Models/Application.php index 77bf0a5fb..f56a55f79 100644 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -195,6 +195,9 @@ class Application extends BaseModel } public function deploymentType() { + if (data_get($this, 'private_key_id')) { + return 'deploy_key'; + } if (data_get($this, 'source')) { return 'source'; } @@ -203,4 +206,4 @@ class Application extends BaseModel } throw new \Exception('No deployment type found'); } -} +} \ No newline at end of file diff --git a/database/seeders/ServerSeeder.php b/database/seeders/ServerSeeder.php index 10a4a9c1d..927cee11c 100644 --- a/database/seeders/ServerSeeder.php +++ b/database/seeders/ServerSeeder.php @@ -38,4 +38,4 @@ class ServerSeeder extends Seeder 'private_key_id' => $private_key_1->id ]); } -} +} \ No newline at end of file diff --git a/database/seeders/ServerSettingSeeder.php b/database/seeders/ServerSettingSeeder.php index a4c0ac2ad..f2d8c9b49 100644 --- a/database/seeders/ServerSettingSeeder.php +++ b/database/seeders/ServerSettingSeeder.php @@ -14,6 +14,7 @@ class ServerSettingSeeder extends Seeder public function run(): void { $server_2 = Server::find(0)->load(['settings']); + $server_2->settings->wildcard_domain = 'http://127.0.0.1.sslip.io'; $server_2->settings->is_build_server = true; $server_2->settings->is_reachable = true; $server_2->settings->save(); @@ -23,4 +24,4 @@ class ServerSettingSeeder extends Seeder $server_3->settings->is_reachable = false; $server_3->settings->save(); } -} +} \ No newline at end of file From 37d645c00e11e76f3d368a8e3e15c29f6c7af90a Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 6 Jul 2023 08:27:22 +0200 Subject: [PATCH 07/18] fix: deployment cancel/debug buttons --- app/Http/Livewire/Project/Application/DeploymentNavbar.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Livewire/Project/Application/DeploymentNavbar.php b/app/Http/Livewire/Project/Application/DeploymentNavbar.php index 4f2e61851..412f15956 100644 --- a/app/Http/Livewire/Project/Application/DeploymentNavbar.php +++ b/app/Http/Livewire/Project/Application/DeploymentNavbar.php @@ -16,8 +16,8 @@ class DeploymentNavbar extends Component protected $listeners = ['deploymentFinished']; public ApplicationDeploymentQueue $application_deployment_queue; - private Application $application; - private Server $server; + public Application $application; + public Server $server; public bool $is_debug_enabled = false; public function mount() @@ -66,4 +66,4 @@ class DeploymentNavbar extends Component return general_error_handler(err: $e, that: $this); } } -} +} \ No newline at end of file From a9e3b2f62500cb42a3133ed2bcf9f76796261853 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 6 Jul 2023 08:45:28 +0200 Subject: [PATCH 08/18] fix: upgrade button --- resources/views/components/navbar.blade.php | 4 ++-- resources/views/livewire/upgrade.blade.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php index d4ce26fda..3848599c0 100644 --- a/resources/views/components/navbar.blade.php +++ b/resources/views/components/navbar.blade.php @@ -1,6 +1,6 @@ @auth