Automatic Backup of Odoo Database and Filestore: schedule, SFTP, retention, restore check
by Aerya IT Solutions https://aerya.net$ 54.79
Odoo 17, 18, 19 and 20, Community and Enterprise · Developed in the European Union by Aerya IT Solutions
Automatic Backup of Odoo Database and Filestore: schedule, SFTP, retention, restore check
Backups of the database and the filestore of your Odoo server on a schedule, copied to a folder and an SFTP server, pruned by a retention rule, checked by a restore into a temporary database, and reported by e-mail when something fails.
One archive the Odoo database manager restores, or dump plus filestore
Folder on the server and SFTP with a pinned host key
Retention by newest, day, week and month; e-mail on failure
Runs on servers you run yourself (on-premise). Not available on Odoo Online or Odoo.sh. Please buy the version that matches your database.
Screenshots of Odoo 17 Enterprise with the data of a fictitious company; on Odoo 18 to 20 the same screens follow the look of that version. The module works on Community and Enterprise.
schedule, formats, retention, targets, failures, checks, security, browser
needs pg_dump on the Odoo server, no other module
code review against Odoo's security rules, findings fixed
no warnings
A backup nobody checked is a hope
A company that runs Odoo on its own server needs a copy of the database and of the filestore (the attached files) somewhere else, made every day, kept for a sensible time and tested. In practice it is a script someone wrote once. It fills the disk because nothing deletes old copies, it fails silently, and the day a restore is needed it turns out that the file was never complete.
This module runs the backups from inside Odoo, on a schedule you set, keeps a record of every run and tells you by e-mail when something goes wrong.
A plan says what, when, where and how long
Choose the database with its filestore (or the database only), the format, the schedule (every few hours, every day at an hour, every week) and the targets. The retention rule keeps the newest backups plus one per day, week and month for as long as you decide.
Run now starts a backup in the background; the scheduled action checks the plans every 15 minutes.

Every run keeps its story
Each run records its sizes, the SHA-256 of every file, the result of the restore check and the state of each copy on each target, with the full log. A target that refuses the file shows its error text, the other targets still get theirs, and the run is marked incomplete.

A copy on disk and a copy somewhere else
A target is a folder on the server (written under a temporary name, then renamed, readable by the Odoo user only) or an SFTP server. SFTP uses key login and a pinned host key: Scan host key shows its fingerprint to compare with your provider's, and the connection is refused if the server ever presents another key. Test the connection writes, reads back and deletes a small file.
Every uploaded file is size-checked on the target; if a copy fails, the half set is removed from that target.

A backup you have checked
Read the files back opens the archive and verifies every member (zip CRC, gzip stream, the table of contents of the dump). Restore into a temporary database loads the dump into a scratch database, counts the installed modules and drops it again, so you know the backup restores before the day you need it.

A message when something goes wrong
When a backup fails, is incomplete or fails its check, the users you chose get an e-mail with the result, the files, the targets and the error text. An e-mail on success is optional. Old backups are deleted by the retention rule; a file that cannot be deleted is retried at every run and flagged.

More screenshots

Backup plans with the next run and the last result

Stored files, one line per file and target
Compatibility
| Versions | Odoo 17, 18, 19, 20 |
| Editions | Community and Enterprise |
| Requires | Odoo core (Mail) only; pg_dump on the server running Odoo, and the sftp program for SFTP targets |
| Where | Servers you run yourself (own server, virtual machine, container). Not for Odoo Online or Odoo.sh |
| Formats | One .zip (dump.sql, manifest, filestore) or .dump plus filestore .tar.gz |
| Access | Group Backup manager (given to administrators); nobody else sees a backup setting |
| Languages | English, Spanish, Romanian |
What it stops on
A clear message names the case: no pg_dump on the server (Odoo Online and Odoo.sh are not supported), a pg_dump older than the database server, no sftp program, a missing key or host key, a host key that changed, not enough free space for the working files or on a folder, a plan already running.
Not included: encryption of the files (protect the target folder or use an encrypted disk), SFTP with a password or a key with a passphrase, and an automatic restore: the plan form explains the two manual restores.
How it works, step by step
- Install. The server needs the PostgreSQL client tools (
pg_dump), at least as new as the database server, and thesftpprogram for SFTP targets. Administrators get the group Backup manager. - Add a target. Backups › Targets: a folder on the server (an absolute path writable by the Odoo user, preferably on another disk) or an SFTP server with host, port, user, remote folder and private key. Press Scan host key, compare the fingerprint with the one your provider publishes, then Test the connection.
- Create a plan. Backups › Plans: what to save (database and filestore, or database only), the format, the schedule, the targets and the retention.
- Choose the check and the people. In Check and notification pick how the backup is verified and which users get the e-mail. Set an outgoing mail server.
- Run it once. Run now starts a backup in the background. Backups › Runs shows the log, the sizes, the SHA-256 of each file and the state of every copy.
- Let it run. A scheduled action looks at the plans every 15 minutes. Backups › Stored files lists one line per file and target.
Settings and options
| Format | One zip archive (dump.sql, manifest and filestore) that the Odoo database manager can restore, or a pg_dump custom file plus a filestore tar.gz. |
| Schedule | Every few hours, every day at an hour, or every week. |
| Retention | Keep the newest N backups plus the newest of each of the last D days, W weeks and M months. The newest backup is never deleted. |
| Restore check | Read the files back, or restore into a temporary database that is dropped afterwards. |
| Cron time limit | With workers, a big database needs a longer limit_time_real_cron. The plan form warns when it is under one hour. |
A backup whose check failed does not count toward the retention rule and is removed once a newer good one exists.
Frequently asked questions
Does it restore for me?
No. The plan form explains the two manual restores. Test a restore on another server now and then.
Are the backup files encrypted?
No. Protect the target folder, or use an encrypted disk or an SFTP account that only your backup system can read. The backup holds the whole database.
Can it run on Odoo Online or Odoo.sh?
No. Without access to pg_dump the plan refuses to run, and says so.
What if one target is down?
The other targets still get their copy. The run is marked incomplete and the users you chose get an e-mail.
Where is the SFTP key stored?
In the database, and so in the backups too. Use a key that can only write to the backup folder of that SFTP account.
Explore our other apps
More modules by Aerya IT Solutions for Odoo 17, built to work together.
Questions or a custom quote?
Write to info@aerya.ro for questions about the module, its installation or custom development.
Developed in the European Union by Aerya IT Solutions, Odoo implementation and development. aerya.net
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Lines of code | 2261 |
| Technical Name |
aerya_backup |
| License | OPL-1 |
| Website | https://aerya.net |
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module