Site Factory provides two types of backups from which you may restore:
Daily database-only backups: Contain only a daily snapshot of a website’s database, but not the docroot directory, public files, or private files
On-demand full backups: Contain a single website’s complete docroot directory, database, public files, and private files, as described in Backing up sites
Restoring from an on-demand full backup
After you create a backup of one of your Site Factory-hosted websites, you can then restore the website from its backup. Restoring a website from a backup creates a new website, which you can then add to the same group and site collection as the website from which you created the backup. The original website, the source of the backup file, remains unchanged.
To restore a new website from a backup:
Sign in to the Site Factory Management Console.
On the All my sites page, click All my backups.
On the Site Backups page, locate the backup from which you want to create a new website. You can sort the backups by date, backup name, components, or stack.
Click Restore.
In the New site name field, enter the new website’s name using only lowercase letters and numbers, ensuring you don’t use the name of another Site Factory website.
In the Backup file components section, select the components you want to restore from backup. To create a new website, you must select the database option.
Click Restore.
Note
Restoring a website can take several minutes to complete for small websites, but larger websites can take much longer to complete.
Site Factory will notify you by email after the restoration completes. You can add the new website to a group or site collection, and make the new website the primary website for its site collection (in place of the website whose backup you used to create the new website).
Restoring from a nightly database backup
Important
Site Factory non-production environments don’t make automated daily backups. Site Factory subscribers must create on-demand backups if necessary for their development process.
To restore a nightly database backup, either use the Cloud Platform interface or use the command line.
Restoring from the Cloud Platform interface
To restore a nightly database backup using the Cloud Platform interface:
Sign in to the Site Factory Management Console.
Identify the website for which you want to restore a database, and then point to the Information icon to display the DB Identifier value.
Identify the database backups matching the DB Identifier value from the previous step, and then perform the restoration as described in Restoring database backups.
Restoring from the command line
To restore a nightly database backup for a single website from the command line:
Navigate to your
backups
directory with the following command:cd /mnt/files/${AH_SITE_GROUP}.${AH_SITE_ENVIRONMENT}/backups
Create a new database backup of the website you intend to restore by running the following command (where
[SITEURL]
is the URL of your website):drush -r /var/www/html/${AH_SITE_GROUP}.${AH_SITE_ENVIRONMENT}/docroot --uri=[SITEURL] sql-dump --gzip --result-file=/mnt/files/${AH_SITE_GROUP}.${AH_SITE_ENVIRONMENT}/backups/site-backup.sql
Confirm a valid backup exists by executing the following command to confirm a file matching the name
site-backup.sql
now exists in the directory:ls "`pwd`/site-backup.sql.gz" /mnt/files/${AH_SITE_GROUP}.${AH_SITE_ENVIRONMENT}/backups/site-backup.sql.gz
Identify the database name and site path values by executing the following command, substituting the
[SITEURL]
value with the URL of the website you want to restore:drush -r /var/www/html/${AH_SITE_GROUP}.${AH_SITE_ENVIRONMENT}/docroot --uri=[SITEURL] st | grep -E "Database name|Site path" Database name : customeracsdb123102 Site path : sites/g/files/marketing101
In the preceding output, your database name is
customeracsdb123102
and your path ismarketing101
. You will need these values in the following steps.Identify the file name of the database backup by using
grep
in yourbackups
directory to search for the available database backup files matching the site path you identified previously, replacing[PATH]
with your path:ls -lath | grep [PATH] | head
The command returns a list of the database backups available for restoration.
-r--r----- 1 customername www-data 12M Dec 17 08:16 01live-marketing101-customerdb123102-2017-12-17.sql.gz -r--r----- 1 customername www-data 11M Dec 16 08:16 01live-marketing101-customerdb123102-2017-12-16.sql.gz -r--r----- 1 customername www-data 11M Dec 15 08:16 01live-marketing101-customerdb123102-2017-12-15.sql.gz
Run the following command to extract the filename of the backup you want to restore, replacing
filename.sql.gz
with the name of your file:gunzip filename.sql.gz
Ensure the
.sql
file extracted correctly, and check the full path of the resulting.sql
file by executing the following command, replacingfilename.sql
with the name of your file:ls "`pwd`/filename.sql" /mnt/files/${AH_SITE_GROUP}.${AH_SITE_ENVIRONMENT}/backups/01live-marketing101-customerdb123102-2017-12-17.sql
If the file system path to your newly-extracted
.sql
file is not in the output of your command, confirm the file extracted successfully before continuing to restore the backup. If unsure, contact Acquia Support.Drop the existing database.
Important
Dropping the database destroys all data stored in the website’s current database. After executing the command, your website will be inaccessible until the database restoration completes.
To drop the existing database, execute the following command (where
[SITEURL]
is the URL of your website):drush -r /var/www/html/${AH_SITE_GROUP}.${AH_SITE_ENVIRONMENT}/docroot --uri=[SITEURL] sql-drop
Drush will display the following confirmation message to confirm you intend to drop the database:
Do you really want to drop all tables in the database customeracsdb1231023? (y/n):
If the database name matches the database name you identified in Identify the database name and site path values, press
Y
to drop the database.Restore the database backup you identified by running the following command, using the full path to the
.sql
file you confirmed when preparing the database backup file for restoration:drush -r /var/www/html/${AH_SITE_GROUP}.${AH_SITE_ENVIRONMENT}/docroot --uri=[SITEURL] sqlc < /full/path/to/backup/filename.sql
where:
[SITEURL]
- The full URL of your website/full/path/to/backup/filename.sql
- The full file system path to your.sql
backup file
Your database restoration is now complete.