====== Backups ======
{{indexmenu_n>5}}
Starting with version 2.25.9, the function of backup DB and FS has appeared. By enabling the function, you can configure the frequency of copying, storage duration, as well as export via SCP to a remote storage.
Move to the DB and FS settings section, open the Administrator menu item, section **«Backup settings»**.
{{ :dpi:dpi_components:dpiui:user_guide:admin_section:ckat_dpiui2_conf_backups_new_en.png?880 |}}
====== Configuration ======
===== Enable DB backup =====
To enable DB backup, select "**Enabled**".
{{ :dpi:dpi_components:dpiui:user_guide:admin_section:ckat_dpiui2_conf_backups_db_enabled_new_en.png?880 |}}
__//Specify the following settings//__
* **BACKUP_DB_ENABLED** - enable DB backup. (Default value is Disabled)
* **BACKUP_DB_INTERVAL_MINUTES** - backup DB time interval, minutes. (Default value is 1440)
* **BACKUP_DB_PATH** - backup DB save path. (Default path is /var/dpiui2_backup/db)
* **BACKUP_DB_DELETE_OLD_INTERVAL_MINUTES** - delete old DB backups interval, minutes. (Default value is 0)
When set to "**0**", old backups will not be deleted.
===== Enable FS backup =====
FS backup include **.env** files and folder contents **/var/dpiui2/backend/storage**
To enable FS backup, select "**Enabled**".
{{ :dpi:dpi_components:dpiui:user_guide:admin_section:ckat_dpiui2_conf_backups_fs_enabled_new_en.png?880 |}}
__//Specify the following settings//__
* **BACKUP_FS_ENABLED** - enable FS backup. (Default value is Disabled)
* **BACKUP_FS_INTERVAL_MINUTES** - backup FS time interval, minutes. (Default value is 1440)
* **BACKUP_FS_PATH** - backup FS save path. (Default path is /var/dpiui2_backup/fs)
* **BACKUP_FS_DELETE_OLD_INTERVAL_MINUTES** - delete old FS backups interval, minutes. (Default value is 0)
When set to "**0**", old backups will not be deleted.
===== Remote server for storing backups settings =====
* **BACKUP_SCP_HOST** - remote server host for storing backups.\\
* **BACKUP_SCP_PORT** - remote server port for storing backups.\\
* **BACKUP_SCP_USER** - backup storage username.\\
* **BACKUP_SCP_PASSWORD** - backup storage password.\\
SCP will use key authentication if no password is specified.
* **BACKUP_SCP_DB_PATH** - backup DB remote path. (Default path is /var/dpiui2_backup/db)
The folder must exist. The user must have access rights to this folder.
* **BACKUP_SCP_FS_PATH** - backup FS remote path. (Default path is /var/dpiui2_backup/fs)
The folder must exist. The user must have access rights to this folder.
===== Saving сhanges =====
To save the edited parameters, click the **"Save"** button.
{{ :dpi:dpi_components:dpiui:user_guide:admin_section:ckat_dpiui2_conf_backups_save_new_en.png?880 |}}
====== Data recovery ======
To restore data from Backup, make sure that the dpiui2 server is [[dpi:dpi_components:dpiui:install_and_update:install|installed and running]].
===== Restoring DB from backup =====
To restore the database, upload the database backup file to the dpiui2 server and run the following command in the terminal:
sh /var/www/html/dpiui2/backend/app_bash/vas_codebase/restore_backup_db.sh dpiui2 dpiui2_db_backup.X.tar.gz
===== Restoring FS from backup =====
The file backup includes the **.env** file and **/var/dpiui2/backend/storage** directory contents.
To restore the dpiui2 FS upload the backup file to the dpiui2 server and run the following command:
sh /var/www/html/dpiui2/backend/app_bash/vas_codebase/restore_backup_fs.sh dpiui2 dpiui2_fs_backup.X.tar.gz
After restoring the database and files, make sure everything works.