[Enhancement]: See And Manage DB Backups Via API
Introduction
In today's digital landscape, database backups are a crucial aspect of ensuring data security and integrity. As a developer, having the ability to manage and configure database backups programmatically can be a game-changer. In this article, we will explore the enhancement of the API to allow users to see and manage database backups via API endpoints.
Request Type
This enhancement is a new feature request, aimed at providing users with the ability to manage database backups through API endpoints.
Description
The goal of this enhancement is to provide users with a set of API endpoints that allow them to view and modify database backups. This includes the ability to configure backup settings, view backup details, and delete specific backups.
Ideal Endpoints
To achieve this goal, the following API endpoints are proposed:
GET /databases
This endpoint already exists, but it can be modified to include backup configuration details. The response should include the following information:
- Backup config details: Include the cron schedule, whether backups are configured for local or S3, and the last successful backup timestamp.
- Database details: Include the database UUID, name, and other relevant details.
Example response:
{
"databases": [
{
"uuid": "1234567890",
"name": "my_database",
"backup_config": {
"cron_schedule": "0 0 * * *",
"backup_location": "s3",
"last_successful_backup": "2022-01-01T00:00:00Z"
}
}
]
}
GET /databases/:uuid/backups
This endpoint should return a list of backups with details, similar to what is displayed on the backups detail page in the logged-in interface.
Example response:
{
"backups": [
{
"id": 1,
"database_uuid": "1234567890",
"backup_date": "2022-01-01T00:00:00Z",
"backup_size": 1024,
"backup_location": "s3"
}
]
}
PATCH /databases/:uuid
This endpoint should allow users to configure a database's backups. The request body should include the following information:
- Backup config: Include the cron schedule, whether backups are configured for local or S3, and the backup deletion schedule.
- Database details: Include the database UUID and name.
Example request body:
{
"backup_config": {
"cron_schedule": "0 0 * * *",
"backup_location": "s3",
"backup_deletion_schedule": "1 week"
},
"database": {
"uuid": "1234567890",
"name": "my_database"
}
}
DELETE /databases/:uuid/backups/:backup_id
This endpoint should allow users to delete a specific backup from the S3 or local backup.
Use Case
The use case for this enhancement is to write a script that ensures all apps have backups configured, upload to S3, and aren't taking excessive space on disk. The new API endpoints will be used to achieve this goal.
Requirements
To consider this enhancement "done," the following requirements must be met:
- The API endpoints must be deployed to app.coolify.io.
- The API endpoints must meet the requirements outlined above.
- The API endpoints must be fully functional and able to manage database backups.
Bounty
A bounty of $100 will be paid out upon review that this enhancement meets the requirements outlined above.
Conclusion
Introduction
In our previous article, we explored the enhancement of the API to allow users to see and manage database backups via API endpoints. In this article, we will answer some frequently asked questions (FAQs) related to this enhancement.
Q: What is the purpose of this enhancement?
A: The purpose of this enhancement is to provide users with the ability to manage database backups programmatically through API endpoints. This will allow users to write scripts that ensure all apps have backups configured, upload to S3, and aren't taking excessive space on disk.
Q: What API endpoints are proposed for this enhancement?
A: The proposed API endpoints for this enhancement are:
GET /databases
: Returns a list of databases with backup configuration details.GET /databases/:uuid/backups
: Returns a list of backups with details for a specific database.PATCH /databases/:uuid
: Allows users to configure a database's backups.DELETE /databases/:uuid/backups/:backup_id
: Deletes a specific backup from the S3 or local backup.
Q: What information will be included in the response for the GET /databases
endpoint?
A: The response for the GET /databases
endpoint will include the following information:
- Backup config details: Include the cron schedule, whether backups are configured for local or S3, and the last successful backup timestamp.
- Database details: Include the database UUID, name, and other relevant details.
Q: What information will be included in the response for the GET /databases/:uuid/backups
endpoint?
A: The response for the GET /databases/:uuid/backups
endpoint will include the following information:
- Backup details: Include the backup ID, database UUID, backup date, backup size, and backup location.
Q: What information will be included in the request body for the PATCH /databases/:uuid
endpoint?
A: The request body for the PATCH /databases/:uuid
endpoint will include the following information:
- Backup config: Include the cron schedule, whether backups are configured for local or S3, and the backup deletion schedule.
- Database details: Include the database UUID and name.
Q: What is the use case for this enhancement?
A: The use case for this enhancement is to write a script that ensures all apps have backups configured, upload to S3, and aren't taking excessive space on disk.
Q: What are the requirements for this enhancement to be considered "done"?
A: The requirements for this enhancement to be considered "done" are:
- The API endpoints must be deployed to app.coolify.io.
- The API endpoints must meet the requirements outlined above.
- The API endpoints must be fully functional and able to manage database backups.
Q: What is the bounty for this enhancement?
A: A bounty of $100 will be paid out upon review that this enhancement meets the requirements outlined above.
Conclusion
In conclusion, this Q&A article provides answers frequently asked questions related to the enhancement of the API to allow users to see and manage database backups via API endpoints. We hope this article has provided valuable information to users who are interested in this enhancement.