From 8168b564eaac38455afec28a8e68d060f200aea8 Mon Sep 17 00:00:00 2001 From: Eric Dahl Date: Tue, 20 Aug 2024 19:09:05 -0400 Subject: [PATCH 01/61] adding browserless service --- public/svgs/browserless.svg | 1 + templates/compose/browserless.yaml | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 public/svgs/browserless.svg create mode 100644 templates/compose/browserless.yaml diff --git a/public/svgs/browserless.svg b/public/svgs/browserless.svg new file mode 100644 index 000000000..1d2d09a23 --- /dev/null +++ b/public/svgs/browserless.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/templates/compose/browserless.yaml b/templates/compose/browserless.yaml new file mode 100644 index 000000000..e9d71964f --- /dev/null +++ b/templates/compose/browserless.yaml @@ -0,0 +1,17 @@ +# documentation: https://docs.browserless.io/ +# slogan: A headless Chrome browser as a service . +# tags: chrome,headless,browser,service +# logo: svgs/browserless.svg +# port: 3000 + +services: + browserless: + image: ghcr.io/browserless/chromium + environment: + - TOKEN=$SERVICE_BASE64_BROWSERLESS_TOKEN + - SERVICE_FQDN_BROWSERLESS_3000 + healthcheck: + test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"] + interval: 2s + timeout: 10s + retries: 15 From b73db2d7250c439cd507e2bf34e25c90c5485cac Mon Sep 17 00:00:00 2001 From: Eric Dahl Date: Tue, 20 Aug 2024 19:17:00 -0400 Subject: [PATCH 02/61] Update browserless.yaml --- templates/compose/browserless.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/compose/browserless.yaml b/templates/compose/browserless.yaml index e9d71964f..7534e1ca9 100644 --- a/templates/compose/browserless.yaml +++ b/templates/compose/browserless.yaml @@ -11,7 +11,7 @@ services: - TOKEN=$SERVICE_BASE64_BROWSERLESS_TOKEN - SERVICE_FQDN_BROWSERLESS_3000 healthcheck: - test: ["CMD", "curl", "-f", "http://127.0.0.1:3000"] + test: ["CMD", "curl", "-f", "http://127.0.0.1:3000/docs"] interval: 2s timeout: 10s retries: 15 From a26bc65137c5d0a75cee7b7a236a9a9b8a766fd0 Mon Sep 17 00:00:00 2001 From: Franck Kerbiriou Date: Thu, 22 Aug 2024 22:42:56 +0200 Subject: [PATCH 03/61] Add Plunk template --- public/svgs/plunk.svg | 1 + templates/compose/plunk.yaml | 59 ++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 public/svgs/plunk.svg create mode 100644 templates/compose/plunk.yaml diff --git a/public/svgs/plunk.svg b/public/svgs/plunk.svg new file mode 100644 index 000000000..3f6ed4792 --- /dev/null +++ b/public/svgs/plunk.svg @@ -0,0 +1 @@ + diff --git a/templates/compose/plunk.yaml b/templates/compose/plunk.yaml new file mode 100644 index 000000000..9c5f450c9 --- /dev/null +++ b/templates/compose/plunk.yaml @@ -0,0 +1,59 @@ +# documentation: https://docs.useplunk.com +# slogan: Plunk, The Open-Source Email Platform for AWS +# tags: plunk,email,automation,aws +# logo: svgs/plunk.png +# port: 3000 + +version: '3' +services: + plunk: + image: driaug/plunk + depends_on: + postgresql: + condition: service_healthy + redis: + condition: service_started + environment: + - SERVICE_FQDN_PLUNK_3000 + - REDIS_URL=redis://redis:6379 + - DATABASE_URL=postgresql://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgresql/docmost?schema=public + - JWT_SECRET=${SERVICE_PASSWORD_JWT_SECRET} + - AWS_REGION=${AWS_REGION} + - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} + - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} + - AWS_SES_CONFIGURATION_SET=${AWS_SES_CONFIGURATION_SET} + - NEXT_PUBLIC_API_URI=${SERVICE_FQDN_PLUNK}/api + - APP_URI=${SERVICE_FQDN_PLUNK} + - API_URI=${SERVICE_FQDN_PLUNK}/api + - DISABLE_SIGNUPS=False + entrypoint: [ "/app/entry.sh" ] + healthcheck: + test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:3000"] + interval: 2s + timeout: 10s + retries: 15 + postgresql: + image: postgres:16-alpine + environment: + - POSTGRES_USER=$SERVICE_USER_POSTGRES + - POSTGRES_PASSWORD=$SERVICE_PASSWORD_POSTGRES + - POSTGRES_DB=${POSTGRES_DB:-plunk} + volumes: + - postgresql-data:/var/lib/postgresql/data + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U postgres -d postgres" ] + interval: 5s + timeout: 10s + retries: 20 + redis: + image: "redis:7.4-alpine" + volumes: + - "redis-data:/data" + healthcheck: + test: + - CMD + - redis-cli + - PING + interval: 5s + timeout: 10s + retries: 20 From fe477ba3256ba9e5774ee63a49d802a43feef163 Mon Sep 17 00:00:00 2001 From: Vahor Date: Thu, 29 Aug 2024 22:46:00 +0200 Subject: [PATCH 04/61] add server name in execute command container options --- .../project/shared/execute-container-command.blade.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/views/livewire/project/shared/execute-container-command.blade.php b/resources/views/livewire/project/shared/execute-container-command.blade.php index 680d6e0e1..dee6757cb 100644 --- a/resources/views/livewire/project/shared/execute-container-command.blade.php +++ b/resources/views/livewire/project/shared/execute-container-command.blade.php @@ -32,18 +32,18 @@ @if (data_get($this->parameters, 'application_uuid')) @foreach ($containers as $container) @endforeach @elseif(data_get($this->parameters, 'service_uuid')) @foreach ($containers as $container) @endforeach @else @endif From bf475e538c545493ee71827e3aa6016c36c3b3d9 Mon Sep 17 00:00:00 2001 From: Vahor Date: Fri, 30 Aug 2024 17:29:25 +0200 Subject: [PATCH 05/61] don't check logDrain installation if it's not enabled --- app/Jobs/ServerCheckJob.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Jobs/ServerCheckJob.php b/app/Jobs/ServerCheckJob.php index 703b199c5..3dbd9d3a7 100644 --- a/app/Jobs/ServerCheckJob.php +++ b/app/Jobs/ServerCheckJob.php @@ -124,6 +124,9 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue private function checkLogDrainContainer() { + if(! $this->server->isLogDrainEnabled()) { + return; + } $foundLogDrainContainer = $this->containers->filter(function ($value, $key) { return data_get($value, 'Name') === '/coolify-log-drain'; })->first(); From f072823f008b6a871b667215f61e7e33cb69cbe3 Mon Sep 17 00:00:00 2001 From: Tim Koch Date: Sun, 1 Sep 2024 22:01:05 +0200 Subject: [PATCH 06/61] fix: Deployment running for - without "ago" --- .../livewire/project/application/deployment/index.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/livewire/project/application/deployment/index.blade.php b/resources/views/livewire/project/application/deployment/index.blade.php index 001499b71..12c453e02 100644 --- a/resources/views/livewire/project/application/deployment/index.blade.php +++ b/resources/views/livewire/project/application/deployment/index.blade.php @@ -106,7 +106,7 @@
@if ($deployment->status !== 'in_progress') - Finished 0s in + Finished 0s ago in 0s @else Running for 0s @@ -157,7 +157,7 @@ } }, measure_since_started() { - return dayjs.utc(created_at).fromNow(); + return dayjs.utc(created_at).fromNow(true); // "true" prevents the "ago" suffix }, })) From ae4c889fa281f45254836596a8daee5ba9d36ba2 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 2 Sep 2024 11:05:58 +0200 Subject: [PATCH 07/61] Fix API documentation for project creation endpoint --- app/Http/Controllers/Api/ProjectController.php | 2 +- openapi.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/ProjectController.php b/app/Http/Controllers/Api/ProjectController.php index 6aec31e9b..61bfe2976 100644 --- a/app/Http/Controllers/Api/ProjectController.php +++ b/app/Http/Controllers/Api/ProjectController.php @@ -167,7 +167,7 @@ class ProjectController extends Controller schema: new OA\Schema( type: 'object', properties: [ - 'uuid' => ['type' => 'string', 'description' => 'The name of the project.'], + 'name' => ['type' => 'string', 'description' => 'The name of the project.'], 'description' => ['type' => 'string', 'description' => 'The description of the project.'], ], ), diff --git a/openapi.yaml b/openapi.yaml index 482ff6f05..4d2f4d80b 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -3024,7 +3024,7 @@ paths: application/json: schema: properties: - uuid: + name: type: string description: 'The name of the project.' description: From 08a80876f951605792c3d16531a080d81c2ced5b Mon Sep 17 00:00:00 2001 From: Matt Stein Date: Mon, 2 Sep 2024 19:43:16 -0700 Subject: [PATCH 08/61] Fix language in helper messages. --- .../livewire/project/shared/scheduled-task/add.blade.php | 2 +- .../livewire/project/shared/scheduled-task/show.blade.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/views/livewire/project/shared/scheduled-task/add.blade.php b/resources/views/livewire/project/shared/scheduled-task/add.blade.php index 24b89c519..0459f2f6b 100644 --- a/resources/views/livewire/project/shared/scheduled-task/add.blade.php +++ b/resources/views/livewire/project/shared/scheduled-task/add.blade.php @@ -13,7 +13,7 @@ @else + helper="You can leave this empty if your resource only has one container." label="Container name" /> @endif @elseif ($type === 'service') diff --git a/resources/views/livewire/project/shared/scheduled-task/show.blade.php b/resources/views/livewire/project/shared/scheduled-task/show.blade.php index 125a431a4..dd5ca68de 100644 --- a/resources/views/livewire/project/shared/scheduled-task/show.blade.php +++ b/resources/views/livewire/project/shared/scheduled-task/show.blade.php @@ -30,11 +30,11 @@ @if ($type === 'application') @elseif ($type === 'service') @endif
From 63a07e7649a828557c6bccad2a2b50483abe1442 Mon Sep 17 00:00:00 2001 From: mahansky Date: Tue, 3 Sep 2024 20:06:03 +0200 Subject: [PATCH 09/61] deployment log improvements --- .../Project/Application/Deployment/Show.php | 20 ++++ bootstrap/helpers/remoteProcess.php | 32 ++++- .../application/deployment/show.blade.php | 111 +++++++++--------- 3 files changed, 108 insertions(+), 55 deletions(-) diff --git a/app/Livewire/Project/Application/Deployment/Show.php b/app/Livewire/Project/Application/Deployment/Show.php index 84a24255c..4b2904594 100644 --- a/app/Livewire/Project/Application/Deployment/Show.php +++ b/app/Livewire/Project/Application/Deployment/Show.php @@ -4,6 +4,7 @@ namespace App\Livewire\Project\Application\Deployment; use App\Models\Application; use App\Models\ApplicationDeploymentQueue; +use Illuminate\Support\Collection; use Livewire\Component; class Show extends Component @@ -12,6 +13,8 @@ class Show extends Component public ApplicationDeploymentQueue $application_deployment_queue; + public Collection $logLines; + public string $deployment_uuid; public $isKeepAliveOn = true; @@ -53,11 +56,13 @@ class Show extends Component $this->application = $application; $this->application_deployment_queue = $application_deployment_queue; $this->deployment_uuid = $deploymentUuid; + $this->buildLogLines(); } public function refreshQueue() { $this->application_deployment_queue->refresh(); + $this->buildLogLines(); } public function polling() @@ -67,10 +72,25 @@ class Show extends Component if (data_get($this->application_deployment_queue, 'status') == 'finished' || data_get($this->application_deployment_queue, 'status') == 'failed') { $this->isKeepAliveOn = false; } + $this->buildLogLines(); } public function render() { return view('livewire.project.application.deployment.show'); } + + private function buildLogLines() + { + $this->logLines = decode_remote_command_output($this->application_deployment_queue)->map(function ($logLine) { + $logLine['line'] = e($logLine['line']); + $logLine['line'] = preg_replace( + '/(https?:\/\/[^\s]+)/', + '$1', + $logLine['line'], + ); + + return $logLine; + }); + } } diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.php index 6ba7caeef..c3f8316e7 100644 --- a/bootstrap/helpers/remoteProcess.php +++ b/bootstrap/helpers/remoteProcess.php @@ -234,6 +234,7 @@ function decode_remote_command_output(?ApplicationDeploymentQueue $application_d return collect([]); } // ray($decoded ); + $seenCommands = collect(); $formatted = collect($decoded); if (! $is_debug_enabled) { $formatted = $formatted->filter(fn ($i) => $i['hidden'] === false ?? false); @@ -244,7 +245,36 @@ function decode_remote_command_output(?ApplicationDeploymentQueue $application_d data_set($i, 'timestamp', Carbon::parse(data_get($i, 'timestamp'))->format('Y-M-d H:i:s.u')); return $i; - }); + }) + ->reduce(function ($deploymentLogLines, $logItem) use ($seenCommands) { + $command = $logItem['command']; + $isStderr = $logItem['type'] === 'stderr'; + + if (! is_null($command) && ! $seenCommands->contains($command)) { + $deploymentLogLines->push([ + 'line' => $command, + 'timestamp' => $logItem['timestamp'], + 'stderr' => $isStderr, + 'hidden' => $logItem['hidden'], + 'command' => true, + ]); + + $seenCommands->push($command); + } + + $lines = explode(PHP_EOL, $logItem['output']); + + foreach ($lines as $line) { + $deploymentLogLines->push([ + 'line' => $line, + 'timestamp' => $logItem['timestamp'], + 'stderr' => $isStderr, + 'hidden' => $logItem['hidden'], + ]); + } + + return $deploymentLogLines; + }, collect()); return $formatted; } diff --git a/resources/views/livewire/project/application/deployment/show.blade.php b/resources/views/livewire/project/application/deployment/show.blade.php index f97914ec2..bc8ab3f34 100644 --- a/resources/views/livewire/project/application/deployment/show.blade.php +++ b/resources/views/livewire/project/application/deployment/show.blade.php @@ -9,6 +9,7 @@ fullscreen: false, alwaysScroll: false, intervalId: null, + showTimestamps: false, makeFullscreen() { this.fullscreen = !this.fullscreen; if (this.fullscreen === false) { @@ -53,63 +54,65 @@ class="dark:text-warning">{{ Str::headline(data_get($application_deployment_queue, 'status')) }}.
@endif -
+
- - - + class="flex flex-col-reverse w-full p-2 px-4 mt-4 overflow-y-auto bg-white dark:text-white dark:bg-coolgray-100 scrollbar dark:border-coolgray-300" + :class="fullscreen ? '' : 'min-h-14 max-h-[40rem] border border-dotted rounded'" + > +
+
+ + + + + +
+
-
- @if (decode_remote_command_output($application_deployment_queue)->count() > 0) - @foreach (decode_remote_command_output($application_deployment_queue) as $line) - $line['hidden'], - 'text-red-500 font-bold whitespace-pre-line' => $line['type'] == 'stderr', - ])>[{{ $line['timestamp'] }}] @if ($line['hidden']) -

