Skip to content

Commit

Permalink
Merge pull request #4393 from coollabsio/next
Browse files Browse the repository at this point in the history
v4.0.0-beta.372
  • Loading branch information
andrasbacsai authored Nov 26, 2024
2 parents 13f9b15 + 18d5dd3 commit 33814ef
Show file tree
Hide file tree
Showing 83 changed files with 1,207 additions and 560 deletions.
2 changes: 1 addition & 1 deletion app/Actions/Proxy/CheckProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function handle(Server $server, $fromUI = false): bool
if (is_null($proxyType) || $proxyType === 'NONE' || $server->proxy->force_stop) {
return false;
}
['uptime' => $uptime, 'error' => $error] = $server->validateConnection(false);
['uptime' => $uptime, 'error' => $error] = $server->validateConnection();
if (! $uptime) {
throw new \Exception($error);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Server/UpdateCoolify.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function handle($manual_update = false)
}
CleanupDocker::dispatch($this->server);
$this->latestVersion = get_latest_version_of_coolify();
$this->currentVersion = config('version');
$this->currentVersion = config('constants.coolify.version');
if (! $manual_update) {
if (! $settings->is_auto_update_enabled) {
return;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function handle()
'team_id' => 0,
]);
}
$this->mail = (new BackupSuccess($backup, $db))->toMail();
// $this->mail = (new BackupSuccess($backup->frequency, $db->name))->toMail();
$this->sendEmail();
break;
// case 'invitation-link':
Expand Down
6 changes: 3 additions & 3 deletions app/Console/Commands/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private function cleanup_unused_network_from_coolify_proxy()

private function restore_coolify_db_backup()
{
if (version_compare('4.0.0-beta.179', config('version'), '<=')) {
if (version_compare('4.0.0-beta.179', config('constants.coolify.version'), '<=')) {
try {
$database = StandalonePostgresql::withTrashed()->find(0);
if ($database && $database->trashed()) {
Expand Down Expand Up @@ -228,7 +228,7 @@ private function restore_coolify_db_backup()
private function send_alive_signal()
{
$id = config('app.id');
$version = config('version');
$version = config('constants.coolify.version');
$settings = instanceSettings();
$do_not_track = data_get($settings, 'do_not_track');
if ($do_not_track == true) {
Expand Down Expand Up @@ -264,7 +264,7 @@ private function cleanup_in_progress_application_deployments()

private function replace_slash_in_environment_name()
{
if (version_compare('4.0.0-beta.298', config('version'), '<=')) {
if (version_compare('4.0.0-beta.298', config('constants.coolify.version'), '<=')) {
$environments = Environment::all();
foreach ($environments as $environment) {
if (str_contains($environment->name, '/')) {
Expand Down
7 changes: 5 additions & 2 deletions app/Console/Commands/ServicesGenerate.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class ServicesGenerate extends Command

public function handle(): int
{
$serviceTemplatesJson = collect(glob(base_path('templates/compose/*.yaml')))
$serviceTemplatesJson = collect(array_merge(
glob(base_path('templates/compose/*.yaml')),
glob(base_path('templates/compose/*.yml'))
))
->mapWithKeys(function ($file): array {
$file = basename($file);
$parsed = $this->processFile($file);
Expand Down Expand Up @@ -68,7 +71,7 @@ private function processFile(string $file): false|array
'slogan' => $data->get('slogan', str($file)->headline()),
'compose' => $compose,
'tags' => $tags,
'logo' => $data->get('logo', 'svgs/coolify.png'),
'logo' => $data->get('logo', 'svgs/default.webp'),
'minversion' => $data->get('minversion', '0.0.0'),
];

Expand Down
14 changes: 9 additions & 5 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function schedule(Schedule $schedule): void
$this->instanceTimezone = config('app.timezone');
}

$this->scheduleInstance->job(new CleanupStaleMultiplexedConnections)->hourly();
// $this->scheduleInstance->job(new CleanupStaleMultiplexedConnections)->hourly();

if (isDev()) {
// Instance Jobs
Expand Down Expand Up @@ -132,7 +132,7 @@ private function checkResources(): void
}

foreach ($servers as $server) {
$serverTimezone = $server->settings->server_timezone;
$serverTimezone = data_get($server->settings, 'server_timezone', $this->instanceTimezone);

// Sentinel check
$lastSentinelUpdate = $server->sentinel_updated_at;
Expand All @@ -141,8 +141,12 @@ private function checkResources(): void
if (validate_timezone($serverTimezone) === false) {
$serverTimezone = config('app.timezone');
}
$this->scheduleInstance->job(new ServerCheckJob($server))->timezone($serverTimezone)->everyMinute()->onOneServer();
// $this->scheduleInstance->job(new \App\Jobs\ServerCheckNewJob($server))->everyMinute()->onOneServer();
if (isCloud()) {
$this->scheduleInstance->job(new ServerCheckJob($server))->timezone($serverTimezone)->everyFiveMinutes()->onOneServer();
} else {
$this->scheduleInstance->job(new ServerCheckJob($server))->timezone($serverTimezone)->everyMinute()->onOneServer();
}
// $this->scheduleInstance->job(new \App\Jobs\ServerCheckNewJob($server))->everyFiveMinutes()->onOneServer();

// Check storage usage every 10 minutes if Sentinel does not activated
$this->scheduleInstance->job(new ServerStorageCheckJob($server))->everyTenMinutes()->onOneServer();
Expand All @@ -154,7 +158,7 @@ private function checkResources(): void
}

// Cleanup multiplexed connections every hour
$this->scheduleInstance->job(new ServerCleanupMux($server))->hourly()->onOneServer();
// $this->scheduleInstance->job(new ServerCleanupMux($server))->hourly()->onOneServer();

// Temporary solution until we have better memory management for Sentinel
if ($server->isSentinelEnabled()) {
Expand Down
2 changes: 1 addition & 1 deletion app/Events/DatabaseProxyStopped.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DatabaseProxyStopped implements ShouldBroadcast
public function __construct($teamId = null)
{
if (is_null($teamId)) {
$teamId = Auth::user()->currentTeam()->id ?? null;
$teamId = Auth::user()?->currentTeam()?->id ?? null;
}
if (is_null($teamId)) {
throw new \Exception('Team id is null');
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/OtherController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class OtherController extends Controller
)]
public function version(Request $request)
{
return response(config('version'));
return response(config('constants.coolify.version'));
}

#[OA\Get(
Expand Down
8 changes: 5 additions & 3 deletions app/Http/Controllers/Api/ServersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,9 @@ public function create_server(Request $request)
['bearerAuth' => []],
],
tags: ['Servers'],
parameters: [
new OA\Parameter(name: 'uuid', in: 'path', required: true, description: 'Server UUID', schema: new OA\Schema(type: 'string')),
],
requestBody: new OA\RequestBody(
required: true,
description: 'Server updated.',
Expand Down Expand Up @@ -596,8 +599,7 @@ public function create_server(Request $request)
new OA\MediaType(
mediaType: 'application/json',
schema: new OA\Schema(
type: 'array',
items: new OA\Items(ref: '#/components/schemas/Server')
ref: '#/components/schemas/Server'
)
),
]),
Expand Down Expand Up @@ -679,7 +681,7 @@ public function update_server(Request $request)
}

return response()->json([

'uuid' => $server->uuid,
])->setStatusCode(201);
}

Expand Down
Loading

0 comments on commit 33814ef

Please sign in to comment.