|
5 | 5 | [](LICENSE) |
6 | 6 | [](https://codecov.io/gh/bastien70/dbsaver/branch/main) |
7 | 7 |
|
8 | | - |
| 8 | + |
9 | 9 |
|
10 | 10 | DbSaver is an application written by **Bastien LOUGHIN** allowing you to make automatic daily backups (and manual backups) for your MySQL databases. |
| 11 | +All you have to do is fill the credentials to access the databases, configure a CRON job... and it's done. |
| 12 | +Passwords will be automatically hashed. |
11 | 13 |
|
12 | | -## Documentation |
| 14 | +Then, using DbSaver, you can access your databases backups by browsing the **Backups** tab. |
13 | 15 |
|
14 | | -See [docs/english.md](docs/english.md) for English docs or [docs/french.md](docs/french.md) for French docs. |
| 16 | +You can then use DbSaver to access databases backups by going to the **Backups** tab. |
| 17 | +Backups can be saved **locally** or in **S3 cloud** (AWS, Scaleway, ...). |
| 18 | + |
| 19 | +/!\ DbSaver only backups databases. Files (like image uploads) are not saved. |
| 20 | + |
| 21 | +# Table of contents |
| 22 | + |
| 23 | +1. [Prerequisites](#prerequisites) |
| 24 | +1. [Manual install](#manual-install) |
| 25 | +1. [Install using Task](#task-install) |
| 26 | +1. [Configure the CRON job](#cron) |
| 27 | +1. [Use the application](#use-app) |
| 28 | + 1. [Login](#login) |
| 29 | + 1. [Manage storage spaces](#storage-spaces) |
| 30 | + 1. [Manage databases](#databases) |
| 31 | + 1. [Manage backups](#backups) |
| 32 | +1. [Update the application](#update-app) |
| 33 | +1. [License](#license) |
| 34 | +1. [Contribute](#contribute) |
| 35 | +1. [Changelog](#changelog) |
| 36 | + |
| 37 | + |
| 38 | +## Prerequisites <a name="prerequisites"></a> |
| 39 | + |
| 40 | +* PHP 8.1+ |
| 41 | +* Composer |
| 42 | +* Symfony CLI (if you want to run the project locally) |
| 43 | + |
| 44 | +## Manual install <a name="manual-install"></a> |
| 45 | + |
| 46 | +1. `git clone https://github.com/bastien70/dbsaver.git` |
| 47 | +1. `cd dbsaver` |
| 48 | +1. `composer install` (install dependencies) |
| 49 | +1. `php bin/console app:post-install` (project configuration) |
| 50 | +1. `php bin/console app:regenerate-app-secret` (regenerate the secret key allowing to hash databases passwords) |
| 51 | +1. `php bin/console d:d:c` (create database) |
| 52 | +1. `php bin/console d:m:m -n` (migrate tables) |
| 53 | +1. `php bin/console app:make-user` (create your account) |
| 54 | + |
| 55 | +## Install using Task <a name="task-install"></a> |
| 56 | + |
| 57 | +Requires [Symfony CLI](https://symfony.com/download) and [Task](https://taskfile.dev/) to be installed. |
| 58 | + |
| 59 | +1. `git clone https://github.com/bastien70/dbsaver.git` |
| 60 | +1. `cd dbsaver` |
| 61 | +1. `task install` |
| 62 | +1. 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) |
| 63 | +1. To start the server: `task start` (to stop it: `task stop`) |
| 64 | + |
| 65 | +## Configure the CRON job <a name="cron"></a> |
| 66 | + |
| 67 | +Configuring a CRON job allows you to automatically backup databases at the frequency of your choice. |
| 68 | + |
| 69 | +Here is the command to run: `php bin/console app:backup` |
| 70 | + |
| 71 | +Initialize a CRON job on your server or computer: |
| 72 | + |
| 73 | +`[path to php] [path to project root]/bin/console app:backup` |
| 74 | + |
| 75 | +## Use the application <a name="use-app"></a> |
| 76 | + |
| 77 | +After deploying the application on your server (or launching it locally) access the login page. |
| 78 | +For the example the host will be `127.0.0.1:8000`. |
| 79 | + |
| 80 | +### Login <a name="login"></a> |
| 81 | + |
| 82 | +Access the app: https://127.0.0.1:8000/login |
| 83 | + |
| 84 | +You'll be asked to log in. Enter your account credentials (that you created using the `php bin/console app:make-user` command). |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +You will be redirected to https://127.0.0.1:8000/ |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | +### Manage storage spaces <a name="storage-spaces"></a> |
| 93 | + |
| 94 | +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`. |
| 95 | +Fill in the information for your storage space and validate. |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +You will find this storage space in the list. |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | +### Manage databases <a name="databases"></a> |
| 104 | + |
| 105 | +To create a database, click the `Databases` tab, then the `Add a database` button. |
| 106 | +Fill your database information and submit. |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +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. |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +According to the frequency of the CRON job you configured, automatic backups will be performed. |
| 115 | + |
| 116 | +### Manage backups <a name="backups"></a> |
| 117 | + |
| 118 | +To access your databases backups, click the `Backups` tab. |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | +You will be able to download or delete a backup. |
| 123 | + |
| 124 | +## Update the application <a name="update-app"></a> |
| 125 | + |
| 126 | +If you have Task and Symfony CLI installed, just run this command: `task update` |
| 127 | + |
| 128 | +Else run the following commands instead: |
| 129 | + |
| 130 | +```bash |
| 131 | +git pull --rebase |
| 132 | +composer install |
| 133 | +php bin/console doctrine:migrations:migrate --no-interaction |
| 134 | +php bin/console app:post-install --only-missing |
| 135 | +``` |
| 136 | + |
| 137 | +## License <a name="license"></a> |
| 138 | + |
| 139 | +This application is protected by a MIT license: [LICENCE](../LICENSE). |
| 140 | + |
| 141 | +## Contribute <a name="contribute"></a> |
| 142 | + |
| 143 | +Before making a pull request, don't forget to run these commands (requires Task and Docker Compose): |
| 144 | + |
| 145 | +```bash |
| 146 | +task ci |
| 147 | +task test |
| 148 | +``` |
| 149 | + |
| 150 | +Note: you can run these commands without Task, have a look to the [Taskfile.yaml](Taskfile.yaml) file to see which commands will run. |
| 151 | + |
| 152 | +## Changelog <a name="changelog"></a> |
| 153 | + |
| 154 | +See the [changelog](CHANGELOG.md). |
0 commit comments