Enables database detection and backup support for Docker Compose deployments via GitHub App (dockercompose buildpack). Previously, database services in these deployments were not detected and ServiceDatabase records were not created, meaning automated backups were unavailable.
Resolves https://github.com/coollabsio/coolify/issues/7528
/claim #7528
parseDockerComposeFile() in bootstrap/helpers/shared.php has two code paths:
| Path | Model | Calls isDatabaseImage() |
Creates ServiceDatabase |
Backups |
|---|---|---|---|---|
| Service model (lines ~1263-2025) | Service |
✅ | ✅ | ✅ |
| Application model (lines ~2026+) | Application |
✅ (already) | ❌ missing | ❌ |
The Application path already called isDatabaseImage() and set is_database, but never created ServiceDatabase records because the existing FK (service_id) only pointed to the services table.
New migration: Adds nullable application_id FK (constrained to applications, cascade on delete) to service_databases table. Makes service_id nullable so Application-owned databases do not need it.
ServiceDatabase:
application() relationship (belongsTo Application)isApplicationOwned() — checks if owned by Application vs ServicegetOwner() — returns the owning Service or ApplicationgetOwnerUuid() — UUID of the ownergetServer() — resolves server through either ownership pathgetNetwork() — resolves network through either ownership pathrestart(), getServiceDatabaseUrl(), team(), workdir() to use helpersownedByCurrentTeam() and ownedByCurrentTeamAPI() to query both ownership pathsApplication:
composeDatabases() HasMany relationshipdockercompose build packforceDeletingshared.php)parseDockerComposeFile(), after isDatabaseImage() detection, creates/updates ServiceDatabase records with application_id (skips preview deployments)ServiceDatabase records when services are removed from the compose filegetResourceByUuid team ownership check to handle Application-owned ServiceDatabasesAll locations that previously used hardcoded ->service->server, ->service->uuid, ->service->destination->network chains now use the new getServer(), getOwnerUuid(), getNetwork() helpers:
DatabaseBackupJob: Server resolution, container naming, network for S3 uploadStartDatabaseProxy / StopDatabaseProxy: Network, server, container name resolutionBackupExecutions: Server resolution for backup deletion and downloadBackupEdit: Server resolution, redirect for Application-owned databasesScheduledDatabaseBackup: Server resolutionImport: Server, container name, network resolutionLocalFileVolume: Server/workdir resolution for file storage operationsdatabases.php helper: Server resolution for backup cleanupweb.php download route: Server resolution for backup file downloadsdockercompose build pack when databases are detected)ComposeBackups Livewire component with database selector and backup managementScheduledBackups and CreateScheduledBackup componentsdockercompose buildpack via GitHub Appdocker-compose.yml containing a database service (e.g., postgres:16-alpine) and at least one non-database serviceServiceDatabase record[!IMPORTANT]
- I have read and understood the contributor guidelines. If I have failed to follow any guideline, I understand that this PR may be closed without review.
- I have tested the changes thoroughly and am confident that they will work as expected without issues when the maintainer tests them
Cristol
@manas-io-ai
Ilias Ism
@me