Merge pull request #1664 from coollabsio/next

v4.0.0-beta.198
This commit is contained in:
Andras Bacsai
2024-01-18 15:06:12 +01:00
committed by GitHub
9 changed files with 34 additions and 16 deletions

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Redis;
class CleanupQueue extends Command
{
protected $signature = 'cleanup:queue';
protected $description = 'Cleanup Queue';
public function handle()
{
echo "Running queue cleanup...\n";
$prefix = config('database.redis.options.prefix');
$keys = Redis::connection()->keys('*:laravel*');
foreach ($keys as $key) {
$keyWithoutPrefix = str_replace($prefix, '', $key);
Redis::connection()->del($keyWithoutPrefix);
}
}
}

View File

@@ -9,8 +9,6 @@ use App\Models\ScheduledDatabaseBackup;
use App\Models\Server; use App\Models\Server;
use App\Models\StandalonePostgresql; use App\Models\StandalonePostgresql;
use App\Models\Team; use App\Models\Team;
use App\Models\TeamInvitation;
use App\Models\User;
use App\Models\Waitlist; use App\Models\Waitlist;
use App\Notifications\Application\DeploymentFailed; use App\Notifications\Application\DeploymentFailed;
use App\Notifications\Application\DeploymentSuccess; use App\Notifications\Application\DeploymentSuccess;
@@ -18,13 +16,11 @@ use App\Notifications\Application\StatusChanged;
use App\Notifications\Database\BackupFailed; use App\Notifications\Database\BackupFailed;
use App\Notifications\Database\BackupSuccess; use App\Notifications\Database\BackupSuccess;
use App\Notifications\Test; use App\Notifications\Test;
use App\Notifications\TransactionalEmails\InvitationLink;
use Exception; use Exception;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Mail\Message; use Illuminate\Mail\Message;
use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\MailMessage;
use Mail; use Mail;
use Illuminate\Support\Str;
use function Laravel\Prompts\confirm; use function Laravel\Prompts\confirm;
use function Laravel\Prompts\select; use function Laravel\Prompts\select;

View File

@@ -30,7 +30,7 @@ class Init extends Command
$this->alive(); $this->alive();
$cleanup = $this->option('cleanup'); $cleanup = $this->option('cleanup');
if ($cleanup) { if ($cleanup) {
echo "Running cleanup\n"; echo "Running cleanups...\n";
$this->cleanup_stucked_resources(); $this->cleanup_stucked_resources();
// Required for falsely deleted coolify db // Required for falsely deleted coolify db
$this->restore_coolify_db_backup(); $this->restore_coolify_db_backup();
@@ -54,6 +54,7 @@ class Init extends Command
$settings->update(['is_auto_update_enabled' => false]); $settings->update(['is_auto_update_enabled' => false]);
} }
} }
$this->call('cleanup:queue');
} }
private function restore_coolify_db_backup() private function restore_coolify_db_backup()
{ {

View File

@@ -27,6 +27,9 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
{ {
return isDev() ? 1 : 3; return isDev() ? 1 : 3;
} }
public function __construct(public Server $server)
{
}
public function middleware(): array public function middleware(): array
{ {
return [(new WithoutOverlapping($this->server->uuid))]; return [(new WithoutOverlapping($this->server->uuid))];
@@ -37,11 +40,6 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
return $this->server->uuid; return $this->server->uuid;
} }
public function __construct(public Server $server)
{
$this->handle();
}
public function handle() public function handle()
{ {
if (!$this->server->isFunctional()) { if (!$this->server->isFunctional()) {

View File

@@ -19,7 +19,7 @@ class PullHelperImageJob implements ShouldQueue, ShouldBeEncrypted
public function middleware(): array public function middleware(): array
{ {
return [(new WithoutOverlapping($this->server->uuid))->dontRelease()]; return [(new WithoutOverlapping($this->server->uuid))];
} }
public function uniqueId(): string public function uniqueId(): string

View File

@@ -37,12 +37,12 @@ class ContainerStopped extends Notification implements ShouldQueue
public function toDiscord(): string public function toDiscord(): string
{ {
$message = "Coolify: A resource has been stopped unexpectedly on {$this->server->name}"; $message = "Coolify: A resource ($this->name) has been stopped unexpectedly on {$this->server->name}";
return $message; return $message;
} }
public function toTelegram(): array public function toTelegram(): array
{ {
$message = "Coolify: A resource has been stopped unexpectedly on {$this->server->name}"; $message = "Coolify: A resource ($this->name) has been stopped unexpectedly on {$this->server->name}";
$payload = [ $payload = [
"message" => $message, "message" => $message,
]; ];

View File

@@ -7,7 +7,7 @@ return [
// The release version of your application // The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
'release' => '4.0.0-beta.197', 'release' => '4.0.0-beta.198',
// When left empty or `null` the Laravel environment will be used // When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'), 'environment' => config('app.env'),

View File

@@ -1,3 +1,3 @@
<?php <?php
return '4.0.0-beta.197'; return '4.0.0-beta.198';

View File

@@ -4,7 +4,7 @@
"version": "3.12.36" "version": "3.12.36"
}, },
"v4": { "v4": {
"version": "4.0.0-beta.197" "version": "4.0.0-beta.198"
} }
} }
} }