Skip to content

[Enhancement]: See and manage DB backups via API #5697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: next
Choose a base branch
from

Conversation

DanielHemmati
Copy link

@DanielHemmati DanielHemmati commented Apr 25, 2025

Changes

  • Add backup configuration to GET /databases API including weather backups are configured locally or via s3 bucket, cron schedule and last successful backup timestamp
  • The ability to get the list of backups with detail for a database by using GET /databases/:uuid/backups
  • Enhance PATCH /databases/:uuid API. Right now you can configure all of the backup detail you see in the backup panel, including creating a backup, all via api.
  • Add the ability to delete a specific backup weather from s3 or locally DELETE /databases/:uuid/backups/:backup_id

I also recorded a video showing a demo: https://www.youtube.com/watch?v=hbN-ygTPBRc
Also I wrote a python script show casing how it can be used via API: https://github.com/DanielHemmati/coolify-api-demo

Issues

/claim #5672

@algora-pbc algora-pbc bot added the 🙋 Bounty claim Issues or PRs that have a Bounty ready to be claimed. label Apr 25, 2025
@andrasbacsai andrasbacsai deleted the branch coollabsio:next May 9, 2025 06:31
@DanielHemmati
Copy link
Author

Hi @andrasbacsai,

I noticed the PR was closed without being merged, and the branch was deleted. I’d really appreciate a bit of feedback if possible, was there something wrong with the implementation, or was the feature no longer needed?

Understanding what went wrong would help me improve for future contributions. Thanks a lot!

@andrasbacsai andrasbacsai reopened this May 9, 2025
@andrasbacsai
Copy link
Member

It was a mistake, sorry. I recreated the next branch and it auto-closed this PR.

@andrasbacsai
Copy link
Member

Thanks for the PR and the video! Enjoyed reviewing it.

I found a few things that needs to be fixed:

  1. PATCH /databases/:uuid updates the first backup only. This should only update the database related things.
  2. PATCH /databases/:uuid/backups/:backup_id this does not exists but should be. This should update the backup related configurations.

Can you please modify the code accordingly?

@peaklabs-dev peaklabs-dev added the 💤 Waiting for changes PRs awaiting changes from the author. label May 20, 2025
@DanielHemmati
Copy link
Author

Hi @andrasbacsai, Thanks a lot for the feedback!

Just to confirm:
I'll have to undo the logic in PATCH /databases/:uuid so that it only updates the database-related fields.

Then I'll introduce a new route:
PATCH /databases/:uuid/backups/:backup_id, which will specifically handle updates to individual backup configurations.
This will allow users to modify the settings for each backup independently.

@DanielHemmati
Copy link
Author

Hey @andrasbacsai, here are the changes i have done right now.

  1. Separated backup config logic:
    Moved all backup configuration logic from the update_by_uuid method into a new method called update_backup_config_by_uuid_and_backup_id. Now, update_by_uuid is focused solely on updating the database configuration.

  2. Removed backup creation logic:
    Since the route PATCH /database/<db-uuid>/backups/<backup_id> implies an update to an existing backup, it no longer supports backup creation. If needed, I can introduce a separate route specifically for creating backups.

  3. Removed removeSensitiveData from database_backup_details_uuid:
    I removed this call because it prevented access to the backup_id, which is necessary for identifying the correct backup configuration.

@peaklabs-dev peaklabs-dev removed the 💤 Waiting for changes PRs awaiting changes from the author. label May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 Bounty claim Issues or PRs that have a Bounty ready to be claimed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants