Restoring Backups

To restore a site from a site backup in SpinupWP simply click the “Restore” action in the list of backups.

You will be prompted to confirm that you want to restore the site from a backup as restoring a site is a destructive action (all existing files and data will be deleted). For this reason, you will also be asked if you want SpinupWP to create a new backup before restoring. We recommend leaving this option enabled.

After the restore has completed we recommend you test your site thoroughly to make sure it’s working correctly. SpinupWP will automatically purge the page cache and object cache for you after a site has been restored.

Manually Restoring a Backup

There may be times when you need to manually restore a backup. To do so, follow the steps below. Note that you’ll need to use a Sudo user to perform these actions on your server. Also, these instructions don’t include making a local backup of the site files and database before you delete them but we recommend you do so that it’s easy to roll back any changes if something goes wrong.

First, download the files and/or database backups from your backup storage provider to your local computer.

Next, SSH to your server and create a temporary directory on your server to store the backup files (e.g. /sites/restore). This directory will need to be owned by your sudo user.

sudo mkdir /sites/restore
sudo chown {sudo_user}:{sudo_user} /sites/restore

Next, copy the backup files from your local computer to your server using scp or SFTP:

scp 2020-03-12-10-07-33-files.tar.gz {sudo_user}@{server_ip}:/sites/restore
scp 2020-03-12-10-07-33-database.sql.gz {sudo_user}@{server_ip}:/sites/restore

Restoring Site Files

Back on your server, extract the files backup on your server:

cd /sites/restore
tar -xf 2020-03-12-10-07-33-files.tar.gz

Next, delete the existing site files and any other files that are not excluded from your backup:

sudo rm -rf /sites/{domain}/files
...

Then restore the site files and any other files included in your backup:

sudo mv /sites/restore/{domain}/files/ /sites/{domain}
...

Finally, fix the ownership permissions for your restored site files (read/write permissions will have already been restored):

sudo chown -R {site_user}:{site_user} /sites/{domain}

Restoring the Database

To restore the database, first connect to your database as the root user. We’ll use the command line here as an example:

mysql -u root -p

Next, drop and recreate the database:

DROP DATABASE {database};
CREATE DATABASE {database};

Finally, exit the MySQL prompt and then restore the database:

gunzip < /sites/restore/2020-03-12-10-07-33-database.sql.gz | mysql -u root -p {database}

Make sure and clean up your server by deleting the backup files after the restore is complete:

sudo rm -rf /sites/restore

We also recommend clearing the page cache and object cache after restoring a site:

wp spinupwp cache purge-site
wp cache flush