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
formatting
ayntk-ai48734e53d07a
diff --git a/app/Jobs/ScheduledTaskJob.php b/app/Jobs/ScheduledTaskJob.phpindex 3daaa9e831..93d5fca709 100644--- a/app/Jobs/ScheduledTaskJob.php+++ b/app/Jobs/ScheduledTaskJob.php@@ -55,10 +55,13 @@ class ScheduledTaskJob implements ShouldQueueprivate function getServerTimezone(): string{if ($this->resource instanceof Application) {- return $this->resource->destination->server->settings->server_timezone;+ $timezone = $this->resource->destination->server->settings->server_timezone;+ return $timezone;} elseif ($this->resource instanceof Service) {- return $this->resource->server->settings->server_timezone;+ $timezone = $this->resource->server->settings->server_timezone;+ return $timezone;}+ return 'UTC';}public function middleware(): array@@ -91,12 +94,12 @@ class ScheduledTaskJob implements ShouldQueue} elseif ($this->resource->type() == 'service') {$this->resource->applications()->get()->each(function ($application) {if (str(data_get($application, 'status'))->contains('running')) {- $this->containers[] = data_get($application, 'name').'-'.data_get($this->resource, 'uuid');+ $this->containers[] = data_get($application, 'name') . '-' . data_get($this->resource, 'uuid');}});$this->resource->databases()->get()->each(function ($database) {if (str(data_get($database, 'status'))->contains('running')) {- $this->containers[] = data_get($database, 'name').'-'.data_get($this->resource, 'uuid');+ $this->containers[] = data_get($database, 'name') . '-' . data_get($this->resource, 'uuid');}});}@@ -109,8 +112,8 @@ class ScheduledTaskJob implements ShouldQueue}foreach ($this->containers as $containerName) {- if (count($this->containers) == 1 || str_starts_with($containerName, $this->task->container.'-'.$this->resource->uuid)) {- $cmd = "sh -c '".str_replace("'", "'\''", $this->task->command)."'";+ if (count($this->containers) == 1 || str_starts_with($containerName, $this->task->container . '-' . $this->resource->uuid)) {+ $cmd = "sh -c '" . str_replace("'", "'\''", $this->task->command) . "'";$exec = "docker exec {$containerName} {$cmd}";$this->task_output = instant_remote_process([$exec], $this->server, true);$this->task_log->update([@@ -135,7 +138,6 @@ class ScheduledTaskJob implements ShouldQueue// send_internal_notification('ScheduledTaskJob failed with: ' . $e->getMessage());throw $e;} finally {-}}-}\ No newline at end of file+}diff --git a/app/Models/ScheduledTask.php b/app/Models/ScheduledTask.phpindex c01e5e057b..81ca6dba53 100644--- a/app/Models/ScheduledTask.php+++ b/app/Models/ScheduledTask.php@@ -38,7 +38,8 @@ class ScheduledTask extends BaseModel$server = $this->application->server;ray('Returning server from application: '.$server);return $server;- } elseif ($this->database) {+ }+ elseif ($this->database) {ray('Returning server from database');$server = $this->database->server;ray('Returning server from database: '.$server);diff --git a/resources/views/livewire/project/database/backup-executions.blade.php b/resources/views/livewire/project/database/backup-executions.blade.phpindex 483fecc349..c3fc01fb4e 100644--- a/resources/views/livewire/project/database/backup-executions.blade.php+++ b/resources/views/livewire/project/database/backup-executions.blade.php@@ -1,57 +1,56 @@<div wire:init='refreshBackupExecutions'>@isset($backup)- <div class="flex items-center gap-2">- <h3 class="py-4">Executions</h3>- <x-forms.button wire:click='cleanupFailed'>Cleanup Failed Backups</x-forms.button>- </div>- <div class="flex flex-col-reverse gap-2">- @forelse($executions as $execution)- <form wire:key="{{ data_get($execution, 'id') }}"- class="relative flex flex-col p-4 bg-white box-without-bg dark:bg-coolgray-100"- @class([- 'border-green-500' => data_get($execution, 'status') === 'success',- 'border-red-500' => data_get($execution, 'status') === 'failed',- ])>- @if (data_get($execution, 'status') === 'running')- <div class="absolute top-2 right-2">- <x-loading />- </div>- @endif- <div>Database: {{ data_get($execution, 'database_name', 'N/A') }}</div>- <div>Status: {{ data_get($execution, 'status') }}</div>- <div>Started At: {{ $this->formatDateInServerTimezone(data_get($execution, 'created_at')) }}</div>- @if (data_get($execution, 'message'))- <div>Message: {{ data_get($execution, 'message') }}</div>- @endif- <div>Size: {{ data_get($execution, 'size') }} B /- {{ round((int) data_get($execution, 'size') / 1024, 2) }}- kB / {{ round((int) data_get($execution, 'size') / 1024 / 1024, 3) }} MB- </div>- <div>Location: {{ data_get($execution, 'filename', 'N/A') }}</div>- <div class="flex gap-2">- <div class="flex-1"></div>- @if (data_get($execution, 'status') === 'success')- <x-forms.button class=" dark:hover:bg-coolgray-400"- x-on:click="download_file('{{ data_get($execution, 'id') }}')">Download</x-forms.button>- @endif- <x-modal-confirmation isErrorButton action="deleteBackup({{ data_get($execution, 'id') }})">- <x-slot:button-title>- Delete- </x-slot:button-title>- This will delete this backup. It is not reversible.<br>Please think again.- </x-modal-confirmation>- </div>- </form>+ <div class="flex items-center gap-2">+ <h3 class="py-4">Executions</h3>+ <x-forms.button wire:click='cleanupFailed'>Cleanup Failed Backups</x-forms.button>+ </div>+ <div class="flex flex-col-reverse gap-2">+ @forelse($executions as $execution)+ <form wire:key="{{ data_get($execution, 'id') }}"+ class="relative flex flex-col p-4 bg-white box-without-bg dark:bg-coolgray-100"+ @class([ 'border-green-500'=> data_get($execution, 'status') === 'success',+ 'border-red-500' => data_get($execution, 'status') === 'failed',+ ])>+ @if (data_get($execution, 'status') === 'running')+ <div class="absolute top-2 right-2">+ <x-loading />+ </div>+ @endif+ <div>Database: {{ data_get($execution, 'database_name', 'N/A') }}</div>+ <div>Status: {{ data_get($execution, 'status') }}</div>+ <div>Started At: {{ $this->formatDateInServerTimezone(data_get($execution, 'created_at')) }}</div>+ @if (data_get($execution, 'message'))+ <div>Message: {{ data_get($execution, 'message') }}</div>+ @endif+ <div>Size: {{ data_get($execution, 'size') }} B /+ {{ round((int) data_get($execution, 'size') / 1024, 2) }}+ kB / {{ round((int) data_get($execution, 'size') / 1024 / 1024, 3) }} MB+ </div>+ <div>Location: {{ data_get($execution, 'filename', 'N/A') }}</div>+ <div class="flex gap-2">+ <div class="flex-1"></div>+ @if (data_get($execution, 'status') === 'success')+ <x-forms.button class=" dark:hover:bg-coolgray-400"+ x-on:click="download_file('{{ data_get($execution, 'id') }}')">Download</x-forms.button>+ @endif+ <x-modal-confirmation isErrorButton action="deleteBackup({{ data_get($execution, 'id') }})">+ <x-slot:button-title>+ Delete+ </x-slot:button-title>+ This will delete this backup. It is not reversible.<br>Please think again.+ </x-modal-confirmation>+ </div>+ </form>- @empty- <div>No executions found.</div>- @endforelse- </div>- <script>- function download_file(executionId) {- window.open('/download/backup/' + executionId, '_blank');- }- </script>+ @empty+ <div>No executions found.</div>+ @endforelse+ </div>+ <script>+ function download_file(executionId) {+ window.open('/download/backup/' + executionId, '_blank');+ }+ </script>@endisset-</div>\ No newline at end of file+</div>diff --git a/resources/views/livewire/project/shared/scheduled-task/show.blade.php b/resources/views/livewire/project/shared/scheduled-task/show.blade.phpindex d448000ca5..125a431a40 100644--- a/resources/views/livewire/project/shared/scheduled-task/show.blade.php+++ b/resources/views/livewire/project/shared/scheduled-task/show.blade.php@@ -1,47 +1,47 @@<div><x-slot:title>{{ data_get_str($resource, 'name')->limit(10) }} > Scheduled Tasks | Coolify- </x-slot>- @if ($type === 'application')+ </x-slot>+ @if ($type === 'application')<h1>Scheduled Task</h1><livewire:project.application.heading :application="$resource" />- @elseif ($type === 'service')+ @elseif ($type === 'service')<livewire:project.service.navbar :service="$resource" :parameters="$parameters" />- @endif+ @endif- <form wire:submit="submit" class="w-full">- <div class="flex flex-col gap-2 pb-2">- <div class="flex items-end gap-2 pt-4">- <h2>Scheduled Task</h2>- <x-forms.button type="submit">- Save- </x-forms.button>- <x-modal-confirmation isErrorButton buttonTitle="Delete Scheduled Task">- You will delete scheduled task <span class="font-bold dark:text-warning">{{ $task->name }}</span>.- </x-modal-confirmation>+ <form wire:submit="submit" class="w-full">+ <div class="flex flex-col gap-2 pb-2">+ <div class="flex items-end gap-2 pt-4">+ <h2>Scheduled Task</h2>+ <x-forms.button type="submit">+ Save+ </x-forms.button>+ <x-modal-confirmation isErrorButton buttonTitle="Delete Scheduled Task">+ You will delete scheduled task <span class="font-bold dark:text-warning">{{ $task->name }}</span>.+ </x-modal-confirmation>+ </div>+ <div class="w-48">+ <x-forms.checkbox instantSave id="task.enabled" label="Enabled" />+ </div></div>- <div class="w-48">- <x-forms.checkbox instantSave id="task.enabled" label="Enabled" />- </div>- </div>- <div class="flex w-full gap-2">- <x-forms.input placeholder="Name" id="task.name" label="Name" required />- <x-forms.input placeholder="php artisan schedule:run" id="task.command" label="Command" required />- <x-forms.input placeholder="0 0 * * * or daily" id="task.frequency" label="Frequency" required />- @if ($type === 'application')+ <div class="flex w-full gap-2">+ <x-forms.input placeholder="Name" id="task.name" label="Name" required />+ <x-forms.input placeholder="php artisan schedule:run" id="task.command" label="Command" required />+ <x-forms.input placeholder="0 0 * * * or daily" id="task.frequency" label="Frequency" required />+ @if ($type === 'application')<x-forms.input placeholder="php"helper="You can leave it empty if your resource only have one container." id="task.container"label="Container name" />- @elseif ($type === 'service')+ @elseif ($type === 'service')<x-forms.input placeholder="php"helper="You can leave it empty if your resource only have one service in your stack. Otherwise use the stack name, without the random generated id. So if you have a mysql service in your stack, use mysql."id="task.container" label="Service name" />- @endif- </div>- </form>+ @endif+ </div>+ </form>- <div class="pt-4">- <h3 class="py-4">Recent executions <span class="text-xs text-neutral-500">(click to check output)</span></h3>- <livewire:project.shared.scheduled-task.executions :task="$task" key="{{ $task->id }}" selectedKey="" :executions="$task->executions->take(-20)" />- </div>-</div>\ No newline at end of file+ <div class="pt-4">+ <h3 class="py-4">Recent executions <span class="text-xs text-neutral-500">(click to check output)</span></h3>+ <livewire:project.shared.scheduled-task.executions :task="$task" key="{{ $task->id }}" selectedKey="" :executions="$task->executions->take(-20)" />+ </div>+</div>