Stu Mason
Stu Mason

Activity

Issue Resolved

Issue #13 closed: Add Database Backup Management to Dashboard

Problem

Currently, the Laravel Coolify dashboard does not provide any interface for managing database backups. Users must either:

  • Manually configure backups through the Coolify web UI
  • Use the Coolify API directly
  • Use the MCP (Model Context Protocol) server

This became particularly evident during a recent emergency database recovery scenario where a database was accidentally deleted. Having backup management in the dashboard would provide a safety net and make it easier for users to ensure their critical data is protected.

Proposed Solution

Add a comprehensive database backup management interface to the Laravel Coolify dashboard that allows users to:

1. View Backup Schedules

  • List all configured backup schedules for each database
  • Display backup status (enabled/disabled)
  • Show backup frequency (hourly, daily, weekly, monthly)
  • Display retention settings (days locally, days in S3)
  • Show S3 storage configuration if enabled

2. Create Backup Schedules

Allow users to configure new backup schedules with:

  • Frequency: hourly, daily, weekly, monthly
  • Enabled: Toggle to enable/disable the schedule
  • S3 Storage: Option to save backups to S3-compatible storage
  • S3 Storage Selection: Dropdown of configured S3 storages
  • Retention Settings:
    • Days to keep backups locally (0 = unlimited)
    • Days to keep backups in S3 (0 = unlimited)
    • Amount of backups to keep locally (most recent N)
    • Amount of backups to keep in S3 (most recent N)
  • Database Selection: Which databases to backup (for applicable database types)
  • Dump All: Option to dump all databases (for applicable database types)

3. Update Backup Schedules

  • Edit existing backup configurations
  • Enable/disable schedules without deleting them
  • Change frequency and retention settings

4. Delete Backup Schedules

  • Remove backup schedules when no longer needed
  • Clear warning before deletion

5. View Backup Executions

  • List historical backup executions for each schedule
  • Show execution status (success/failure)
  • Display execution timestamps
  • Show backup size (if available)

Important Considerations

Database Types

Only the following database types should have backup management:

  • PostgreSQL
  • MySQL
  • MariaDB
  • MongoDB

Do NOT show backup options for ephemeral caches:

  • Redis
  • Dragonfly
  • KeyDB
  • ClickHouse (unless specifically required)

Coolify API Endpoints

The following Coolify API endpoints are available (implemented in coolify-mcp v2.1.0):

POST   /api/v1/databases/{uuid}/backups
PATCH  /api/v1/databases/{uuid}/backups/{backup_uuid}
DELETE /api/v1/databases/{uuid}/backups/{backup_uuid}
GET    /api/v1/databases/{uuid}/backups
GET    /api/v1/databases/{uuid}/backups/{backup_uuid}
GET    /api/v1/databases/{uuid}/backups/{backup_uuid}/executions
GET    /api/v1/databases/{uuid}/backups/{backup_uuid}/executions/{execution_uuid}

Request Payload Example

{
  "frequency": "daily",
  "enabled": true,
  "save_s3": true,
  "s3_storage_uuid": "vgsgsc0wgggg40cg88k40000",
  "database_backup_retention_days_locally": 7,
  "database_backup_retention_days_s3": 7
}

User Experience Best Practices

  1. Default Recommendations: Suggest sensible defaults (e.g., daily backups, 7-day retention)
  2. S3 Storage Warning: If no S3 storage is configured, show a warning that backups are only local
  3. Retention Clarity: Clearly explain that "0" means unlimited retention
  4. Database Type Detection: Automatically filter out cache-type databases from backup UI
  5. Visual Status Indicators: Use clear visual indicators for enabled/disabled schedules and successful/failed executions

Acceptance Criteria

  • Dashboard displays list of databases with backup status
  • Users can create new backup schedules for PostgreSQL/MySQL/MariaDB/MongoDB databases
  • Users can edit existing backup schedules (frequency, retention, S3 settings)
  • Users can enable/disable backup schedules without deleting them
  • Users can delete backup schedules
  • Users can view backup execution history
  • Redis/Dragonfly/KeyDB databases are excluded from backup UI
  • Form validation prevents invalid configurations
  • Clear error messages if API calls fail
  • S3 storage dropdown populated from Coolify's configured storages

Context

This feature request comes from real-world experience with the MCP server implementation and a recent database recovery scenario. The backup management functionality has been successfully implemented and tested in the coolify-mcp project (v2.1.0), demonstrating the API endpoints work reliably.