Files
coolify/app/Jobs/ReleaseManagedDnsRecordsJob.php
Andras Bacsai 554b79e8dd feat: add Traefik ACME cert UI and shared managed DNS record ownership
- Proxy: list and delete Traefik ACME certificates from the server proxy
  page via new TraefikAcmeService and Get/DeleteTraefikCertificate actions
- DNS: track ownership and cross-resource references for managed DNS
  records so records are only deleted when no longer referenced; release
  records asynchronously on resource deletion via ReleaseManagedDnsRecordsJob
  and ManagedDnsRecordCleanup; harden Cloudflare provider deletion results
- Databases: fail closed on start when prerequisites or the CA certificate
  are missing (DatabaseStartException, Server::ensureCaCertificate) and
  clean up stale start activities via ResourceStartActivity
- Webhooks: throttle repeated manual webhook signature failures for
  GitHub, GitLab, Gitea and Bitbucket
- Deployments: improve compose build-context handling and compose file
  load error reporting
- Install scripts: rework terminal UI output in install.sh (stable and
  nightly)
- Misc: settings sidebar accordion fixes, log drain toggle rollback,
  add Serverside to README sponsors
- Add migrations and tests covering the above
2026-09-25 19:00:00 +02:00

47 lines
1.2 KiB
PHP

<?php
namespace App\Jobs;
use App\Services\Dns\ManagedDnsRecordCleanup;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Support\Facades\Log;
/**
* Releases the managed DNS references of a deleted resource and deletes records Coolify owns that are no longer used.
* Never fails the deletion: provider errors are logged and retried a few times.
*/
class ReleaseManagedDnsRecordsJob implements ShouldQueue
{
use Queueable;
public const MAX_ATTEMPTS = 3;
public int $tries = self::MAX_ATTEMPTS;
public int $timeout = 120;
public function __construct(
public string $resourceType,
public int|string $resourceId,
) {}
public function handle(ManagedDnsRecordCleanup $cleanup): void
{
if ($cleanup->releaseResource($this->resourceType, $this->resourceId)) {
return;
}
if ($this->attempts() < self::MAX_ATTEMPTS) {
$this->release(60 * $this->attempts());
return;
}
Log::warning('Managed DNS records of a deleted resource could not be cleaned up; they were left in place.', [
'resource_type' => $this->resourceType,
'resource_id' => $this->resourceId,
]);
}
}