diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index e92c602cf..4ff1d8020 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -47,6 +47,10 @@ class Kernel extends ConsoleKernel $this->check_resources($schedule); $this->pull_helper_image($schedule); $this->check_scheduled_tasks($schedule); + + if (!isCloud()) { + $schedule->command('cleanup:database --yes')->daily(); + } } } private function pull_helper_image($schedule) @@ -68,35 +72,35 @@ class Kernel extends ConsoleKernel $containerServers = $servers->where('settings.is_swarm_worker', false)->where('settings.is_build_server', false); } foreach ($containerServers as $server) { - $schedule->job(new ContainerStatusJob($server))->everyMinute()->onOneServer(); - // $schedule - // ->call(function () use ($server) { - // $randomSeconds = rand(1, 40); - // $job = new ContainerStatusJob($server); - // $job->delay($randomSeconds); - // ray('dispatching container status job in ' . $randomSeconds . ' seconds'); - // dispatch($job); - // })->name('container-status-' . $server->id)->everyMinute()->onOneServer(); + // $schedule->job(new ContainerStatusJob($server))->everyMinute()->onOneServer(); + $schedule + ->call(function () use ($server) { + $randomSeconds = rand(1, 40); + $job = new ContainerStatusJob($server); + $job->delay($randomSeconds); + ray('dispatching container status job in ' . $randomSeconds . ' seconds'); + dispatch($job); + })->name('container-status-' . $server->id)->everyMinute()->onOneServer(); if ($server->isLogDrainEnabled()) { - $schedule->job(new CheckLogDrainContainerJob($server))->everyMinute()->onOneServer(); - // $schedule - // ->call(function () use ($server) { - // $randomSeconds = rand(1, 40); - // $job = new CheckLogDrainContainerJob($server); - // $job->delay($randomSeconds); - // dispatch($job); - // })->name('log-drain-container-check-' . $server->id)->everyMinute()->onOneServer(); + // $schedule->job(new CheckLogDrainContainerJob($server))->everyMinute()->onOneServer(); + $schedule + ->call(function () use ($server) { + $randomSeconds = rand(1, 40); + $job = new CheckLogDrainContainerJob($server); + $job->delay($randomSeconds); + dispatch($job); + })->name('log-drain-container-check-' . $server->id)->everyMinute()->onOneServer(); } } foreach ($servers as $server) { - $schedule->job(new ServerStatusJob($server))->everyMinute()->onOneServer(); - // $schedule - // ->call(function () use ($server) { - // $randomSeconds = rand(1, 40); - // $job = new ServerStatusJob($server); - // $job->delay($randomSeconds); - // dispatch($job); - // })->name('server-status-job-' . $server->id)->everyMinute()->onOneServer(); + // $schedule->job(new ServerStatusJob($server))->everyMinute()->onOneServer(); + $schedule + ->call(function () use ($server) { + $randomSeconds = rand(1, 40); + $job = new ServerStatusJob($server); + $job->delay($randomSeconds); + dispatch($job); + })->name('server-status-job-' . $server->id)->everyMinute()->onOneServer(); } } private function instance_auto_update($schedule) diff --git a/app/Http/Middleware/PreventRequestsDuringMaintenance.php b/app/Http/Middleware/PreventRequestsDuringMaintenance.php index eec6b5358..e7d2b99fe 100644 --- a/app/Http/Middleware/PreventRequestsDuringMaintenance.php +++ b/app/Http/Middleware/PreventRequestsDuringMaintenance.php @@ -13,5 +13,6 @@ class PreventRequestsDuringMaintenance extends Middleware */ protected $except = [ 'webhooks/*', + '/api/health' ]; } diff --git a/app/Models/Service.php b/app/Models/Service.php index e8b0c97f0..3e6d2b9db 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -102,6 +102,32 @@ class Service extends BaseModel foreach ($applications as $application) { $image = str($application->image)->before(':')->value(); switch ($image) { + case str($image)?->contains('directus'): + $data = collect([]); + $admin_email = $this->environment_variables()->where('key', 'ADMIN_EMAIL')->first(); + $admin_password = $this->environment_variables()->where('key', 'SERVICE_PASSWORD_ADMIN')->first(); + + if ($admin_email) { + $data = $data->merge([ + 'Admin Email' => [ + 'key' => data_get($admin_email, 'key'), + 'value' => data_get($admin_email, 'value'), + 'rules' => 'required|email', + ], + ]); + } + if ($admin_password) { + $data = $data->merge([ + 'Admin Password' => [ + 'key' => data_get($admin_password, 'key'), + 'value' => data_get($admin_password, 'value'), + 'rules' => 'required', + 'isPassword' => true, + ], + ]); + } + $fields->put('Directus', $data); + break; case str($image)?->contains('kong'): $data = collect([]); $dashboard_user = $this->environment_variables()->where('key', 'SERVICE_USER_ADMIN')->first(); diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 9bb2c164a..621251d36 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -1054,8 +1054,8 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal serviceLabels: $serviceLabels, is_gzip_enabled: $savedService->isGzipEnabled(), is_stripprefix_enabled: $savedService->isStripprefixEnabled(), - service_name: $serviceName)); - + service_name: $serviceName + )); } } if ($resource->server->isLogDrainEnabled() && $savedService->isLogDrainEnabled()) { @@ -1597,6 +1597,7 @@ function generateEnvValue(string $command, ?Service $service = null) case 'PASSWORD_64': $generatedValue = Str::password(length: 64, symbols: false); break; + // This is not base64, it's just a random string case 'BASE64_64': $generatedValue = Str::random(64); break; @@ -1604,8 +1605,20 @@ function generateEnvValue(string $command, ?Service $service = null) $generatedValue = Str::random(128); break; case 'BASE64': + case 'BASE64_32': $generatedValue = Str::random(32); break; + // This is base64, + case 'REALBASE64_64': + $generatedValue = base64_encode(Str::random(64)); + break; + case 'REALBASE64_128': + $generatedValue = base64_encode(Str::random(128)); + break; + case 'REALBASE64': + case 'REALBASE64_32': + $generatedValue = base64_encode(Str::random(32)); + break; case 'USER': $generatedValue = Str::random(16); break; diff --git a/config/sentry.php b/config/sentry.php index 13331bc77..a0645087e 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.233', + 'release' => '4.0.0-beta.234', // 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 7aab683f5..10cf972a7 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ + + + Coolify diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php index 26fdd935b..5410156ee 100644 --- a/resources/views/livewire/project/application/general.blade.php +++ b/resources/views/livewire/project/application/general.blade.php @@ -209,7 +209,11 @@ placeholder="--cap-add SYS_ADMIN --device=/dev/fuse --security-opt apparmor:unconfined --ulimit nofile=1024:1024 --tmpfs /run:rw,noexec,nosuid,size=65536k" id="application.custom_docker_run_options" label="Custom Docker Options" /> @endif - + @else + @endif @if ($application->build_pack === 'dockercompose') Reload Compose File diff --git a/templates/compose/plausible.yaml b/templates/compose/plausible.yaml index a08324b0b..7c4b449ba 100644 --- a/templates/compose/plausible.yaml +++ b/templates/compose/plausible.yaml @@ -12,6 +12,7 @@ services: - DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_POSTGRES@plausible_db/plausible - BASE_URL=$SERVICE_FQDN_PLAUSIBLE - SECRET_KEY_BASE=$SERVICE_BASE64_64_PLAUSIBLE + - TOTP_VAULT_KEY=$SERVICE_REALBASE64_TOTP depends_on: - plausible_db - plausible_events_db diff --git a/versions.json b/versions.json index c881b176b..85d955552 100644 --- a/versions.json +++ b/versions.json @@ -4,7 +4,7 @@ "version": "3.12.36" }, "v4": { - "version": "4.0.0-beta.233" + "version": "4.0.0-beta.234" } } }