Skip to content

A Symfony application for managing and automating regular backups of MySQL databases.

License

Notifications You must be signed in to change notification settings

bastien70/dbsaver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DbSaver

Package version Build Status License Code coverage

Database list

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

  1. Prerequisites
  2. Manual install
  3. Install using Task
  4. Configure the CRON job
  5. Use the application
    1. Login
    2. Manage storage spaces
    3. Manage databases
    4. Manage backups
  6. Update the application
  7. License
  8. Contribute
  9. Changelog

Prerequisites

  • PHP 8.1+
  • Composer
  • Symfony CLI (if you want to run the project locally)

Manual install

  1. git clone https://github.com/bastien70/dbsaver.git
  2. cd dbsaver
  3. composer install --optimize-autoloader (install dependencies)
  4. php bin/console app:post-install (project configuration)
  5. php bin/console app:regenerate-app-secret (regenerate the secret key allowing to hash databases passwords)
  6. php bin/console d:d:c (create database)
  7. php bin/console d:m:m -n (migrate tables)
  8. php bin/console app:make-user (create your account)

Install using Task

Requires Symfony CLI and Task to be installed.

  1. git clone https://github.com/bastien70/dbsaver.git
  2. cd dbsaver
  3. task install
  4. If you want to run Docker containers (currently only for local emails with MailCatcher): task docker-start et task docker-stop (requires Docker and Docker Compose)
  5. 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).

Authentication

You will be redirected to https://127.0.0.1:8000/

Homepage

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.

Add storage space

You will find this storage space in the list.

Storage space 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, ...)

Add a database

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.

Database list

Manage backups

To access your databases backups, click the Backups tab.

Backup list

You will be able to download, restore 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 --optimize-autoloader
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.