Duplicate Shopware 5 store in Plesk

Prerequisites

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



Add domain


If you have already created a corresponding domain in Plesk, continue with the next step Copy store files.


To do this, navigate to Website & Domains in Plesk and click on the Add domain button.


Plesk - Domain hinzufügen


Select Empty website in the following pop-up window


Plesk - Leere Website


Fill out the following form as required and click on the Add domain button.


Please note that the corresponding domain is selected as the preferred domain.


Plesk - Settings "New Domain"



Copy store files

First navigate to Website & Domains. Then click the Change view button and select Active list.


Plesk - Active list


Now click on the Copy website button in the area below the desired domain.


Plesk - Copy website


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


To completely overwrite the contents of the target domain and complications, select "Delete all existing files".


Plesk - Delete all existing files


The fully completed copy process is reported back in Plesk as follows.

Plesk - Erfolgreich kopiert



Copy database


When copying the database, tables are temporarily locked, which can have a minimal impact on the performance of your application for a short time.


To begin with, the database used in the current store should be determined in the Shopware configuration file under /document_root/config.php.


The corresponding directive in the config.php

'dbname' => '13019_26266_db',


Copy database via Plesk GUI


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


Plesk - Kopieren


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


It is recommended that you select the "Create complete copy" option. This avoids complications during the copying process.


Then click on the OK button to start the copying process


Plesk - create full copy


The completed copy process of the database is signaled in Plesk as follows.

Plesk - database successfully copied



Copy database locally


To avoid locking tables, we recommend using --single-transaction, which greatly reduces the table lock time.


Export database with `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


Customize environment configuration

Customize the config.php according to the new database and the database user created.

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



Empty cache


Shopware CLI commands should always be executed as the system user. Executing as root user can lead to unwanted side effects.


Log in to the relevant server with your system user via SSH. Then navigate to the document_root of your store.


Empty Shopware CLI cache

php bin/console sw:cache:clear


Customize sales channel


Finally, the fields host & hosts must be adjusted in the table s_core_shops according to the new domain.


host: in this example creoline-test.de

hosts: in this example creoline-test.de