Create and restore database backups
Edit on GitHubThis doc describes how to create and restore database (DB) backups in Spryker Cloud Commerce OS (SCCOS).
As all the data is stored in relational databases, you don’t need to back up the codebase. DB backups are managed via Amazon Relational Database Service (Amazon RDS).
The following DB backups are created automatically:
-
Transaction log backups via AWS Point-in-time recovery.
-
Monthly snapshots with a default retention of 90 days.
-
Hourly snapshots by SCCOS tools with a default retention of 35 days.
Also, you can create DB snapshots manually.
Create a DB snapshot
-
In the AWS Management Console, go to Services > RDS.
-
In the navigation pane, click Databases.
-
In the Databases pane, select the DB you want to take a snapshot of.
-
ClickActions > Take snapshot.
This opens the Take DB snapshot page.
-
Enter a Snapshot name. Make sure to enter a meaningful Snapshot name. It is used as an identifier when restoring the DB.
-
Click Take snapshot.
This opens the Snapshots page. The created snapshot is displayed in the Manual snapshots pane.
Restore a database
The following sections describe how to restore databases from snapshots and backups. You will need to rename your original database and give its name to the restored one.
During database restoration, your application is not accessible. For production environments, we recommend setting up a maintenance page. To do that, provide your custom HTML page or request to set up a generic one via support.
Rename a DB
-
In the AWS Management Console, go to Services > RDS.
-
In the navigation pane, click Databases.
-
In the Databases pane, select the DB you want to restore.
-
Click Modify.
This opens the Modify DB instance: {DB name} page. -
In the Settings pane, copy and save the DB instance identifier.
You will need to give this name to a restored database later. -
Scroll down the page and click Continue.
-
In the Scheduling of modifications pane, select when you want to apply the changes:
-
To apply the changes immediately, select Immediately. This can cause an outage in some cases. For more information, see Modifying an Amazon RDS DB Instance.
-
To apply the changes during the next scheduled maintenance window of the DB, select During the next scheduled maintenance window. In this case, you have to wait for the DB to be renamed before you can restore it.
- Review your changes and click Modify DB Instance. This takes you to the Databases page with the success message displayed.
Even if you selected to apply the change immediately, it may take a few minutes to update the DB name.
- Restore the DB in one of the following ways:
Restore the DB from a snapshot
-
In the AWS Management Console, go to Services > RDS.
-
In the navigation pane, click Snapshots.
-
Select the snapshot you want to restore.
-
Select Actions > Restore snapshot.
This takes you to the Restore snapshot page. -
Enter the settings of the original DB.
Make sure to configure the following:
-
DB instance identifier corresponds to the name of the original DB before you renamed it.
-
The settings exactly replicate those of the original DB. Otherwise, the DB may fail to restore correctly or work with the application.
- Click Restore DB Instance.
This opens the Databases page with the success message displayed. The restored DB is displayed in the list.
It may take a few minutes for the DB to restore.
Restore the DB from an AWS Backup
-
In the AWS Management Console, go to Services > AWS Backup.
-
In the navigation pane, click Backup vaults.
-
Select the vault of the environment you want to restore the backup for. For example, for a
production
environment, select theproduction_rds_backup
vault. -
In the Recovery points pane, select the
recovery point ID
of a continuous backup you want to restore. The name should start withcontinuous:
. -
On the page of the recovery point, click Restore. This opens the Restore backup page.
-
On the Restore to point in time pane, do one of the following:
- To restore the latest backup, select the displayed date.
- To restore from a specific point in time, do the following:
- Select Specify date and time. This adds date and time fields.
- Select date and time between Latest restorable time and Earliest restorable time.
-
In Instance specifications pane, select the DB instance class of the original database.
-
On the Settings pane, enter the DB Instance Identifier of the original database.
-
In Network and security tab, select the Virtual Private Cloud (VPC) the original database belongs to.
-
Select a Subnet group of the original database.
-
Select a Public accessibility.
-
In the Database options pane, enter the Database port of the original database.
-
Select a DB parameter group of the original database.
-
In the Log exports pane, select the log types to publish to Amazon CloudWatch Logs.
-
In Maintenance pane, select Auto minor version upgrade.
-
In Restore role pane, select an IAM role to restore the backup with in one of the following ways:
- Select Default role.
- Select a specific role:
- Select Choose an IAM role.
- Select a Role name.
-
Click Restore backup. This opens the Jobs page where you can see the progress of restoration. Wait for the process to finish.
-
In the AWS Management Console, go to Services > RDS.
-
In the navigation pane, click Databases.
-
On the Databases page, select the restored DB.
-
On the page of the DB, click Modify. This opens the Modify DB instance: {DB name} page.
-
In Connectivity pane, select the Security group of the original database.
-
Click Continue.
-
In the Scheduling of modifications pane, for When to apply modifications, select Apply immediately.
-
Click Modify DB instance.
Restored DB is created and modified.
Re-sync data from the restored database to ElasticSearch and Redis
-
Connect to OpenVPN.
-
Open Jenkins web interface at
http://jenkins.{environment_hostname}
. -
Select New Item.
-
For Enter an item name, enter a job name.
-
Select Freestyle project.
-
Select OK.
-
In the Build section, select Add build step > Execute shell.
-
In the Execute shell pane, for Command, enter the script with the
vendor/bin/console sync:data
command. You can add the command to the script from another Jenkins job in your environment. -
Select Save.
- On the page that opens, select Build Now.
Give it a few minutes to execute the job. You can track the execution in the Build History pane.
You’ve restored the database and connected it ot your application.
Restore an application
Application restoration is part of a regular deployment workflow. See Rolling back an application to learn about restoring a previous version of an application.
Next step
Thank you!
For submitting the form