getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.51k stars 1.41k forks source link

Backup is enabled by default on new install, when the docs says it should not be #3818

Closed eauchat closed 5 months ago

eauchat commented 5 months ago

As detailed in this issue and this older forum post, grav seems to have backup enabled by default, even when having no user/config/backup.yaml and user/config/scheduler.yaml files.

As of the system config system/config/backup.yaml, it seems it shouldn't be the case:

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"

Also, in my fresh install, I have no system/config/scheduler.yaml file. Wondering if that's normal.

What's setup in system/config/backup.yaml and the doc on backups seem to be explicitly saying there shouldn't be any backup unless I voluntarily set it up. But on every fresh install I make, I'm having automatic backups ran every night.

Is there something I misunderstood?

In case that's relevant, I'm installing grav with yunohost, which uses the following install script.

rhukster commented 5 months ago

The backups.yaml config is only used if you click 'backup' manually.. So while the configuration is there, backups are not going to happen unless you initiate. This is a system provided file.

The scheduler.yaml is not a system provided file, and will be created in the user/config/scheduler.yaml configuation after you have setup the scheduler (requires a crontab entry), and saved the configuration. No backups will occur automatically until you have:

1) installed the crontab entry on your system 2) configured and saved the scheduler configuration.

This is the normal and expected behavior. Cheers.

eauchat commented 5 months ago

Yes indeed what you're describing is exactly the behaviour I'd expect. The thing is that it's not how it was occurring on my install.

The scheduler crontab was setup during install with the following command

echo "* *  *  *  * $app php$phpversion $install_dir/bin/grav scheduler 1>> /dev/null 2>&1" > /etc/cron.d/$app

But I had no user/config/scheduler.yaml file.

And backup where happening every day.

What I can't explain is why the backup were happening while having no user/config/scheduler.yaml file. Or else there's something I misunderstood either in your explanation or somewhere else.

Anyway, I resolved the issue (and so did the maintainer of the yunohost package) by creating a user/config/scheduler.yaml file with the configuration I want to have. Just wanted to report since I felt there was something strange going on. But maybe it's not due to grav itself but to other quirks somewhere else that I don't know about.

rhukster commented 5 months ago

Then i think this is an issue with your installer package. Grav doesn't install that command by default, and it's something you are 'instructed' to do when you want to enable scheduler. It sounds like your install script: https://github.com/YunoHost-Apps/grav_ynh/blob/master/scripts/install should create a default scheduler yaml or not include the crontab entry.

Not a grav problem, purely your 3rd party and not-supported install script.

eauchat commented 5 months ago

Ok got it. Then sorry for the noise.

So if the proper way when installing is to:

Indeed there was an issue in the yunohost installer. (Which has now been fixed :))

Thanks for your help and availability and sorry again for the noise.