Optional - Install sample data
If you need some example data when developing your store, you can install our sample data. This data simulates an active Magento store including customers, products, and other data. This sample data works best with a new “blank site” Magento Commerce Cloud template installation when creating your project in your Integration environment.
We recommend installing sample data in your local Integration branches and environments. If you use this data in Staging or Production, you need to remove the information and products before going live.
Get started in a branch
We recommend working in a branch to add the sample data. The following information details how to set up a branch.
To get started with environment branches:
-
On your local workstation, change to your Cloud project directory.
-
Switch to the Magento file system owner.
-
Log in to your Magento project.
1
magento-cloud login
-
List your projects.
1
magento-cloud project:list
-
List environments in the project. Every environment includes an active Git branch that contains your code, database, environment variables, configurations, and services.
1
magento-cloud environment:list
It is important to use the
magento-cloud environment:list
command because it displays environment hierarchies, whereas thegit branch
command does not. -
Fetch origin branches to get the latest code.
1
git fetch origin
-
Checkout, or switch to, a specific branch and environment.
1
magento-cloud environment:checkout <environment-ID>
Git commands only checkout the Git branch. The
magento-cloud checkout
command checks out the branch and switches to the active environment.You can create a new environment branch using the
magento-cloud environment:branch <environment-name> <parent-environment-ID>
command syntax. It may take some additional time to create and activate a new environment branch. -
Use the environment ID to pull any updated code to your local. This is not necessary if the environment branch is new.
1
git pull origin <environment-ID>
-
(Optional) Create a snapshot of the environment as a backup.
1
magento-cloud snapshot:create -e <environment-ID>
Install sample data
To install sample data:
- If you have not done so already, check out the environment in which to install sample data.
-
In a terminal, enter the following commands:
1
<magento_root>/bin/magento sampledata:deploy
- Wait for components to update.
-
Commit and push the changes:
1
git add -A && git commit -m "Install sample data"
1
git push origin <branch name>
- Wait for the project to deploy.
- Verify the installation was successful by going to your storefront main page in the Integration environment. You can locate the URL link to the storefront through the Project Web Interface.
-
Take a snapshot of your environment:
1
magento-cloud snapshot:create -e <environment ID>
You can start testing your development with live data!