Shopware for Platform.sh
This template builds Shopware on Platform.sh using Composer. To get started on Platform.sh, please visit https://docs.platform.sh/
- PHP 8.0
- MariaDB 10.5
- Redis 6.0
The first time the site is deployed, Shopware's command line installer will run and initialize Shopware. It will not run again unless the
installer/installedis removed. (Do not remove that file unless you want the installer to run on the next deploy!)
The installer will create an administrator account with username/password
shopware. You need to change this password immediately. Not doing so is a security risk.
As the theme assets are generated in the build hook and cannot be changed in runtime, we need to dump the theme configuration and run a second deployment to have theme assets build. See Stateless Builds section for this
This project is built on the shopware/production repo. All plugins MUST be installed through Composer. The in-browser plugin manager will not work as the disk is read-only.
The following changes have been made relative to a plain Shopware production project. If using this project as a reference for your own existing project, replicate the changes below to your project.
.platform/routes.yamlfiles have been added. These provide Platform.sh-specific configuration and are present in all projects on Platform.sh. You may customize them as you see fit.
- An additional Composer library,
platformsh/symfonyflex-bridge, has been added. It is a bridge library which connects Symfony Flex-based application to Platform.sh.
platformsh-env.phpfile will map Platform.sh environment variables to the enviroment variables expected by Shopware. It is auto-included from
composer.jsonas part of the autoload process.
- Configuration has been added to use Redis for cache and sessions, see
config/packages/shopware.yamlhas been updated to disable auto update
config/packages/shopware.yamlhas been updated to disable the admin worker (a message consumer is started instead, see the
This build uses "Building without Database".
To support the stateless build for the theme, the theme-config is checked into git for it being available during the build process (an alternative is to store it on an external object storage).
To update the config
IMPORTANT: You have to run this once after the first install, otherwise the Frontend will not load css/js files correctly.
- Dump the theme config e.g. via
platform ssh -A app 'bin/console theme:dump'(this will generate new config files in files/theme config)
- Download the the generated theme config via
platform mount:download --mount 'files' --target 'files' -A app
- You can then remove the old files and add the new files to git (
git add files/theme-config,
git commit -m 'update theme config')
- Commit and Push for a redeployment (
- Add Elasticsearch to
- Add a relationship for it in
- Follow the steps mentioned in the documentation to prepare your instance.
SHOPWARE_ES_INDEX_PREFIXare set in
- If all is good, you can enable via
SHOPWARE_ES_ENABLED(either uncomment in
platformsh-env.phpor add as a
- Add RabbitMQ in
- Add a relationship for it in
- Push to Platform.sh (so RabbitMQ is provisioned)
- For RabbitMQ to work, you need to manually add a queue named
messagesexchange. To do this you can e.g. use the platform CLI to open a tunnel (
ssh -L 15672:rabbitmqqueue.internal:15672 $(platform ssh --pipe -A app)) and open the UI via
http://localhost:15672/. You can get the credentials via
RABBITMQ_URLis set in
composer require enqueue/amqp-bunny