Shopware 6
For the right Shopware-specific configuration files or commands, make sure to double-check everything with the Shopware Developer Docs for your specific Shopware version.
Basic stack for Shopware 6
For Shopware 6 our basic recommended stack looks like this. This is also the basis on which the ‘extended’ stack builds.
- Nginx
- MySQL 8 (Percona)
- PHP 8.5
- Plus extensions as required by Shopware
This stack allows you to run your small Shopware 6 projects.
The minimal config looks like this. Make sure to customize the app name, usernames, email addresses and domain names everywhere.
users:
- appname
webserver:
enable: true
type: nginx
php:
enable: true
extra_packages:
- gd
- intl
- mbstring
- amqp
- redis
- ctype
- curl
- dom
- fileinfo
- gd
- iconv
- intl
- mysql
- phar
- simplexml
- xml
- zip
- ftp
mysql:
enable: true
version: '8.0'
apps:
- name: appname
type: php
subtype: shopware6
domain: appname.com
php_version: '8.5'
cert: "letsencrypt"
letsencrypt_email: "me@example.com"
web_root: /var/www/appname/current/public
backup_dirs: # directories to include in daily file backups
- /var/www/appname/shared
database:
name: appname
user: appname
ssh_keys:
- your public ssh key
The first time this stack is deployed, following configuration files will be created:
~/.config/nginx/10main.confThis contains a Shopware-optimized nginx template.
Credentials
Any credentials necesary to use the enabled services can be accessed from your SSH user. Run the ploy credentials command.
Nginx
The Shopware 6 stack ships with a nginx template optimized for Shopware. It contains additional headers for browser caching of static assets, improved log handling, ...
You are free to customize this configuration as needed. Read more on the nginx page for more infromation about customizing the nginx config.
Redis
Use the guide on Redis to set up Redis on your Ploy.sh environment.
Additionally, add the following configuration to your Shopware 6 project to use redis correctly: Shopware Developer Docs: Infrastructure Redis
... tbc
Elasticsearch / OpenSearch
Systemd
Systemd is a service manager used by many Linux systems to start, stop, and manage background processes automatically.
To run certain Shopware tasks reliably, you need to create systemd service files. These files tell systemd how to run your scheduled tasks and message workers.
The required files are:
~/.config/systemd/user/shopware-scheduled-task.service– Configures systemd to execute the scheduled tasks command automatically.
[Unit]
Description=Shopware scheduled tasks
After=network-online.target
StartLimitIntervalSec=0
Requires=dbus.socket
PartOf=shopware.target
[Service]
Type=simple
Restart=always
RestartSec=10s
WorkingDirectory=%h/current
ExecStart=/usr/bin/php %h/current/bin/console scheduled-task:run --memory-limit=128M --time-limit=300
[Install]
WantedBy=default.target
~/.config/systemd/user/shopware-message-consume@.service– Configures systemd to run a Messenger consume worker.
[Unit]
Description=Shopware Message Queue Consumer (#%i)
After=network-online.target
Requires=dbus.socket
StartLimitIntervalSec=0
PartOf=shopware.target
[Service]
Type=simple
WorkingDirectory=%h/current
ExecStart=php %h/current/bin/console messenger:consume --time-limit=600 --memory-limit=256M async low_priority
RestartSec=10s
Restart=always
[Install]
WantedBy=default.target
~/.config/systemd/user/shopware.target– Controls how many message worker instances should be started.
[Unit]
Description=Shopware Workers
Wants=shopware-message-consume@1.service shopware-message-consume@2.service shopware-scheduled-task.service
[Install]
WantedBy=default.target
Once these files are in place, systemd can manage these processes in the background, keeping your environment running smoothly.
To enable and start your systemd user services on Linux, follow these steps. These commands assume your service files are located in ~/.config/systemd/user/.
1. Reload systemd to recognize new service files
systemctl --user daemon-reload
2. Enable services to start automatically on login
systemctl --user enable shopware.target
3. Start the services
systemctl --user start shopware.target
4. Check the services status
systemctl --user status shopware-scheduled-task.service
systemctl --user status shopware-message-consume@1.service
systemctl --user status shopware-message-consume@2.service