YunoHost-Apps / grav_ynh

Grav, a flat-file CMS packaged for YunoHost
https://getgrav.org/
GNU General Public License v3.0
16 stars 12 forks source link

Disable Grav's internal daily backups #162

Closed eauchat closed 2 months ago

eauchat commented 2 months ago

Describe the bug

I've seen this PR proposed but not merged in the end #96. As of today, it seems to me that grav has automatic backup enabled by default. I recently installed various sites, didn't set any user/config/backup.yaml file, and all of them have a backup folder filled with daily backups.

I'm confused because system/config/backup.yaml has the following content:

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"

Schedule being set to false, I imagine no backup should be going on. Is there something I'm misunderstanding. At this point I'm even wondering if it might be a bug in grav itself. But I feel strange that nobody noticed it yet. Anybody has some ideas of what may be going on?

Context

Steps to reproduce

Expected behavior

No backup should be automatically made, unless the user creates a user/config/backups.yaml file specifying they want backups (or do the same via grav admin).

Additional comments

Looking at the backup grav_ynh bacup script, it seems that the whole /var/www/grav dir is backed up (if I'm not mistaken reading ynh_backup --src_path="$install_dir"). It seems to me that the /var/www/grav/backup directory shouldn't be backed up. Otherwise we're backing up the backups, which is a bit weird.

tituspijean commented 2 months ago

I found an unaddressed forum report about it; https://discourse.getgrav.org/t/how-to-completly-disable-backup/15823/5

Indeed, the output of the scheduler config gives:

# yunohost app shell grav
$ php bin/grav scheduler -j

Scheduler Jobs Listing
======================

┌─────────────────────┬────────────────────────────────────┬───────────┬────────┬──────────┬─────────┐
│ Job ID              │ Command                            │ Run At    │ Status │ Last Run │ State   │
├─────────────────────┼────────────────────────────────────┼───────────┼────────┼──────────┼─────────┤
│ default-site-backup │ Grav\Common\Backup\Backups::backup │ 0 3 * * * │ Ready  │ Never    │ Enabled │
│ cache-purge         │ Grav\Common\Cache::purgeJob        │ 0 4 * * * │ Ready  │ Never    │ Enabled │
│ cache-clear         │ Grav\Common\Cache::clearJob        │ 0 3 * * * │ Ready  │ Never    │ Enabled │
└─────────────────────┴────────────────────────────────────┴───────────┴────────┴──────────┴─────────┘

 ! [NOTE] For error details run "bin/grav scheduler -d"

Relevant documentation page: https://learn.getgrav.org/16/advanced/scheduler#configuration-file There is a clear difference between the default admin/config/backups.yaml and the (initially empty) user/config/backups.yaml where the config is actually read.

I'll make a PR to fix that.

eauchat commented 2 months ago

Thanks a lot @tituspijean for the fast reply, and fix, amazing :) This seems to me like a bug in grav itself, as they're doc explicitly says that if you don't enable backups they should not happen. I'll write an issue about it in their bug tracker to see what they have to say about it.

tituspijean commented 2 months ago

Fixed by #165