dbsaver
dbsaver copied to clipboard
A Symfony application for managing and automating regular backups of MySQL databases.
DbSaver
DbSaver is an application written by Bastien LOUGHIN allowing you to make automatic daily backups (and manual backups) for your MySQL databases. All you have to do is fill the credentials to access the databases, configure a CRON job... and it's done. Passwords will be automatically hashed.
Then, using DbSaver, you can access your databases backups by browsing the Backups tab.
You can then use DbSaver to access databases backups by going to the Backups tab. Backups can be saved locally or in S3 cloud (AWS, Scaleway, ...).
/!\ DbSaver only backups databases. Files (like image uploads) are not saved.
Table of contents
- Prerequisites
- Manual install
- Install using Task
- Configure the CRON job
-
Use the application
- Login
- Manage storage spaces
- Manage databases
- Manage backups
- Update the application
- License
- Contribute
- Changelog
Prerequisites
- PHP 8.1+
- Composer
- Symfony CLI (if you want to run the project locally)
Manual install
-
git clone https://github.com/bastien70/dbsaver.git
-
cd dbsaver
-
composer install
(install dependencies) -
php bin/console app:post-install
(project configuration) -
php bin/console app:regenerate-app-secret
(regenerate the secret key allowing to hash databases passwords) -
php bin/console d:d:c
(create database) -
php bin/console d:m:m -n
(migrate tables) -
php bin/console app:make-user
(create your account)
Install using Task
Requires Symfony CLI and Task to be installed.
-
git clone https://github.com/bastien70/dbsaver.git
-
cd dbsaver
-
task install
- If you want to run Docker containers (currently only for local emails with MailCatcher):
task docker-start
ettask docker-stop
(requires Docker and Docker Compose) - To start the server:
task start
(to stop it:task stop
)
Configure the CRON job
Configure the CRON task allows you to activate the verification of backups to be made. Set it up to run every day.
When you add databases, you can each time configure the periodicity of the backups to be made. The CRON task will automatically fetch the databases that need to be backed up and perform the automatic backup.
Here is the command to run: php bin/console app:backup
Initialize a CRON job on your server or computer:
[path to php] [path to project root]/bin/console app:backup
Use the application
After deploying the application on your server (or launching it locally) access the login page.
For the example the host will be 127.0.0.1:8000
.
Login
Access the app: https://127.0.0.1:8000/login
You'll be asked to log in. Enter your account credentials (that you created using the php bin/console app:make-user
command).
You will be redirected to https://127.0.0.1:8000/
Manage storage spaces
To create a storage space (locally or using S3), click on the Storage spaces
tab then on the one you want. Then click on Add storage space
.
Fill in the information for your storage space and validate.
You will find this storage space in the list.
Manage databases
To create a database, click the Databases
tab, then the Add a database
button.
Fill your database information.
Then, check the backup options to your needs.
Finally, configure the periodicity at which a backup must be executed for your database (example: every day, every 2 weeks, every 3 months, ...)
Then, for every database you add, you will be able to see its backups, update its credentials, delete the database from the app (and its backups) or launch a manual backup.
Manage backups
To access your databases backups, click the Backups
tab.
You will be able to download or delete a backup.
Update the application
If you have Task and Symfony CLI installed, just run this command: task update
Else run the following commands instead:
git pull --rebase
composer install
php bin/console doctrine:migrations:migrate --no-interaction
php bin/console app:post-install --only-missing
License
This application is protected by a MIT license: LICENCE.
Contribute
Before making a pull request, don't forget to run these commands (requires Task and Docker Compose):
task ci
task test
Note: you can run these commands without Task, have a look to the Taskfile.yaml file to see which commands will run.
Changelog
See the changelog.