Module BackupGuard: Difference between revisions

Jump to navigation Jump to search
Module update (editor: Theo Pequignot)
(Direct DoliStore link)
(Module update (editor: Theo Pequignot))
Line 18: Line 18:
|-
|-
! Version
! Version
| 1.0.0
| 2.2.0
|-
|-
! Dolibarr
! Dolibarr
Line 42: Line 42:
* '''Verification and log''': SHA-256 of the final file, zip integrity, end marker inside database.sql, control decryption of the first 64 KB. Every run is logged (status, size, duration, tables, rows, files, result per destination, trigger). Email alerts on failure and when no successful backup exists for N days.
* '''Verification and log''': SHA-256 of the final file, zip integrity, end marker inside database.sql, control decryption of the first 64 KB. Every run is logged (status, size, duration, tables, rows, files, result per destination, trigger). Email alerts on failure and when no successful backup exists for N days.
* '''Dashboard''' (Tools, Backups): last successful backup, scheduling state, server diagnostic (mysqldump, extensions, disk space, estimated size), destinations, last thirty runs with download and deletion of the local file.
* '''Dashboard''' (Tools, Backups): last successful backup, scheduling state, server diagnostic (mysqldump, extensions, disk space, estimated size), destinations, last thirty runs with download and deletion of the local file.
* '''Restore''' from the command line with the provided script: decryption, verification, SQL import statement by statement, documents extraction.
* '''Restore from the browser''': chunked upload, analysis without any change, control of every SQL statement, safety backup of the current state, restore in short steps followed live, "Retry" and "Go back to the previous state" buttons if it stops halfway. Also used to move to a fresh Dolibarr where only BackupGuard is installed. A command line script is still provided for very large databases.
* '''Dolibarr update''': the latest maintenance release and the next major version are offered; the official package is checked file by file against the checksums published by Dolibarr, a full backup and a copy of the replaced files are made first, and a button puts the previous files back as long as the database has not been upgraded.


== Installation ==
== Installation ==
Line 60: Line 61:
* ''Run'': start a backup, download and delete local files. A backup contains the whole database: grant this right with care.
* ''Run'': start a backup, download and delete local files. A backup contains the whole database: grant this right with care.
* ''Setup'': settings (administrators only).
* ''Setup'': settings (administrators only).
* Restoring a backup and updating Dolibarr are reserved to administrators.


== Restore ==
== Restore a backup ==
 
=== From the browser ===
Tools, Backups, "Restore a backup" button.
# Upload the .zip or .zip.enc file (with its passphrase when encrypted), or pick a backup already on the server. The upload is sent in 2 MB chunks: the PHP upload size limit does not apply.
# '''Analysis''', without changing anything: decryption, integrity, Dolibarr versions, content, modules. The restore is refused when the backup comes from a more recent Dolibarr than the installed one. Warnings (upgrade needed, different table prefix, missing modules) are shown before going on.
# '''Options''': safety backup of the current state (recommended), documents, external modules. Confirm by typing the requested word.
# '''SQL control''': every statement of the backup is checked before anything is written; only those of a dump, on Dolibarr tables, go through.
# '''Restore''' in short steps, followed live: the PHP maximum execution time is not an obstacle. Passwords encrypted by Dolibarr (SMTP, API keys) are re-encrypted for the new installation when the backup is encrypted.
# Log in again. When the backup comes from an older version, a button opens the Dolibarr upgrade wizard.
If the restore stops halfway, "Retry" resumes without duplicating anything and "Go back to the previous state" puts the safety backup back.
 
