Deployment

Foreword

For our Shopware cluster, the deployment of Shopware via pipeline is mandatory to ensure that all affected app servers receive the same updates.

For optimal deployment, we recommend using our GitLab hosting.


Requirements

  • creoline Shopware Cluster
  • GitLab with at least one active GitLab runner
  • SSH access to all app servers via user deployer



Folder structure

The following folder structure exists for all app servers after we have provided them:

/var/www/shop.com/
│
├── current -> releases/test-release-2
│
├── releases
│ ├─── test-release-1
│ └── test-release-2
│
└── shared
    ├── config
    │ └─── jwt
    │
    ├─── custom
    │ ├─── plugins
    │ └─── apps
    │
    ├── files
    │
    ├── public
    │ ├─── media
    │ ├─── thumbnail
    │ └─── sitemap
    │
    └── var
        └── log


Several releases can be provided using the releases folder and activated or deactivated using the active symlink. The symbolic link current points to the desired active release.



Definition app server

There are two types of app servers for our Shopware cluster:


  1. app server master
  2. app server slave


The app server master provides the following functions:

  • Shopware Administration (Admin Traffic)
  • Shopware Message Queue
  • Cronjobs / internal tasks


The App-Server Slave provides the following functions:

  • Shopware storefront (visitor traffic)



Distribution of files and folders

The following files and directories are made available to all other app servers via App-Server Master:


Shared files

.env.local
install.lock
public/.htaccess
auth.json


Shared directories

config/jwt
files
var/log

public/media
public/thumbnail
public/sitemap

custom/plugins
custom/apps



Deployment steps

The following steps are required for deployment:


  1. All: Creation of the new release folder
  2. All: Deployment of all files and folders within the new release folder
  3. Master: Execution of the database migrations
  4. Master: Updating the plugin list sw:plugin:update:all
  5. Master: Execution of the theme compilation sw:theme:compile
  6. All: Execution of the asset installation sw:assets:install
  7. All: Cache clearing sw:cache:clear
  8. All: OpCache emptying (More information)
  9. All: Symlink change



Additional notes

Console Command sw:theme:compile

This command may only be executed on the App Server Master, as Shopware generates a random hash for each compilation since Shopware 6.5. Executing the command on other servers will invalidate the compiled theme on the other servers.



Examples

Deployer with GitLab Pipelines

Deployer (https://deployer.org/) is ideal for deploying Shopware 6 on our Shopware Cluster. The example provided here was developed by our partner, webimpact GmbH.


GitHub Repository:

https://github.com/creoline/shopware-deployer-example