Table of Contents
-
Introduction
-
Why Backups Matter in ERP Systems
-
Components of a Complete Dolibarr Backup
-
Database Backup: Strategies and Tools
-
File System Backup: What to Include
-
Automated vs. Manual Backup Approaches
-
Using Dolibarr’s Built-in Backup Utility
-
Cron Jobs and Scheduled Backups
-
Encrypting and Securing Your Backups
-
Backup Rotation and Retention Policies
-
Verifying Backup Integrity
-
When and How to Perform Restorations
-
Restoring the Database from SQL Dumps
-
Restoring the Documents Directory
-
Restoring the
conf.php
Configuration File -
Restoring to a Different Server or Version
-
Troubleshooting Restoration Errors
-
Cloud Backups and Remote Storage
-
Best Practices for Disaster Recovery Plans
-
Conclusion
1. Introduction
Dolibarr ERP/CRM holds critical business information—customer records, financial data, project details, and more. Without a reliable backup and restore strategy, a server crash or security breach could result in catastrophic data loss. This guide covers every aspect of safeguarding your Dolibarr instance through robust backup and recovery strategies.
2. Why Backups Matter in ERP Systems
ERP platforms like Dolibarr act as the central nervous system for operations. Backups help recover from:
-
Hardware failures
-
Human errors
-
Malicious attacks (e.g., ransomware)
-
Corrupted updates or failed migrations
Having verified backups is a safety net that no organization should operate without.
3. Components of a Complete Dolibarr Backup
A full backup must include:
-
Database: All ERP data is stored in MySQL/MariaDB
-
Documents: Stored in the
/documents/
directory -
Configuration File:
htdocs/conf/conf.php
holds database access info -
Custom Modules and Scripts: Usually under
/custom/
Omitting any of these can result in incomplete recovery.
4. Database Backup: Strategies and Tools
Use mysqldump
for full backups:
mysqldump -u dolibarr_user -p dolibarr_db > dolibarr_backup.sql
Or use a GUI like:
-
phpMyAdmin
-
MySQL Workbench
Ensure you include structure and data, and avoid partial exports unless you're sure what you're doing.
5. File System Backup: What to Include
Key folders:
-
/documents/
: stores invoices, contracts, uploaded files -
/htdocs/custom/
: your custom modules and themes -
/htdocs/conf/conf.php
: crucial config file
Use tools like rsync
, tar
, or backup software (e.g., Duplicity, Bacula).
6. Automated vs. Manual Backup Approaches
Manual backups:
-
Good for ad hoc backups before upgrades
Automated backups:
-
Ideal for routine protection
-
Use cron jobs and scripts
-
Log backup status
Automate as much as possible, but keep manual options available.
7. Using Dolibarr’s Built-in Backup Utility
Dolibarr offers a simple backup interface:
-
Go to Home > Admin Tools > Backup
-
Choose:
-
Backup of SQL only
-
SQL + documents
-
-
Download the backup
This method is suitable for small to medium installations.
8. Cron Jobs and Scheduled Backups
Set daily backups using cron:
0 2 * * * /usr/bin/mysqldump -u dolibarr_user -p'dbpass' dolibarr_db | gzip > /backups/dolibarr_$(date +\%F).sql.gz
For documents:
0 3 * * * tar -czf /backups/dolibarr_docs_$(date +\%F).tar.gz /var/www/dolibarr/documents/
Store logs and alerts to ensure reliability.
9. Encrypting and Securing Your Backups
Always encrypt backups:
gpg -c dolibarr_2025-05-01.sql.gz
Store encrypted files:
-
Offsite (cloud storage)
-
On secure internal servers with restricted access
Never leave unprotected SQL dumps on production servers.
10. Backup Rotation and Retention Policies
Keep:
-
Daily backups for 7 days
-
Weekly backups for 1 month
-
Monthly backups for 1 year
Use tools like logrotate
, custom scripts, or backup software for retention.
11. Verifying Backup Integrity
Test backups regularly:
-
Restore to a test server
-
Validate data structure and files
-
Check document readability
Backups that haven’t been tested are untrusted.
12. When and How to Perform Restorations
Restore if:
-
A critical error or crash occurs
-
A migration fails
-
A system is compromised
Restoration should follow a checklist and always be tested on staging first.
13. Restoring the Database from SQL Dumps
On new server:
mysql -u dolibarr_user -p dolibarr_db < dolibarr_backup.sql
Ensure conf.php
matches the new database credentials.
14. Restoring the Documents Directory
Use rsync
or tar
:
tar -xzf dolibarr_docs_2025-05-01.tar.gz -C /var/www/dolibarr/
Ensure proper ownership and permissions:
chown -R www-data:www-data /var/www/dolibarr/documents
15. Restoring the conf.php
Configuration File
Manually copy the backed-up conf.php
file into /htdocs/conf/
. Adjust permissions:
chmod 444 conf.php
Make sure the database credentials in the file are valid.
16. Restoring to a Different Server or Version
When moving servers:
-
Ensure matching Dolibarr versions
-
Restore database and files
-
Reconfigure Apache/Nginx
-
Update
conf.php
paths
For version mismatches, restore and then perform upgrade steps manually.
17. Troubleshooting Restoration Errors
Common issues:
-
SQL syntax errors (version mismatch)
-
Missing tables or corrupted dump
-
File permission problems
Always keep a log of the restore process and check Dolibarr’s logs for errors.
18. Cloud Backups and Remote Storage
Use solutions like:
-
Amazon S3
-
Dropbox via rclone
-
Google Drive with scheduled sync
Ensure backups are encrypted before upload and test remote access regularly.
19. Best Practices for Disaster Recovery Plans
-
Maintain at least 3 backup copies (local, remote, offsite)
-
Define RTO (Recovery Time Objective) and RPO (Recovery Point Objective)
-
Assign backup responsibility to specific team members
-
Document and test the recovery process twice a year
20. Conclusion
Dolibarr’s flexibility and power depend on the integrity of your data. Without reliable backups, you risk permanent loss and operational downtime. This guide provides the structure and strategy needed to back up, restore, and protect your ERP environment efficiently.