Deployment
Introduction
For our Shopware cluster, deploying Shopware via a pipeline is mandatory to ensure that all affected app servers receive the same updates.
For optimal deployment, we recommend using our GitLab hosting.
Prerequisites
- creoline Shopware cluster
- GitLab with at least one active GitLab runner
- SSH access to all app servers via the
deployeruser
Folder Structure
After deployment by us, the following folder structure exists on all app servers:
/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
│ ├── theme
│ └── sitemap
│
└── var
└── log The releases folder allows you to deploy multiple releases and activate or deactivate them via the active symbolic link. The symbolic link current points to the desired active release.
App Server Definition
For our Shopware cluster, there are two types of app servers:
- App Server Master
- App Server Slave
The App Server Master provides the following functions:
- Shopware Administration (Admin Traffic)
- Shopware Message Queue
- Cron jobs / internal tasks
The App Server Slave provides the following functions:
- Shopware Storefront (visitor traffic)
File and Folder Distribution
The following files and directories are made available to all other app servers via the 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
public/theme
custom/plugins
custom/apps Deployment Steps
The following steps are required for deployment:
- All: Create the new release folder
- All: Deploy all files and folders within the new release folder
- Master: Run the database migrations
- Master: Update the plugin list
sw:plugin:update:all - Master: Run the theme compilation
sw:theme:compile - All: Run asset installation
sw:assets:install - All: Clear the cache
sw:cache:clear - All: Clear OpCache (More information)
- All: Update symlinks
Additional Notes
Console Command sw:theme:compile
This command must only be executed on the App Server Master, as Shopware has generated a random hash for each compilation since Shopware 6.5. Executing the command on other servers will invalidate the compiled theme on those 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
Related Links
- Shopware Documentation: