companion icon indicating copy to clipboard operation
companion copied to clipboard

Config Autosave

Open phillipivan opened this issue 1 year ago • 3 comments

Is this a feature relevant to companion itself, and not a module?

  • [X] I believe this to be a feature for companion, not a module

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the feature

I would like to be able to set companion to save out config backups at a set time interval (ie 1 hour, 1 day, or 1 week). Keeping a specified number of backups, which when reached, the oldest is discarded as the new one is saved.

Similar functionality is available in other software, such as Riedel's Director which we have setup to backup the configuration of the intercom matrix once a day, for a period of 90 days. Allowing us to step back if problematic config changes have been made.

Usecases

Backup against configuration errors and programming mistakes, etc, in complex setups, or being able to easily step back temporary configuration changes. Obviously not a primary backup tool against total loss of system, but a useful tool in the toolbox.

phillipivan avatar Jul 24 '24 10:07 phillipivan

Thinking about this more, a potentially more efficient way to do this would be 'backup on config change' with a configurable debounce (5/15/30/60m) rather than on fixed time interval, as that would more efficiently capture changes without making endless backups of the same configuration when the system is not being changed for a long period of time.

Ultimately though, I would be very satisfied with either solution.

phillipivan avatar Sep 16 '24 00:09 phillipivan

Just adding community sentiment for this.

However, I would want the option to turn the backup on config change off and instead have the fixed time frame where it's writing to a set folder once a month and keep all of the old ones in there as well. Obviously it is on the end-user to check that auto save folder isn't getting too full unless companion can purge files after 10 or so autosaves.

We will change our config to test things and sometimes just load a save of the config we did to get it back to normal if we didn't like what we changed.

Also, I had companion on Windows running 3.2.x crap itself a while back and my config was just gone. No explanation. Luckily I back our configs at our main campus and campuses up once a month and was able to restore it, but it did concern me and made me look for this feature request before submitting one.

Lukeb873 avatar Jan 24 '25 04:01 Lukeb873

I suppose the key thing here is overhauling the saving/backup strategy, and probably building some ui to configure/monitor it.

Perhaps we could:

  • Add a subpage under settings to manage how this saving works.
  • In there, configure the number of backup versions, creation interval, and path(?)
  • Maybe also configure filename pattern, autodeletion
  • In this area, we could also flag the presence of old config dirs, and prompt to clean them up (keep the previous 2, prompt for anything older?), to avoid those always growing.

There could be an option field 'only backup if config changed', but I would worry that would reduce confidence in this, it would be hard to tell from a glance if this broke or if config hadnt changed in a while.

There is no reason to limit a reworked backup flow to doing it within the current config dir, maybe we should allow setting it to be elsewhere, to allow it to be written to dropbox or similar.

A question I have:

Do we need to provide a way to restore one of these backups, or upload through the browser? These arent the same format as the import/export system, so would need a different flow to do that.

However, I would want the option to turn the backup on config change off and instead have the fixed time frame

The current 'backup' up until 3.5 was really just a way to minimise risk of corruption when saving the file. It was always the previous save we did to disk, so that if the current save failed for some reason, we could automatically roll back to that. But in 3.5 the format and flow changed, it now makes the backup in a cycle that looks wrong... So it is prime for ripping out and replacing as it no longer serves the same purpose.

Julusian avatar Feb 03 '25 18:02 Julusian

I started an implementation for this a couple of months ago, and have finished it up (not yet merged to beta) https://github.com/bitfocus/companion/pull/3512

Julusian avatar Jun 26 '25 20:06 Julusian

@Julusian sorry I missed your prior comment, do you still want answers to any of these questions? It seems like you have probably worked through these to a great degree. Thanks for the excellent looking PR.

phillipivan avatar Jun 26 '25 21:06 phillipivan