=== From the command line ===
For very large databases, or when Dolibarr no longer starts.
# Get the file dolibarr-<database>-YYYY-MM-DD-HHMM.zip.enc from a destination or the dashboard.
# Get the file dolibarr-<database>-YYYY-MM-DD-HHMM.zip.enc from a destination or the dashboard.
# Decrypt it with openssl (see above) or let the script do it (passphrase asked on the keyboard or read from the environment variable BACKUPGUARD_ENCRYPTION_PASSWORD).
# Decrypt it with openssl (see above) or let the script do it (passphrase asked on the keyboard or read from the environment variable BACKUPGUARD_ENCRYPTION_PASSWORD).
# Put Dolibarr in maintenance mode, then on the target server: <code>php htdocs/custom/backupguard/scripts/restore.php backup.zip.enc --documents=/path/to/documents</code>. The script verifies the archive, shows its content, asks for confirmation, imports database.sql (each table is dropped and recreated) and extracts documents/.
# Put Dolibarr in maintenance mode, then on the target server: <code>php htdocs/custom/backupguard/scripts/restore.php backup.zip.enc --documents=/path/to/documents</code>.
# Clear the Dolibarr cache (documents/admin/temp) and log in again.
# Clear the Dolibarr cache (documents/admin/temp) and log in again.
== Update Dolibarr ==
Tools, Backups, "Update Dolibarr" button. The page shows the installed version, the checks (web server write access, curl and zip extensions, disk space) and two offers: the latest maintenance release, and the next major version (Dolibarr is upgraded one major version at a time).
# '''Prepare''', without changing anything: download of the official package, then control of every file (PHP, JavaScript, migration SQL, images) against the checksums published on dolibarr.org and, for what they do not cover, those of the release on GitHub. An altered or unknown file makes the update refused.
# '''Confirm''': full safety backup, copy of the files about to be replaced, then writing of the new files. The configuration and the custom directory are never touched.
# '''Upgrade the database''' with the Dolibarr wizard, opened by a button (upgrade.unlock since Dolibarr 17).
# As long as the database has not been upgraded, a button puts the previous files back.
Under Docker, the Dolibarr files belong to the image: the page explains what to do (change the image version) instead of replacing files.


== Known limits ==
== Known limits ==
Line 71: Line 94:
* Database dump for MySQL and MariaDB only. On PostgreSQL the module says so and backs up the documents only.
* Database dump for MySQL and MariaDB only. On PostgreSQL the module says so and backs up the documents only.
* Views, triggers and stored procedures are not exported (Dolibarr creates none).
* Views, triggers and stored procedures are not exported (Dolibarr creates none).
* No restore from the web interface, by design.
* A backup can only be restored on the same or a more recent Dolibarr version.
* Updating Dolibarr requires the web server to be able to write the Dolibarr files; otherwise the page says so and nothing is changed. External modules are not updated.
* FTP and SFTP depend on the PHP extensions ftp and ssh2. WebDAV: Basic authentication only (Nextcloud, ownCloud, kDrive, Apache mod_dav).
* FTP and SFTP depend on the PHP extensions ftp and ssh2. WebDAV: Basic authentication only (Nextcloud, ownCloud, kDrive, Apache mod_dav).
* Encryption protects the remote copy, not the server itself: whoever reads the Dolibarr configuration reads the passphrase.
* Encryption protects the remote copy, not the server itself: whoever reads the Dolibarr configuration reads the passphrase.
Line 87: Line 111:
File:TheoPequignot-BackupGuard-destinations.png|Destinations with the connection test
File:TheoPequignot-BackupGuard-destinations.png|Destinations with the connection test
File:TheoPequignot-BackupGuard-schedule.png|Scheduling, URL trigger and retention
File:TheoPequignot-BackupGuard-schedule.png|Scheduling, URL trigger and retention
File:TheoPequignot-BackupGuard-restore.png|Restoring a backup from the browser
File:TheoPequignot-BackupGuard-upgrade.png|Updating Dolibarr: checks and offered versions
</gallery>
</gallery>
== Versions ==
* '''2.2.0''' (2 October 2026): '''update recommended for everyone'''. The command line scripts (scripts/backup.php and scripts/restore.php) could be called through the web server without logging in; they now only answer on the command line. Restore: every SQL statement is checked, restore across different servers (MySQL 8 and MariaDB), "Retry" and "Go back to the previous state" buttons. Dolibarr update: every file of the package is checked. Dump: BIT and JSON columns fixed.
* '''2.1.0''' (2 October 2026): Dolibarr update from the module.
* '''2.0.0''' (2 October 2026): restore from the browser, external modules included in the backup, encrypted passwords carried to the new installation.
* '''1.0.0''' (2 October 2026): first version.


== Support ==
== Support ==
Questions before buying, installation or update issues: write to [mailto:contact@theopequignot.fr contact@theopequignot.fr]. I am the developer of this module and I answer myself. Support and updates are included for 2 years with the DoliStore purchase.
Questions before buying, installation or update issues: write to [mailto:contact@theopequignot.fr contact@theopequignot.fr]. I am the developer of this module and I answer myself. Support and updates are included for 2 years with the DoliStore purchase.
146

edits

Navigation menu