Skip to content

fix: enable database detection and backup support for Docker Compose GitHub App deployments#8483

Closed
hussain-alsaibai wants to merge 1 commit intocoollabsio:v4.xfrom
hussain-alsaibai:fix/docker-compose-database-detection
Closed

fix: enable database detection and backup support for Docker Compose GitHub App deployments#8483
hussain-alsaibai wants to merge 1 commit intocoollabsio:v4.xfrom
hussain-alsaibai:fix/docker-compose-database-detection

Conversation

@hussain-alsaibai
Copy link
Copy Markdown

Summary

Fixes #7528

Database services in Docker Compose files deployed via GitHub App (dockercompose buildpack) are now detected and backed up, matching the behavior of Empty Docker Compose and one-click service deployments.

Root Cause

parseDockerComposeFile() in bootstrap/helpers/shared.php has two paths:

  • Service model path (~line 1263): calls isDatabaseImage(), creates ServiceDatabase records ✅
  • Application model path (~line 2026): did NOT call isDatabaseImage(), no backup support ❌

Changes

New Files

  • app/Models/ApplicationDatabase.php — mirrors ServiceDatabase, supports scheduled backups via polymorphic relationship
  • app/Policies/ApplicationDatabasePolicy.php — team-based authorization
  • database/migrations/2025_02_19_000001_create_application_databases_table.php
  • database/migrations/2025_02_19_000002_add_image_to_application_databases.php

Modified Files

  • bootstrap/helpers/shared.php — added isDatabaseImage() detection in Application path, creates ApplicationDatabase records via firstOrCreate()
  • app/Models/Application.php — added databases() hasMany relationship
  • app/Models/ScheduledDatabaseBackup.php — updated server() to handle ApplicationDatabase morph
  • app/Providers/AuthServiceProvider.php — registered new policy

Result

Deployment Method Creates DB Record Backups Available
Empty Docker Compose ✅ ServiceDatabase
GitHub App (dockercompose) ApplicationDatabase (NEW)
One-click Services ✅ ServiceDatabase

Backup scheduling reuses existing ScheduledDatabaseBackup infrastructure via polymorphic relationship — no new backup UI needed.

@github-actions
Copy link
Copy Markdown
Contributor

This PR did not pass quality checks so it will be closed. If you believe this is a mistake please let us know.

@github-actions github-actions bot closed this Feb 20, 2026
@hussain-alsaibai
Copy link
Copy Markdown
Author

Hi maintainers 👋

This PR was auto-closed by the quality gate, but I believe the code is solid and worth a manual review. The fix is targeted and minimal:

  • Root cause identified in parseDockerComposeFile() — Application path does not call isDatabaseImage() unlike the Service path
  • Added ApplicationDatabase model mirroring ServiceDatabase with full backup support
  • Used firstOrCreate() to prevent duplicates
  • No breaking changes to existing behavior

The account hussain-alsaibai is new (low merge ratio) which triggered the gate — but the implementation is legitimate. Would appreciate a quality/exempt label if you think the fix is on the right track.

Happy to adjust the approach based on your feedback. Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Integrated backups for Git based Docker Composes

1 participant