resource->type()) { case 'application': $persistentStorages = $this->resource?->persistentStorages()?->get(); StopApplication::run($this->resource, previewDeployments: true); break; case 'standalone-postgresql': case 'standalone-redis': case 'standalone-mongodb': case 'standalone-mysql': case 'standalone-mariadb': case 'standalone-keydb': case 'standalone-dragonfly': case 'standalone-clickhouse': $persistentStorages = $this->resource?->persistentStorages()?->get(); StopDatabase::run($this->resource, true); break; case 'service': StopService::run($this->resource, true); DeleteService::run($this->resource, $this->deleteConfigurations, $this->deleteVolumes, $this->dockerCleanup, $this->deleteConnectedNetworks); break; } if ($this->deleteVolumes && $this->resource->type() !== 'service') { $this->resource?->delete_volumes($persistentStorages); } if ($this->deleteConfigurations) { $this->resource?->delete_configurations(); } $isDatabase = $this->resource instanceof StandalonePostgresql || $this->resource instanceof StandaloneRedis || $this->resource instanceof StandaloneMongodb || $this->resource instanceof StandaloneMysql || $this->resource instanceof StandaloneMariadb || $this->resource instanceof StandaloneKeydb || $this->resource instanceof StandaloneDragonfly || $this->resource instanceof StandaloneClickhouse; $server = data_get($this->resource, 'server') ?? data_get($this->resource, 'destination.server'); if (($this->dockerCleanup || $isDatabase) && $server) { CleanupDocker::dispatch($server, true); } if ($this->deleteConnectedNetworks && ! $isDatabase) { $this->resource?->delete_connected_networks($this->resource->uuid); } } catch (\Throwable $e) { send_internal_notification('ContainerStoppingJob failed with: '.$e->getMessage()); throw $e; } finally { $this->resource->forceDelete(); if ($this->dockerCleanup) { CleanupDocker::dispatch($server, true); } Artisan::queue('cleanup:stucked-resources'); } } }