commit
						838c3830d6
					
				
							
								
								
									
										23
									
								
								app/Console/Commands/CleanupQueue.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								app/Console/Commands/CleanupQueue.php
									
									
									
									
									
										Normal 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); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -9,8 +9,6 @@ use App\Models\ScheduledDatabaseBackup; | ||||
| use App\Models\Server; | ||||
| use App\Models\StandalonePostgresql; | ||||
| use App\Models\Team; | ||||
| use App\Models\TeamInvitation; | ||||
| use App\Models\User; | ||||
| use App\Models\Waitlist; | ||||
| use App\Notifications\Application\DeploymentFailed; | ||||
| use App\Notifications\Application\DeploymentSuccess; | ||||
| @ -18,13 +16,11 @@ use App\Notifications\Application\StatusChanged; | ||||
| use App\Notifications\Database\BackupFailed; | ||||
| use App\Notifications\Database\BackupSuccess; | ||||
| use App\Notifications\Test; | ||||
| use App\Notifications\TransactionalEmails\InvitationLink; | ||||
| use Exception; | ||||
| use Illuminate\Console\Command; | ||||
| use Illuminate\Mail\Message; | ||||
| use Illuminate\Notifications\Messages\MailMessage; | ||||
| use Mail; | ||||
| use Illuminate\Support\Str; | ||||
| 
 | ||||
| use function Laravel\Prompts\confirm; | ||||
| use function Laravel\Prompts\select; | ||||
|  | ||||
| @ -30,7 +30,7 @@ class Init extends Command | ||||
|         $this->alive(); | ||||
|         $cleanup = $this->option('cleanup'); | ||||
|         if ($cleanup) { | ||||
|             echo "Running cleanup\n"; | ||||
|             echo "Running cleanups...\n"; | ||||
|             $this->cleanup_stucked_resources(); | ||||
|             // Required for falsely deleted coolify db
 | ||||
|             $this->restore_coolify_db_backup(); | ||||
| @ -54,6 +54,7 @@ class Init extends Command | ||||
|                 $settings->update(['is_auto_update_enabled' => false]); | ||||
|             } | ||||
|         } | ||||
|         $this->call('cleanup:queue'); | ||||
|     } | ||||
|     private function restore_coolify_db_backup() | ||||
|     { | ||||
|  | ||||
| @ -27,6 +27,9 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted | ||||
|     { | ||||
|         return isDev() ? 1 : 3; | ||||
|     } | ||||
|     public function __construct(public Server $server) | ||||
|     { | ||||
|     } | ||||
|     public function middleware(): array | ||||
|     { | ||||
|         return [(new WithoutOverlapping($this->server->uuid))]; | ||||
| @ -37,11 +40,6 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted | ||||
|         return $this->server->uuid; | ||||
|     } | ||||
| 
 | ||||
|     public function __construct(public Server $server) | ||||
|     { | ||||
|         $this->handle(); | ||||
|     } | ||||
| 
 | ||||
|     public function handle() | ||||
|     { | ||||
|         if (!$this->server->isFunctional()) { | ||||
|  | ||||
| @ -19,7 +19,7 @@ class PullHelperImageJob implements ShouldQueue, ShouldBeEncrypted | ||||
| 
 | ||||
|     public function middleware(): array | ||||
|     { | ||||
|         return [(new WithoutOverlapping($this->server->uuid))->dontRelease()]; | ||||
|         return [(new WithoutOverlapping($this->server->uuid))]; | ||||
|     } | ||||
| 
 | ||||
|     public function uniqueId(): string | ||||
|  | ||||
| @ -37,12 +37,12 @@ class ContainerStopped extends Notification implements ShouldQueue | ||||
| 
 | ||||
|     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; | ||||
|     } | ||||
|     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 = [ | ||||
|             "message" => $message, | ||||
|         ]; | ||||
|  | ||||
| @ -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.197', | ||||
|     'release' => '4.0.0-beta.198', | ||||
|     // When left empty or `null` the Laravel environment will be used
 | ||||
|     'environment' => config('app.env'), | ||||
| 
 | ||||
|  | ||||
| @ -1,3 +1,3 @@ | ||||
| <?php | ||||
| 
 | ||||
| return '4.0.0-beta.197'; | ||||
| return '4.0.0-beta.198'; | ||||
|  | ||||
| @ -4,7 +4,7 @@ | ||||
|             "version": "3.12.36" | ||||
|         }, | ||||
|         "v4": { | ||||
|             "version": "4.0.0-beta.197" | ||||
|             "version": "4.0.0-beta.198" | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user