Duplicate a Shopware 5 Store in Plesk

Prerequisites

  • DNS resolution for the desired domain
  • Sufficient free disk space is available



Add a Domain


If you have already created the corresponding domain in Plesk, proceed to the next step, “Copy Store Files.”


To do this, navigate to Websites & Domains in Plesk and click the Add Domain button.



In the pop-up window that appears, select Empty Website



Fill out the following form as desired and click the Add Domain button.


Please make sure that the corresponding domain is selected as the preferred domain.




Copy Store Files

First, navigate to Website & Domains. Then click the Change View button and select Active List.



Now click the Copy Website button in the section below the desired domain.



First, adjust the settings for copying the store content. Then click the OK button to start the copying process.


To completely overwrite the contents of the destination domain and avoid complications, select “Delete all existing files.”



Plesk will display the following message once the copy process is fully complete.



Copying the Database


When copying the database, tables are temporarily locked, which may briefly and minimally affect your application’s performance.


First, you should identify the database currently used by the store in the Shopware configuration file located at /document_root/config.php.


The corresponding directive in config.php

'dbname' => '13019_26266_db',


Copying the Database via the Plesk GUI


Navigate to the database overview via the Databases menu item. Then click the Copy button.



Use a unique name for the database. Adjust the settings as desired.


We recommend selecting the “Create a full copy” option. This helps avoid complications during the copying process.


Then click the OK button to start the copying process



Plesk indicates that the database copy process has been fully completed as follows.



Copying a Database Locally


To avoid locking tables, we recommend using --single-transaction, which significantly reduces the duration of table locks.


Export the database using mysqldump

mysqldump -u database_username -p database_name --single-transaction > mysql_database_name.sql


Create a database with the corresponding name. The exported database can then be imported.

mysql -u database_username -p database_name < mysql_database_name.sql


Adjust Environment Configuration

Update the config.php file to match the new database and the created database user.

'username' => 'database-username',
'password' => 'secure-password',
'dbname' => 'database-name'



Clear the cache


Shopware CLI commands should always be run as a system user. Running them as the root user can lead to unintended side effects.


Log in to the relevant server via SSH using your system user. Then navigate to your shop’s document_root.


Clear the Shopware CLI cache

php bin/console sw:cache:clear


Update the Sales Channel


Finally, you must update the host and hosts fields in the s_core_shops table to match the new domain.


host: in this example, creoline-test.de

hosts: in this example, creoline-test.de