[COMMAND] {{ $line['command'] }}
[OUTPUT] - @endif @if (str($line['output'])->contains('http://') || str($line['output'])->contains('https://')) - @php - $line['output'] = preg_replace( - '/(https?:\/\/[^\s]+)/', - '$1', - $line['output'], - ); - @endphp {!! $line['output'] !!} - @else - {{ $line['output'] }} - - @endif -
- @endforeach - @else - No logs yet. - @endif + @forelse ($logLines as $line) +
$line['command'] ?? false, + 'flex gap-2 dark:hover:bg-coolgray-500 hover:bg-gray-100' + ]) + > + {{ $line['timestamp'] }} + $line['hidden'], + 'text-red-500' => $line['stderr'], + 'font-bold' => $line['command'] ?? false, + 'whitespace-pre-wrap', + ]) + >{!! $line['line'] !!} +
+ @empty + No logs yet. + @endforelse
From cadb12986c650c31534c793edc35f2cadf6242ac Mon Sep 17 00:00:00 2001 From: Vahor Date: Tue, 3 Sep 2024 17:35:18 +0200 Subject: [PATCH 10/61] fix: wrong executions order --- app/Models/ScheduledDatabaseBackup.php | 3 ++- app/Models/ScheduledTask.php | 1 + .../livewire/project/database/backup-executions.blade.php | 2 +- .../project/shared/scheduled-task/executions.blade.php | 4 ++-- .../livewire/project/shared/scheduled-task/show.blade.php | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Models/ScheduledDatabaseBackup.php b/app/Models/ScheduledDatabaseBackup.php index 2d0e200da..50a0c8173 100644 --- a/app/Models/ScheduledDatabaseBackup.php +++ b/app/Models/ScheduledDatabaseBackup.php @@ -22,7 +22,8 @@ class ScheduledDatabaseBackup extends BaseModel public function executions(): HasMany { - return $this->hasMany(ScheduledDatabaseBackupExecution::class); + // Last execution first + return $this->hasMany(ScheduledDatabaseBackupExecution::class)->orderBy('created_at', 'desc'); } public function s3() diff --git a/app/Models/ScheduledTask.php b/app/Models/ScheduledTask.php index 7b1c0d275..82f0036a5 100644 --- a/app/Models/ScheduledTask.php +++ b/app/Models/ScheduledTask.php @@ -28,6 +28,7 @@ class ScheduledTask extends BaseModel public function executions(): HasMany { + // Last execution first return $this->hasMany(ScheduledTaskExecution::class)->orderBy('created_at', 'desc'); } diff --git a/resources/views/livewire/project/database/backup-executions.blade.php b/resources/views/livewire/project/database/backup-executions.blade.php index 6d177505c..fd444b50a 100644 --- a/resources/views/livewire/project/database/backup-executions.blade.php +++ b/resources/views/livewire/project/database/backup-executions.blade.php @@ -4,7 +4,7 @@

Executions

Cleanup Failed Backups
-
+
@forelse($executions as $execution)
+
@forelse($executions as $execution) @if (data_get($execution, 'id') == $selectedKey)
@@ -33,4 +33,4 @@ @empty
No executions found.
@endforelse -
\ No newline at end of file +
diff --git a/resources/views/livewire/project/shared/scheduled-task/show.blade.php b/resources/views/livewire/project/shared/scheduled-task/show.blade.php index 125a431a4..789065d71 100644 --- a/resources/views/livewire/project/shared/scheduled-task/show.blade.php +++ b/resources/views/livewire/project/shared/scheduled-task/show.blade.php @@ -42,6 +42,6 @@

Recent executions (click to check output)

- +
From b0039885eb128d5bab116cb3f50651b749ae2a8c Mon Sep 17 00:00:00 2001 From: mahansky Date: Wed, 4 Sep 2024 03:39:50 +0200 Subject: [PATCH 11/61] use computed property --- .../Project/Application/Deployment/Show.php | 19 +++++++------------ .../application/deployment/show.blade.php | 2 +- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/app/Livewire/Project/Application/Deployment/Show.php b/app/Livewire/Project/Application/Deployment/Show.php index 4b2904594..f2968f6d9 100644 --- a/app/Livewire/Project/Application/Deployment/Show.php +++ b/app/Livewire/Project/Application/Deployment/Show.php @@ -13,8 +13,6 @@ class Show extends Component public ApplicationDeploymentQueue $application_deployment_queue; - public Collection $logLines; - public string $deployment_uuid; public $isKeepAliveOn = true; @@ -56,13 +54,11 @@ class Show extends Component $this->application = $application; $this->application_deployment_queue = $application_deployment_queue; $this->deployment_uuid = $deploymentUuid; - $this->buildLogLines(); } public function refreshQueue() { $this->application_deployment_queue->refresh(); - $this->buildLogLines(); } public function polling() @@ -72,17 +68,11 @@ class Show extends Component if (data_get($this->application_deployment_queue, 'status') == 'finished' || data_get($this->application_deployment_queue, 'status') == 'failed') { $this->isKeepAliveOn = false; } - $this->buildLogLines(); } - public function render() + public function getLogLinesProperty() { - return view('livewire.project.application.deployment.show'); - } - - private function buildLogLines() - { - $this->logLines = decode_remote_command_output($this->application_deployment_queue)->map(function ($logLine) { + return decode_remote_command_output($this->application_deployment_queue)->map(function ($logLine) { $logLine['line'] = e($logLine['line']); $logLine['line'] = preg_replace( '/(https?:\/\/[^\s]+)/', @@ -93,4 +83,9 @@ class Show extends Component return $logLine; }); } + + public function render() + { + return view('livewire.project.application.deployment.show'); + } } diff --git a/resources/views/livewire/project/application/deployment/show.blade.php b/resources/views/livewire/project/application/deployment/show.blade.php index bc8ab3f34..5ba0be0a2 100644 --- a/resources/views/livewire/project/application/deployment/show.blade.php +++ b/resources/views/livewire/project/application/deployment/show.blade.php @@ -93,7 +93,7 @@
- @forelse ($logLines as $line) + @forelse ($this->logLines as $line)
$line['command'] ?? false, From 3b533c7d065e66c2ed222d3bb7da935aa180ce8c Mon Sep 17 00:00:00 2001 From: mahansky Date: Wed, 4 Sep 2024 13:57:03 +0200 Subject: [PATCH 12/61] fix same commands different batch --- bootstrap/helpers/remoteProcess.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.php index c3f8316e7..cccc41e71 100644 --- a/bootstrap/helpers/remoteProcess.php +++ b/bootstrap/helpers/remoteProcess.php @@ -249,8 +249,11 @@ function decode_remote_command_output(?ApplicationDeploymentQueue $application_d ->reduce(function ($deploymentLogLines, $logItem) use ($seenCommands) { $command = $logItem['command']; $isStderr = $logItem['type'] === 'stderr'; + $isNewCommand = ! is_null($command) && ! $seenCommands->first(function ($seenCommand) use ($logItem) { + return $seenCommand['command'] === $logItem['command'] && $seenCommand['batch'] === $logItem['batch']; + }); - if (! is_null($command) && ! $seenCommands->contains($command)) { + if ($isNewCommand) { $deploymentLogLines->push([ 'line' => $command, 'timestamp' => $logItem['timestamp'], @@ -259,7 +262,10 @@ function decode_remote_command_output(?ApplicationDeploymentQueue $application_d 'command' => true, ]); - $seenCommands->push($command); + $seenCommands->push([ + 'command' => $command, + 'batch' => $logItem['batch'], + ]); } $lines = explode(PHP_EOL, $logItem['output']); From 9c2f4ec04e6930e6a0f8d24a7fd0de2b606b7c4a Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 4 Sep 2024 16:55:25 +0200 Subject: [PATCH 13/61] Update version to 4.0.0-beta.330 --- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/sentry.php b/config/sentry.php index 6d59954e0..84d1a8708 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.329', + 'release' => '4.0.0-beta.330', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index 7cbe1f681..58ac0af61 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Wed, 4 Sep 2024 16:55:29 +0200 Subject: [PATCH 14/61] chore: Update sponsor links in README.md --- README.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 05f2e2b3c..c3412be14 100644 --- a/README.md +++ b/README.md @@ -39,27 +39,27 @@ Special thanks to our biggest sponsors! ![image](https://github.com/user-attachments/assets/c95a07df-7c5a-4e77-a35a-81f25fcbece1) -* [CCCareers](https://cccareers.org/) - A career development platform for coding bootcamp graduates. -* [Hetzner](http://htznr.li/CoolifyXHetzner) - A German web hosting company offering dedicated servers and cloud services. -* [Logto](https://logto.io/?ref=coolify) - An open-source authentication and authorization platform. -* [BC Direct](https://bc.direct/?ref=coolify.io) - A digital marketing agency specializing in e-commerce solutions. -* [QuantCDN](https://www.quantcdn.io/?ref=coolify.io) - A content delivery network (CDN) for fast content delivery. -* [Arcjet](https://arcjet.com/?ref=coolify.io) - A cloud-based platform for data analytics and visualization. -* [SupaGuide](https://supa.guide/?ref=coolify.io) - A platform offering guides and resources for web development and design. -* [Tigris](https://tigrisdata.com/?ref=coolify.io) - A data integration platform for connecting and managing data sources. -* [Fractal Networks](https://fractalnetworks.co/?ref=coolify.io) - A decentralized network infrastructure for secure data exchange. -* [Advin](https://coolify.ad.vin/?ref=coolify.io) - A digital advertising agency specializing in programmatic advertising. -* [Treive](https://trieve.ai/?ref=coolify.io) - An AI-powered data analytics platform for business insights. -* [Blacksmith](https://blacksmith.sh/?ref=coolify.io) - A cloud-based platform for automating DevOps and infrastructure management. -* [Latitude](https://latitude.sh/?ref=coolify.io) - A platform offering location-based services and geospatial data. -* [Brand Dev](https://brand.dev/?ref=coolify.io) - A web development agency specializing in brand identity and digital presence. -* [Jobscollider](https://jobscollider.com/remote-jobs?ref=coolify.io) - A job search platform specializing in remote and flexible work opportunities. -* [Hostinger](https://hostinger.com?ref=coolify.io) - A web hosting company offering shared, VPS, and cloud hosting services. -* [Glueops](https://www.glueops.dev/?ref=coolify.io) - A DevOps and cloud consulting company offering infrastructure automation services. -* [Ubicloud](https://ubicloud.com/?ref=coolify.io) - A cloud-based platform for IoT device management and data analytics. -* [Juxtdigital](https://juxtdigital.dev/?ref=coolify.io) - A digital agency offering web development, design, and marketing services. -* [Saasykit](https://saasykit.com/?ref=coolify.io) - SaaSykit is a Laravel-based boilerplate with everything you need to build an awesome SaaS. -* [Massivegrid](https://massivegrid.com/?ref=coolify.io) - A cloud-based platform for data storage and processing. +* [CCCareers](https://cccareers.org/) - A career development platform connecting coding bootcamp graduates with job opportunities in the tech industry. +* [Hetzner](http://htznr.li/CoolifyXHetzner) - A German web hosting company offering affordable dedicated servers, cloud services, and web hosting solutions. +* [Logto](https://logto.io/?ref=coolify) - An open-source authentication and authorization solution for building secure login systems and managing user identities. +* [BC Direct](https://bc.direct/?ref=coolify.io) - A digital marketing agency specializing in e-commerce solutions and online business growth strategies. +* [QuantCDN](https://www.quantcdn.io/?ref=coolify.io) - A content delivery network (CDN) optimizing website performance through global content distribution. +* [Arcjet](https://arcjet.com/?ref=coolify.io) - A cloud-based platform providing real-time protection against API abuse and bot attacks. +* [SupaGuide](https://supa.guide/?ref=coolify.io) - A comprehensive resource hub offering guides and tutorials for web development using Supabase. +* [Tigris](https://tigrisdata.com/?ref=coolify.io) - A fully managed serverless object storage service compatible with Amazon S3 API. Offers high performance, scalability, and built-in search capabilities for efficient data management. +* [Fractal Networks](https://fractalnetworks.co/?ref=coolify.io) - A decentralized network infrastructure company focusing on secure and private communication solutions. +* [Advin](https://coolify.ad.vin/?ref=coolify.io) - A digital advertising agency specializing in programmatic advertising and data-driven marketing strategies. +* [Treive](https://trieve.ai/?ref=coolify.io) - An AI-powered search and discovery platform for enhancing information retrieval in large datasets. +* [Blacksmith](https://blacksmith.sh/?ref=coolify.io) - A cloud-native platform for automating infrastructure provisioning and management across multiple cloud providers. +* [Latitude](https://latitude.sh/?ref=coolify.io) - A cloud computing platform offering bare metal servers and cloud instances for developers and businesses. +* [Brand Dev](https://brand.dev/?ref=coolify.io) - A web development agency specializing in creating custom digital experiences and brand identities. +* [Jobscollider](https://jobscollider.com/remote-jobs?ref=coolify.io) - A job search platform connecting professionals with remote work opportunities across various industries. +* [Hostinger](https://hostinger.com?ref=coolify.io) - A web hosting provider offering affordable hosting solutions, domain registration, and website building tools. +* [Glueops](https://www.glueops.dev/?ref=coolify.io) - A DevOps consulting company providing infrastructure automation and cloud optimization services. +* [Ubicloud](https://ubicloud.com/?ref=coolify.io) - An open-source alternative to hyperscale cloud providers, offering high-performance cloud computing services. +* [Juxtdigital](https://juxtdigital.dev/?ref=coolify.io) - A digital agency offering web development, design, and digital marketing services for businesses. +* [Saasykit](https://saasykit.com/?ref=coolify.io) - A Laravel-based boilerplate providing essential components and features for building SaaS applications quickly. +* [Massivegrid](https://massivegrid.com/?ref=coolify.io) - A cloud hosting provider offering scalable infrastructure solutions for businesses of all sizes. ## Github Sponsors ($40+) From 02f950edc7ee6ce01cd62b1638d0bea99f314250 Mon Sep 17 00:00:00 2001 From: Vahor Date: Wed, 4 Sep 2024 19:38:13 +0200 Subject: [PATCH 15/61] fix: pull coolify image only when the app needs to be updated --- app/Actions/Server/UpdateCoolify.php | 3 ++- app/Console/Kernel.php | 4 ++-- ...b.php => FetchLatestCoolifyVersionJob.php} | 19 +------------------ 3 files changed, 5 insertions(+), 21 deletions(-) rename app/Jobs/{PullCoolifyImageJob.php => FetchLatestCoolifyVersionJob.php} (55%) diff --git a/app/Actions/Server/UpdateCoolify.php b/app/Actions/Server/UpdateCoolify.php index 09d6471e8..5648de796 100644 --- a/app/Actions/Server/UpdateCoolify.php +++ b/app/Actions/Server/UpdateCoolify.php @@ -62,10 +62,11 @@ class UpdateCoolify return; } + instant_remote_process(["docker pull -q ghcr.io/coollabsio/coolify:{$this->latestVersion}"], $this->server, false); + remote_process([ 'curl -fsSL https://cdn.coollabs.io/coolify/upgrade.sh -o /data/coolify/source/upgrade.sh', "bash /data/coolify/source/upgrade.sh $this->latestVersion", ], $this->server); - } } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index c2c787be4..2af771d3e 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -6,7 +6,7 @@ use App\Jobs\CheckForUpdatesJob; use App\Jobs\CleanupInstanceStuffsJob; use App\Jobs\DatabaseBackupJob; use App\Jobs\DockerCleanupJob; -use App\Jobs\PullCoolifyImageJob; +use App\Jobs\FetchLatestCoolifyVersionJob; use App\Jobs\PullHelperImageJob; use App\Jobs\PullSentinelImageJob; use App\Jobs\PullTemplatesFromCDN; @@ -44,7 +44,7 @@ class Kernel extends ConsoleKernel // Instance Jobs $schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->command('cleanup:unreachable-servers')->daily()->onOneServer(); - $schedule->job(new PullCoolifyImageJob)->cron($settings->update_check_frequency)->timezone($settings->instance_timezone)->onOneServer(); + $schedule->job(new FetchLatestCoolifyVersionJob)->cron($settings->update_check_frequency)->timezone($settings->instance_timezone)->onOneServer(); $schedule->job(new PullTemplatesFromCDN)->cron($settings->update_check_frequency)->timezone($settings->instance_timezone)->onOneServer(); $schedule->job(new CleanupInstanceStuffsJob)->everyTwoMinutes()->onOneServer(); $this->schedule_updates($schedule); diff --git a/app/Jobs/PullCoolifyImageJob.php b/app/Jobs/FetchLatestCoolifyVersionJob.php similarity index 55% rename from app/Jobs/PullCoolifyImageJob.php rename to app/Jobs/FetchLatestCoolifyVersionJob.php index f0912493f..20cc1c7c7 100644 --- a/app/Jobs/PullCoolifyImageJob.php +++ b/app/Jobs/FetchLatestCoolifyVersionJob.php @@ -2,8 +2,6 @@ namespace App\Jobs; -use App\Models\InstanceSettings; -use App\Models\Server; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldBeEncrypted; use Illuminate\Contracts\Queue\ShouldQueue; @@ -13,7 +11,7 @@ use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Http; -class PullCoolifyImageJob implements ShouldBeEncrypted, ShouldQueue +class FetchLatestCoolifyVersionJob implements ShouldBeEncrypted, ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; @@ -23,26 +21,11 @@ class PullCoolifyImageJob implements ShouldBeEncrypted, ShouldQueue if (isDev() || isCloud()) { return; } - $settings = InstanceSettings::get(); - $server = Server::findOrFail(0); $response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json'); if ($response->successful()) { $versions = $response->json(); File::put(base_path('versions.json'), json_encode($versions, JSON_PRETTY_PRINT)); } - $latest_version = get_latest_version_of_coolify(); - instant_remote_process(["docker pull -q ghcr.io/coollabsio/coolify:{$latest_version}"], $server, false); - - $current_version = config('version'); - if (! $settings->is_auto_update_enabled) { - return; - } - if ($latest_version === $current_version) { - return; - } - if (version_compare($latest_version, $current_version, '<')) { - return; - } } catch (\Throwable $e) { throw $e; } From 0dad77af3307d95798aebd4a8de462c3f2619d08 Mon Sep 17 00:00:00 2001 From: Vahor Date: Wed, 4 Sep 2024 21:09:40 +0200 Subject: [PATCH 16/61] save versions.json during CheckForUpdatesJob --- app/Console/Kernel.php | 2 -- app/Jobs/CheckForUpdatesJob.php | 3 +++ app/Jobs/FetchLatestCoolifyVersionJob.php | 33 ----------------------- 3 files changed, 3 insertions(+), 35 deletions(-) delete mode 100644 app/Jobs/FetchLatestCoolifyVersionJob.php diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 2af771d3e..b20e518b3 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -6,7 +6,6 @@ use App\Jobs\CheckForUpdatesJob; use App\Jobs\CleanupInstanceStuffsJob; use App\Jobs\DatabaseBackupJob; use App\Jobs\DockerCleanupJob; -use App\Jobs\FetchLatestCoolifyVersionJob; use App\Jobs\PullHelperImageJob; use App\Jobs\PullSentinelImageJob; use App\Jobs\PullTemplatesFromCDN; @@ -44,7 +43,6 @@ class Kernel extends ConsoleKernel // Instance Jobs $schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->command('cleanup:unreachable-servers')->daily()->onOneServer(); - $schedule->job(new FetchLatestCoolifyVersionJob)->cron($settings->update_check_frequency)->timezone($settings->instance_timezone)->onOneServer(); $schedule->job(new PullTemplatesFromCDN)->cron($settings->update_check_frequency)->timezone($settings->instance_timezone)->onOneServer(); $schedule->job(new CleanupInstanceStuffsJob)->everyTwoMinutes()->onOneServer(); $this->schedule_updates($schedule); diff --git a/app/Jobs/CheckForUpdatesJob.php b/app/Jobs/CheckForUpdatesJob.php index 86b66fbfb..ddc264839 100644 --- a/app/Jobs/CheckForUpdatesJob.php +++ b/app/Jobs/CheckForUpdatesJob.php @@ -10,6 +10,7 @@ use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Http; +use Illuminate\Support\Facades\File; class CheckForUpdatesJob implements ShouldBeEncrypted, ShouldQueue { @@ -25,12 +26,14 @@ class CheckForUpdatesJob implements ShouldBeEncrypted, ShouldQueue $response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json'); if ($response->successful()) { $versions = $response->json(); + $latest_version = data_get($versions, 'coolify.v4.version'); $current_version = config('version'); if (version_compare($latest_version, $current_version, '>')) { // New version available $settings->update(['new_version_available' => true]); + File::put(base_path('versions.json'), json_encode($versions, JSON_PRETTY_PRINT)); } else { $settings->update(['new_version_available' => false]); } diff --git a/app/Jobs/FetchLatestCoolifyVersionJob.php b/app/Jobs/FetchLatestCoolifyVersionJob.php deleted file mode 100644 index 20cc1c7c7..000000000 --- a/app/Jobs/FetchLatestCoolifyVersionJob.php +++ /dev/null @@ -1,33 +0,0 @@ -get('https://cdn.coollabs.io/coolify/versions.json'); - if ($response->successful()) { - $versions = $response->json(); - File::put(base_path('versions.json'), json_encode($versions, JSON_PRETTY_PRINT)); - } - } catch (\Throwable $e) { - throw $e; - } - } -} From 919657173757521a1fcfb2b2e29a2e3e01091e73 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 09:29:18 +0200 Subject: [PATCH 17/61] test versioned helper image --- .github/workflows/coolify-helper-next.yml | 8 ++++++++ versions.json | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coolify-helper-next.yml b/.github/workflows/coolify-helper-next.yml index d9921b363..540a4f374 100644 --- a/.github/workflows/coolify-helper-next.yml +++ b/.github/workflows/coolify-helper-next.yml @@ -25,6 +25,10 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Get Version + id: version + run: | + echo "VERSION=$(jq -r '.coolify.helper.version' /app/version.json)"|xargs >> $GITHUB_OUTPUT - name: Build image and push to registry uses: docker/build-push-action@v5 with: @@ -47,6 +51,10 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Get Version + id: version + run: | + echo "VERSION=$(jq -r '.coolify.helper.version' /app/version.json)"|xargs >> $GITHUB_OUTPUT - name: Build image and push to registry uses: docker/build-push-action@v5 with: diff --git a/versions.json b/versions.json index a289345ff..560b427ea 100644 --- a/versions.json +++ b/versions.json @@ -5,6 +5,9 @@ }, "nightly": { "version": "4.0.0-beta.331" + }, + "helper": { + "version": "0.0.1" } } -} \ No newline at end of file +} From fae175039a32462cbd410562dcde17b0689c8452 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 09:30:36 +0200 Subject: [PATCH 18/61] chore: Update version.json to versions.json in GitHub workflow --- .github/workflows/coolify-helper-next.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coolify-helper-next.yml b/.github/workflows/coolify-helper-next.yml index 540a4f374..4e51e620b 100644 --- a/.github/workflows/coolify-helper-next.yml +++ b/.github/workflows/coolify-helper-next.yml @@ -28,7 +28,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(jq -r '.coolify.helper.version' /app/version.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(jq -r '.coolify.helper.version' /app/versions.json)"|xargs >> $GITHUB_OUTPUT - name: Build image and push to registry uses: docker/build-push-action@v5 with: @@ -54,7 +54,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(jq -r '.coolify.helper.version' /app/version.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(jq -r '.coolify.helper.version' /app/versions.json)"|xargs >> $GITHUB_OUTPUT - name: Build image and push to registry uses: docker/build-push-action@v5 with: From fbb7568786b0a7fc214b29d7671bfb4e43cabede Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 09:41:29 +0200 Subject: [PATCH 19/61] chore: Cleanup stucked resources and scheduled backups --- app/Console/Commands/CleanupStuckedResources.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/Console/Commands/CleanupStuckedResources.php b/app/Console/Commands/CleanupStuckedResources.php index 0a544d2ff..68beb448a 100644 --- a/app/Console/Commands/CleanupStuckedResources.php +++ b/app/Console/Commands/CleanupStuckedResources.php @@ -4,6 +4,7 @@ namespace App\Console\Commands; use App\Models\Application; use App\Models\ApplicationPreview; +use App\Models\ScheduledDatabaseBackup; use App\Models\ScheduledTask; use App\Models\Service; use App\Models\ServiceApplication; @@ -165,6 +166,18 @@ class CleanupStuckedResources extends Command echo "Error in cleaning stuck scheduledtasks: {$e->getMessage()}\n"; } + try { + $scheduled_backups = ScheduledDatabaseBackup::all(); + foreach ($scheduled_backups as $scheduled_backup) { + if (! $scheduled_backup->server()) { + echo "Deleting stuck scheduledbackup: {$scheduled_backup->name}\n"; + $scheduled_backup->delete(); + } + } + } catch (\Throwable $e) { + echo "Error in cleaning stuck scheduledbackups: {$e->getMessage()}\n"; + } + // Cleanup any resources that are not attached to any environment or destination or server try { $applications = Application::all(); From a8fd7db9a8ead2c4abd3f4b9a980353334d29ebf Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 09:44:48 +0200 Subject: [PATCH 20/61] Update version.json to versions.json in GitHub workflow --- .github/workflows/coolify-helper-next.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coolify-helper-next.yml b/.github/workflows/coolify-helper-next.yml index 4e51e620b..5010c5546 100644 --- a/.github/workflows/coolify-helper-next.yml +++ b/.github/workflows/coolify-helper-next.yml @@ -28,7 +28,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(jq -r '.coolify.helper.version' /app/versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT - name: Build image and push to registry uses: docker/build-push-action@v5 with: From a725ff0a75c01b1c21c835e9777e61ee06a91db7 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 09:51:02 +0200 Subject: [PATCH 21/61] chore: Update GitHub workflow to use versions.json instead of version.json --- .github/workflows/coolify-helper-next.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coolify-helper-next.yml b/.github/workflows/coolify-helper-next.yml index 5010c5546..edee0fca0 100644 --- a/.github/workflows/coolify-helper-next.yml +++ b/.github/workflows/coolify-helper-next.yml @@ -54,7 +54,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(jq -r '.coolify.helper.version' /app/versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT - name: Build image and push to registry uses: docker/build-push-action@v5 with: @@ -83,9 +83,13 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Get Version + id: version + run: | + echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT - name: Create & publish manifest run: | - docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next + docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }} - uses: sarisia/actions-status-discord@v1 if: always() with: From 458a461388e80a70ad866ebc6efb921424ca7ea8 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 10:02:22 +0200 Subject: [PATCH 22/61] chore: Update GitHub workflow to use versions.json instead of version.json --- .github/workflows/coolify-helper.yml | 18 +++++++++++++++--- versions.json | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coolify-helper.yml b/.github/workflows/coolify-helper.yml index 7e8132ec6..be70d104f 100644 --- a/.github/workflows/coolify-helper.yml +++ b/.github/workflows/coolify-helper.yml @@ -25,6 +25,10 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Get Version + id: version + run: | + echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT - name: Build image and push to registry uses: docker/build-push-action@v5 with: @@ -33,7 +37,7 @@ jobs: file: docker/coolify-helper/Dockerfile platforms: linux/amd64 push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }} aarch64: runs-on: [ self-hosted, arm64 ] permissions: @@ -47,6 +51,10 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Get Version + id: version + run: | + echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT - name: Build image and push to registry uses: docker/build-push-action@v5 with: @@ -55,7 +63,7 @@ jobs: file: docker/coolify-helper/Dockerfile platforms: linux/aarch64 push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-aarch64 + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-aarch64 merge-manifest: runs-on: ubuntu-latest permissions: @@ -75,9 +83,13 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Get Version + id: version + run: | + echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT - name: Create & publish manifest run: | - docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }} --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest - uses: sarisia/actions-status-discord@v1 if: always() with: diff --git a/versions.json b/versions.json index 560b427ea..7bb400bfd 100644 --- a/versions.json +++ b/versions.json @@ -7,7 +7,7 @@ "version": "4.0.0-beta.331" }, "helper": { - "version": "0.0.1" + "version": "1.0.0" } } } From bc22ec63e648c8a2962a42627138bbf0485f5998 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 10:03:26 +0200 Subject: [PATCH 23/61] chore: Update GitHub workflow to use versions.json instead of version.json --- .github/workflows/coolify-helper-next.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coolify-helper-next.yml b/.github/workflows/coolify-helper-next.yml index edee0fca0..8d7842a54 100644 --- a/.github/workflows/coolify-helper-next.yml +++ b/.github/workflows/coolify-helper-next.yml @@ -37,7 +37,7 @@ jobs: file: docker/coolify-helper/Dockerfile platforms: linux/amd64 push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next aarch64: runs-on: [ self-hosted, arm64 ] permissions: @@ -63,7 +63,7 @@ jobs: file: docker/coolify-helper/Dockerfile platforms: linux/aarch64 push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64 + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next-aarch64 merge-manifest: runs-on: ubuntu-latest permissions: @@ -89,7 +89,7 @@ jobs: echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT - name: Create & publish manifest run: | - docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }} + docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next - uses: sarisia/actions-status-discord@v1 if: always() with: From 4888f4c40536335f008c99c83faa6aa1ee72de19 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 10:15:22 +0200 Subject: [PATCH 24/61] refactor: upgrade process of Coolify --- app/Actions/Server/UpdateCoolify.php | 7 ------ app/Jobs/ApplicationRestartJob.php | 32 ---------------------------- app/Jobs/InstanceAutoUpdateJob.php | 28 ------------------------ app/Livewire/Upgrade.php | 10 ++------- 4 files changed, 2 insertions(+), 75 deletions(-) delete mode 100644 app/Jobs/ApplicationRestartJob.php delete mode 100644 app/Jobs/InstanceAutoUpdateJob.php diff --git a/app/Actions/Server/UpdateCoolify.php b/app/Actions/Server/UpdateCoolify.php index 5648de796..c4af6bb21 100644 --- a/app/Actions/Server/UpdateCoolify.php +++ b/app/Actions/Server/UpdateCoolify.php @@ -4,8 +4,6 @@ namespace App\Actions\Server; use App\Models\InstanceSettings; use App\Models\Server; -use Illuminate\Support\Facades\File; -use Illuminate\Support\Facades\Http; use Lorisleiva\Actions\Concerns\AsAction; class UpdateCoolify @@ -27,11 +25,6 @@ class UpdateCoolify return; } CleanupDocker::dispatch($this->server)->onQueue('high'); - $response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json'); - if ($response->successful()) { - $versions = $response->json(); - File::put(base_path('versions.json'), json_encode($versions, JSON_PRETTY_PRINT)); - } $this->latestVersion = get_latest_version_of_coolify(); $this->currentVersion = config('version'); if (! $manual_update) { diff --git a/app/Jobs/ApplicationRestartJob.php b/app/Jobs/ApplicationRestartJob.php deleted file mode 100644 index 54c062197..000000000 --- a/app/Jobs/ApplicationRestartJob.php +++ /dev/null @@ -1,32 +0,0 @@ -applicationDeploymentQueueId = $applicationDeploymentQueueId; - } - - public function handle() - { - ray('Restarting application'); - } -} diff --git a/app/Jobs/InstanceAutoUpdateJob.php b/app/Jobs/InstanceAutoUpdateJob.php deleted file mode 100644 index 1bbfcf8cb..000000000 --- a/app/Jobs/InstanceAutoUpdateJob.php +++ /dev/null @@ -1,28 +0,0 @@ -get('https://cdn.coollabs.io/coolify/versions.json'); - if ($response->successful()) { - $versions = $response->json(); - $this->latestVersion = data_get($versions, 'coolify.v4.version'); - } - $this->isUpgradeAvailable = $settings->new_version_available; + $this->latestVersion = get_latest_version_of_coolify(); + $this->isUpgradeAvailable = data_get(InstanceSettings::get(), 'new_version_available', false); } catch (\Throwable $e) { return handleError($e, $this); From 05084cb69c557f0d9bbf384c04b56594acf03802 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 10:45:46 +0200 Subject: [PATCH 25/61] chore: Update GitHub workflow to use jq container for version extraction --- .github/workflows/coolify-helper-next.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coolify-helper-next.yml b/.github/workflows/coolify-helper-next.yml index 8d7842a54..3823e0707 100644 --- a/.github/workflows/coolify-helper-next.yml +++ b/.github/workflows/coolify-helper-next.yml @@ -28,7 +28,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.helper.version' versions.json)"|xargs >> $GITHUB_OUTPUT - name: Build image and push to registry uses: docker/build-push-action@v5 with: @@ -54,7 +54,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.helper.version' versions.json)"|xargs >> $GITHUB_OUTPUT - name: Build image and push to registry uses: docker/build-push-action@v5 with: @@ -86,7 +86,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.helper.version' versions.json)"|xargs >> $GITHUB_OUTPUT - name: Create & publish manifest run: | docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-next --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next From 629316d68a7dd183f9b682a1fbfd8c156384328c Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 10:49:00 +0200 Subject: [PATCH 26/61] chore: Update GitHub workflow to use jq container for version extraction --- .github/workflows/coolify-helper.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coolify-helper.yml b/.github/workflows/coolify-helper.yml index be70d104f..a5100f4fb 100644 --- a/.github/workflows/coolify-helper.yml +++ b/.github/workflows/coolify-helper.yml @@ -28,7 +28,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.helper.version' versions.json)"|xargs >> $GITHUB_OUTPUT - name: Build image and push to registry uses: docker/build-push-action@v5 with: @@ -54,7 +54,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.helper.version' versions.json)"|xargs >> $GITHUB_OUTPUT - name: Build image and push to registry uses: docker/build-push-action@v5 with: @@ -86,7 +86,7 @@ jobs: - name: Get Version id: version run: | - echo "VERSION=$(jq -r '.coolify.helper.version' $(pwd)/versions.json)"|xargs >> $GITHUB_OUTPUT + echo "VERSION=$(docker run --rm -v "$(pwd):/app" -w /app ghcr.io/jqlang/jq:latest '.coolify.helper.version' versions.json)"|xargs >> $GITHUB_OUTPUT - name: Create & publish manifest run: | docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }} --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest From d211362ab3e84aa893f44de43fbb1817fdef1581 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 11:04:58 +0200 Subject: [PATCH 27/61] improvement: only pull helper image if the version is newer than the one --- app/Jobs/PullHelperImageJob.php | 26 ++++++++++++++--- config/coolify.php | 2 +- ...dd_helper_version_to_instance_settings.php | 28 +++++++++++++++++++ other/nightly/versions.json | 9 ++++-- 4 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 database/migrations/2024_09_05_085700_add_helper_version_to_instance_settings.php diff --git a/app/Jobs/PullHelperImageJob.php b/app/Jobs/PullHelperImageJob.php index 30a1b8026..e1afec4b0 100644 --- a/app/Jobs/PullHelperImageJob.php +++ b/app/Jobs/PullHelperImageJob.php @@ -2,6 +2,7 @@ namespace App\Jobs; +use App\Models\InstanceSettings; use App\Models\Server; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldBeEncrypted; @@ -10,6 +11,8 @@ use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\Middleware\WithoutOverlapping; use Illuminate\Queue\SerializesModels; +use Illuminate\Support\Facades\Http; +use Illuminate\Support\Facades\Log; class PullHelperImageJob implements ShouldBeEncrypted, ShouldQueue { @@ -32,10 +35,25 @@ class PullHelperImageJob implements ShouldBeEncrypted, ShouldQueue public function handle(): void { try { - $helperImage = config('coolify.helper_image'); - ray("Pulling {$helperImage}"); - instant_remote_process(["docker pull -q {$helperImage}"], $this->server, false); - ray('PullHelperImageJob done'); + $response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json'); + if ($response->successful()) { + $versions = $response->json(); + $settings = InstanceSettings::get(); + $latest_version = data_get($versions, 'coolify.helper.version'); + $current_version = $settings->helper_version; + Log::info('Latest version', $latest_version); + Log::info('Current version', $current_version); + if (version_compare($latest_version, $current_version, '>')) { + // New version available + Log::info('New version available', $latest_version); + $helperImage = config('coolify.helper_image'); + // REMOVE -next + instant_remote_process(["docker pull -q {$helperImage}:{$latest_version}-next"], $this->server); + $settings->update(['helper_version' => $latest_version]); + Log::info('Pulled helper image', $helperImage, $latest_version); + } + } + } catch (\Throwable $e) { send_internal_notification('PullHelperImageJob failed with: '.$e->getMessage()); ray($e->getMessage()); diff --git a/config/coolify.php b/config/coolify.php index a6d6d8581..6e284fe9e 100644 --- a/config/coolify.php +++ b/config/coolify.php @@ -11,7 +11,7 @@ return [ 'dev_webhook' => env('SERVEO_URL'), 'is_windows_docker_desktop' => env('IS_WINDOWS_DOCKER_DESKTOP', false), 'base_config_path' => env('BASE_CONFIG_PATH', '/data/coolify'), - 'helper_image' => env('HELPER_IMAGE', 'ghcr.io/coollabsio/coolify-helper:latest'), + 'helper_image' => env('HELPER_IMAGE', 'ghcr.io/coollabsio/coolify-helper'), 'is_horizon_enabled' => env('HORIZON_ENABLED', true), 'is_scheduler_enabled' => env('SCHEDULER_ENABLED', true), ]; diff --git a/database/migrations/2024_09_05_085700_add_helper_version_to_instance_settings.php b/database/migrations/2024_09_05_085700_add_helper_version_to_instance_settings.php new file mode 100644 index 000000000..53ecce0f1 --- /dev/null +++ b/database/migrations/2024_09_05_085700_add_helper_version_to_instance_settings.php @@ -0,0 +1,28 @@ +string('helper_version')->default('1.0.0'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('instance_settings', function (Blueprint $table) { + $table->dropColumn('helper_version'); + }); + } +}; diff --git a/other/nightly/versions.json b/other/nightly/versions.json index 9ad886308..7bb400bfd 100644 --- a/other/nightly/versions.json +++ b/other/nightly/versions.json @@ -1,10 +1,13 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.324" + "version": "4.0.0-beta.330" }, "nightly": { - "version": "4.0.0-beta.324" + "version": "4.0.0-beta.331" + }, + "helper": { + "version": "1.0.0" } } -} \ No newline at end of file +} From 22bd305e8f5b7c5e0014cc6460fcee82c0dc4807 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 5 Sep 2024 11:15:56 +0200 Subject: [PATCH 28/61] chore: Update UI for displaying no executions found in scheduled task list --- .../database/backup-executions.blade.php | 2 +- .../scheduled-task/executions.blade.php | 62 ++++++++++--------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/resources/views/livewire/project/database/backup-executions.blade.php b/resources/views/livewire/project/database/backup-executions.blade.php index fd444b50a..54c3e2ede 100644 --- a/resources/views/livewire/project/database/backup-executions.blade.php +++ b/resources/views/livewire/project/database/backup-executions.blade.php @@ -54,7 +54,7 @@
@empty -
No executions found.
+
No executions found.
@endforelse