Red-DiscordBot icon indicating copy to clipboard operation
Red-DiscordBot copied to clipboard

Automated restoration of a backup

Open palmtree5 opened this issue 2 years ago • 3 comments

Type of feature request

Other

Description of the feature you're suggesting

The intention here is to have a restore function that would automatically restore from a backup, including:

  • [ ] Restoring the instance data to a user-defined location
  • [ ] Readd cog repos the user had added using [p]repo add
  • [ ] Readd cogs the user installed with [p]cog install

Anything else?

Note: I am intending to work on this myself at some point in the near future

palmtree5 avatar May 17 '22 06:05 palmtree5

Possible duplicate of #2947 / #3681

Vexed01 avatar May 17 '22 06:05 Vexed01

So what I think I want to do here in terms of how to actually automate the restoration of a backup would ultimately have the user's steps be:

  1. Stop your existing instance
  2. Create a backup using redbot-setup backup
  3. Copy the backup to the new machine
  4. Install Red (with Postgres, if using it), stopping at the point of creating an instance
  5. Run redbot-setup restore <backup_file> to restore, which will then get everything set up, including redownloading installed repos and cogs.

The goal here in my mind is to basically recreate the environment as it was when the backup was made, ideally including using the same storage backend that was in use when the backup was created (i.e. if the backup was made on an instance that was using Postgres as the config backend, on restore we would convert back from JSON to Postgres)

palmtree5 avatar Oct 12 '23 01:10 palmtree5

I've created a cog (SeaCogs/Backup) that does some of the things this issue discusses, namely allowing for "automatic" installation of repositories and cogs when migrating. It reuses a lot of Downloader code, and works pretty well. However, some of the things I want to do with it are held back by it being a cog, and therefore having to run both manually and AFTER the bot initializes. It would be a lot better to incorporate something like this into Core. That way cogs that were loaded before stay loaded when the bot starts, because it's already cloned all of the repos/cogs before that point. Here's a Discord message link to a conversation Flame and I had about this idea in #coding.

cswimr avatar Feb 01 '24 02:02 cswimr