andrewjmead / wpsites

A CLI for quickly spinning up WordPress sites
MIT License
17 stars 1 forks source link

Add ability to backup and restore a site #26

Closed andrewjmead closed 2 weeks ago

andrewjmead commented 1 month ago

The main reason I want this is to be able to create a "save point" right before testing a migration. That'll let me roll it back quickly and test the migration with slightly different code.

Backup

I really only need the database backed up, but I might as well backup the files too.

Backing up would be something like:

  1. Run wpsites backup
  2. Pick the site to backup
  3. Name the backup
  4. Done

This would store a folder with the zip and sql file in ~/.wpsites/backups/ so something like ~/.wpsites/backups/iawp. Actually, it will need to support multiple backups for any given site.

Restoring

The process of restoration is a little more unclear. Restoring is basically creating a site off a specific backup with the same slug.

The more vanilla solution would be something like this.

  1. Run wpsites restore
  2. Select the existing site you want to restore
  3. Select the backup to use that was made for that site with a "Select backup from different site" option.
  4. Done

I'd also like to be able to create a new site from a backup.

Maybe there's a "Create from backup" option listed in the templates list when you run wpsites create?

andrewjmead commented 2 weeks ago

Added in 64a050a9d93fa5e119fab52ce5a2875bafd701a4