Create a test environment from a copy of your live shop
Use a copy of your shop to test changes, updates, and new features without affecting your live shop.
Pay attention to the app connections when you create the copy. Apps such as Shopware Payments are connected to your shop through a shop ID. A copy without staging mode can take over the app connections of your live shop. These apps then stop working in your live shop. Follow the steps below in the order given.
Set up the test environment
- Create the copy
Set up the copy with its own domain and its own database. Then copy the files and the database of your live shop into it. The developer documentation explains how to do this in steps 1 and 2 of Creating the staging instance. To create the database dump, you can use the Shopware CLI. - Adjust APP_URL
Open the.env.localfile in the root directory of the copy. SetAPP_URLto the domain of the copy, for example:APP_URL=https://test.my-shop.comWarning: Check the
.envand.env.localfiles of the copy for theSHOPWARE_CACHE_IDvariable. If you copied it from your live shop and both shops use the same cache storage (for example the same Redis server), they share their cache. If a new shop ID is then generated in the copy, for example by staging mode, the shop ID in your live shop can be reset as well. Give the copy its own value forSHOPWARE_CACHE_IDor remove the variable. Also make sure that the copy uses its own cache storage. - Verify APP_URL (from Shopware 6.7.17.0)
Run this command on the copy:bin/console app:url:verify
The command checks thatAPP_URLreaches the copy and not your live shop. If the check fails, correctAPP_URLand run the command again. Only continue once the check passes. - Activate staging mode
Run this command on the copy before you open its Administration:bin/console system:setup:staging
The command removes the app connections from the copy and gives it its own shop ID. This way, the copy can't affect the apps in your live shop.
You can then open the Administration of the copy and start testing.
Shop ID dialog
If you open the Administration of the copy before step 4, a dialog about the shop ID appears. It appears because APP_URL has changed.
- Choose Generate a new shop identifier. The copy gets its own shop ID, and your live shop is not affected.
- Do not choose Keep the shop identifier. This option disconnects the apps in your live shop.
Then run step 4 to activate staging mode.
Further information
You can find technical details about staging mode in the developer documentation.