Summary

This PR adds automatic database detection for Docker Compose Applications (deployed via GitHub App / git-based sources) and enables scheduled backup support for those databases — the same backup functionality that already exists for Service-based Docker Compose resources.

Problem

When using Docker Compose via the Application path (GitHub App, git source, etc.), database containers (PostgreSQL, MySQL, MariaDB, MongoDB) are deployed but Coolify has no awareness they are databases. Users cannot schedule backups for these databases through the UI, unlike databases deployed through the Service path.

Solution

Database Detection (\ootstrap/helpers/shared.php)

  • During Application compose parsing, \isDatabaseImage()\ identifies database containers
  • Creates \ServiceDatabase\ records with \pplication_id\ (instead of \service_id)
  • Stale records are cleaned up when services are removed from the compose file

Model & Migration (\ServiceDatabase, \Application)

  • Migration adds nullable \pplication_id\ column to \service_databases\ table
  • \ServiceDatabase\ gains dual-path resolution: \getServer(), \getContainerName(), \ eam(), \workdir()\ all handle both Service-based and Application-based contexts
  • \Application\ model gains \composeDatabases()\ relationship

Backup Job Support (\DatabaseBackupJob)

  • Server resolution uses \getServer()\ which handles both paths
  • Container name resolution uses \getContainerName()\ with dynamic Docker lookup for Application compose containers (handles non-consistent naming with timestamp suffixes)
  • Live Docker container status check for Application-based databases (since status field isn’t updated by the Service monitoring path)

Container Status Monitoring (\PushServerUpdateJob)

  • Updates \ServiceDatabase\ status for Application compose containers during regular health checks

UI (new Livewire components + blade views)

  • \Database Backups\ tab added to Application configuration (visible only for \dockercompose\ build pack with detected databases)
  • \ComposeDatabaseList\ — lists detected databases with backup support
  • \ComposeDatabaseBackups\ — per-database backup scheduling, execution viewing, and import (reuses existing \CreateScheduledBackup, \ScheduledBackups, \BackupEdit, \BackupExecutions, and \Import\ components)

Cleanup & Consistency

  • \DeleteResourceJob\ cleans up compose database records + backups on Application deletion
  • \BackupEdit, \BackupExecutions, \Import, \ScheduledDatabaseBackup\ all updated to use \getServer()\ instead of hardcoded \service->server\ paths
  • \ownedByCurrentTeam()\ queries include Application-based ServiceDatabase records

Files Changed (17 files, +468/-30)

File Change
\database/migrations/2026_01_28_000001_…\ New: adds \pplication_id\ to \service_databases\
\pp/Models/ServiceDatabase.php\ Dual-path methods, \pplication()\ relationship
\pp/Models/Application.php\ \composeDatabases()\ relationship
\ootstrap/helpers/shared.php\ Database detection in Application compose parsing
\pp/Jobs/DatabaseBackupJob.php\ Application-aware backup execution
\pp/Jobs/PushServerUpdateJob.php\ Compose database status tracking
\pp/Jobs/DeleteResourceJob.php\ Compose database cleanup on delete
\pp/Livewire/Project/Application/ComposeDatabaseList.php\ New: database list component
\pp/Livewire/Project/Application/ComposeDatabaseBackups.php\ New: backup management page
\
esources/views/livewire/…/compose-database-list.blade.php\ New: database list UI
\
esources/views/livewire/…/compose-database-backups.blade.php\ New: backup scheduling UI
\
esources/views/livewire/…/configuration.blade.php\ Database Backups tab
\
outes/web.php\ New routes for compose database backups
\pp/Livewire/Project/Database/BackupEdit.php\ Uses \getServer()\
\pp/Livewire/Project/Database/BackupExecutions.php\ Uses \getServer()\
\pp/Livewire/Project/Database/Import.php\ Compose database support
\pp/Models/ScheduledDatabaseBackup.php\ Uses \getServer()\

Resolves #7528 /claim #7528

Claim

Total prize pool $100
Total paid $0
Status Pending
Submitted January 28, 2026
Last updated January 28, 2026

Contributors

NE

nexicturbo

@nexicturbo

100%

Sponsors

IL

Ilias Ism

@me

$100