The backup system in Grav has been completely rewritten for Grav 1.6 to provide more features and functionality. The improvements include:
For backwards compatibility, the default configuration mimics the system prior to Grav 1.6, however, it does now have a 5GB limit by default for backup space. You should copy the default configuration file (
system/config/backups.yaml) to your `user/config/
If you use the admin plugin, and save the configuration, the
user/config/backups.yaml file will be created automatically.
The default configuration is as follows:
purge: trigger: space max_backups_count: 25 max_backups_space: 5 max_backups_time: 365 profiles: - name: 'Default Site Backup' root: '/' schedule: false schedule_at: '0 3 * * *' exclude_paths: "/backup\r\n/cache\r\n/images\r\n/logs\r\n/tmp" exclude_files: ".DS_Store\r\n.git\r\n.svn\r\n.hg\r\n.idea\r\n.vscode\r\nnode_modules"
space- will purge older backups when you hit the space limit. Controlled by
time- will purge older backups beyond a number of day. Controlled by
number- will purge older backups beyond a certain number of backups. Controlled by
An array of profiles can be configured. The
Default Site Backup profile is configured similarly to the default Grav backup in previous versions. By default, the backup is not automatically processed by teh scheduler, but you can set
schedule: true and configure teh
schedule_at: option with a preferred cron expression.
An example of a more complex set of profiles could be:
profiles: - name: 'Default Site Backup' root: / exclude_paths: "/backup\r\n/cache\r\n/images\r\n/logs\r\n/tmp" exclude_files: ".DS_Store\r\n.git\r\n.svn\r\n.hg\r\n.idea\r\n.vscode\r\nnode_modules" schedule: true schedule_at: '0 4 * * *' - name: 'Pages Backup' root: 'page://' exclude_files: .git schedule: true schedule_at: '* 3 * * *'
This is covered in more details in the Cli Console -> Grav Command section, but here's an example of running the backup manually:
cd ~/workspace/portfolio bin/grav backup Grav Backup =========== Choose a backup?  Default Site Backup  Pages Backup Archiving 36 files [===================================================] 100% < 1 sec Done... [OK] Backup Successfully Created: /users/joe/workspace/portfolio/backup/pages_backup--20190227120510.zip
Found errors? Think you can improve this documentation? Simply click the Edit link at the top of the page, and then the icon on Github to make your changes.