Red-DiscordBot
Red-DiscordBot copied to clipboard
Automated restoration of a backup
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
Possible duplicate of #2947 / #3681
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:
- Stop your existing instance
- Create a backup using
redbot-setup backup
- Copy the backup to the new machine
- Install Red (with Postgres, if using it), stopping at the point of creating an instance
- 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)
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
.