PaaS template based on production template using platform.sh

Related tags

Miscellaneous paas
Overview

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/

Services

  • PHP 8.0
  • MariaDB 10.5
  • Redis 6.0

First deployment

  1. 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/installed is removed. (Do not remove that file unless you want the installer to run on the next deploy!)

  2. The installer will create an administrator account with username/password admin/shopware. You need to change this password immediately. Not doing so is a security risk.

  3. 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

Customizations

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.

  • The .platform.app.yaml, .platform/services.yaml, and .platform/routes.yaml files 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.
  • The platformsh-env.php file will map Platform.sh environment variables to the enviroment variables expected by Shopware. It is auto-included from composer.json as part of the autoload process.
  • Configuration has been added to use Redis for cache and sessions, see config/packages/framework.yaml
  • config/packages/shopware.yaml has been updated to disable auto update
  • config/packages/shopware.yaml has been updated to disable the admin worker (a message consumer is started instead, see the workers section in .platform.app.yaml)

Stateless Builds

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 (git push)

Optional additions

Elasticsearch

  1. Add Elasticsearch to .platform/services.yaml
  2. Add a relationship for it in .platform.app.yaml
  3. Follow the steps mentioned in the documentation to prepare your instance. SHOPWARE_ES_HOSTS, SHOPWARE_ES_INDEXING_ENABLED and SHOPWARE_ES_INDEX_PREFIX are set in platformsh-env.php.
  4. If all is good, you can enable via SHOPWARE_ES_ENABLED (either uncomment in platformsh-env.php or add as a variable)

RabbitMQ

  1. Add RabbitMQ in .platform/services.yaml
  2. Add a relationship for it in .platform.app.yaml
  3. Push to Platform.sh (so RabbitMQ is provisioned)
  4. For RabbitMQ to work, you need to manually add a queue named shopware-queue and a messages exchange. 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 platform relationships. RABBITMQ_URL is set in platformsh-env.php.
  5. composer require enqueue/amqp-bunny
  6. Uncomment config/packages/enqueue.yaml

References

Comments
  • Remove early returns and prevent caching of objects with no cache-control headers

    Remove early returns and prevent caching of objects with no cache-control headers

    This pull request has two changes

    1. All early returns from recv.vcl have been changed to set a header called req.http.x-pass. Problem with doing return(pass) is that it skips any backend selection that you may end up doing later in the VCL processing. This is in vast majority of cases undesirable. To really take advantage of this the Paas should add a request setting object that has the action of PASS in case req.http.x-pass is present
    2. Any object with no cache headers should not be cached. It's not necessarily against the spec to cache it however there have been numerous cases of misconfiguration where there was a server misconfig where private data was cached. This is just a safety precaution.
    opened by vvuksan 2
  • change fastly deliver config to prevent the client from caching more efficiently

    change fastly deliver config to prevent the client from caching more efficiently

    The max-age=0 cache control directive is not enough from prevent the client caching. This does not prevent the client from reserving the cached page with the browser's previous button. It is better to use the no-cache directive in this case (or no-store if we also dont want the proxy to cache).

    We have a problem with this on a shopware project when we add a product to the cart in ajax then we are going to another page and then back with the browser previous button. The basket appear empty.

    opened by dimiceli 1
  • VCL changes to make things more cacheable and avoid unnecessary

    VCL changes to make things more cacheable and avoid unnecessary

    I have made a couple changes to the stock Fastly VCL. Some of the issues that I have observed are

    • Early returns e.g. return(lookup) at the end of recv.vcl. This will do an early return and avoid shielding logic causing worse cache hit ratios
    • Simplified pieces of code with cookie accessors e.g. req.http.Cookie:sw_states.
    • Corrected the deliver.vcl which would have resulted in no caching on Fastly edge nodes (only on shield)
    opened by vvuksan 1
  • Check if fastly command is available

    Check if fastly command is available

    Please describe the feature you would like to see implemented.

    When installing fastly via setup-fastly.sh, the command will fail if /tmp/fastly already exists, but the fastly command (/tmp/fastly/fastly) is missing.

    There should be a check if /tmp/fastly/fastly exists, otherwise it should re-install fastly again.

    opened by jdambacher 0
  • Removing the early return(pass)

    Removing the early return(pass)

    Early return(pass) removes all the default Fastly logic. That should not be done. Furthermore, this early return(pass) prevents any caching of the Shopware assets, that are returned without a cache-control: public.

    opened by vrobert78 0
  • optimize cache clear during deployments for dedicated generation 2

    optimize cache clear during deployments for dedicated generation 2

    In dedicated environments where you have multiple nodes the deploy hook only runs once, while the pre_start hook (which is specific to dedicated gen 2) is executed on all nodes.

    $PLATFORM_REGISTRY_NUMBER is an environment variable that is only present on dedicated generation 2 clusters (but not on grid nor on dedicated generation 3)

    opened by devicezero 0
  • add dotenv:dump in build hook

    add dotenv:dump in build hook

    Hello

    Here is a change to dump the .env file as .env.local.php during the platform sh build hook and remove the overhead introduced by parsing the env files stack in production.

    To ensure the retro-compatibility with the previous Shopware versions the dump is executed only when Shopware >= 6.4.16.0 is enabled in composer vendors

    opened by iNem0o 0
  • Plugins installed by Composer

    Plugins installed by Composer

    PHP Version

    8.0

    Shopware Version

    4.6.1

    Expected behaviour

    Activate plugin by CLI

    Actual behaviour

    If I install by composer and activate the plugin by CLI, I have an error: Shopware Plugin Lifecycle Service

    Activate 1 plugin(s):

    • Custom Products (v3.4.0)

    08:16:25 CRITICAL [console] Error thrown while running command "plugin:activate SwagCustomizedProducts". Message: "Impossible to create the root directory "/app/public/theme/ff35c4252d36bcd7bc8db9252e7e277b/css". mkdir(): Read-only file system" ["exception" => League\Flysystem\Exception^ { …},"command" => "plugin:activate SwagCustomizedProducts","message" => "Impossible to create the root directory "/app/public/theme/ff35c4252d36bcd7bc8db9252e7e277b/css". mkdir(): Read-only file system"]

    In Local.php line 112:

    Impossible to create the root directory "/app/public/theme/ff35c4252d36bcd7bc8db9252e7e277b/css". mkdir(): Read-only file system

    How to reproduce

    After adding in platform.app.yaml problem was solved. Maybe I made something wrong? "/public/bundles": source: local source_path: "public/bundles" "/public/theme": source: local source_path: "public/theme"

    opened by ppobiarzyn 2
Owner
Shopware
You can find more of our open source projects at https://github.com/shopwareLabs
Shopware
Rubix Server is a library for bringing your trained Rubix ML models into production.

Rubix Server is a library for bringing your trained Rubix ML models into production. Inference servers are stand-alone services that run on your private or public network and wrap your trained estimator in an API that can be queried locally or over the network in real-time using standard protocols. In addition, the library provides async-compatible client implementations for making queries to the server from your PHP applications.

Rubix 50 Aug 15, 2022
Contracts for Rule Doc Generator. Useful for production code with minimum dependencies.

Rule Doc Generator Contracts Contracts for Rule Doc Generator. Useful for production code with minimum dependencies. Install composer require symplify

null 19 Dec 22, 2022
Production-grade rapid controller development with built in love for API and Search

Installation For CakePHP 4.x compatible version: composer require friendsofcake/crud For CakePHP 3.x compatible version: composer require friendsofca

Friends Of Cake 357 Jan 2, 2023
Production ready scalable Magento setup utilizing the docker

Magento docker image Requirements This docker image expects 2 other linked containers to work . Mysqldb or Mariadb linked as 'db' Memcached linked as

Paim pozhil 49 Jun 21, 2021
A dockerized magento 2 community environment ready for development or production.

Painless Magento 2 & 1 A dockerized magento 2 community environment ready for development or production. It supports magento 1.9.x for development Ins

Cocoa Web Studio 10 Apr 23, 2022
This is a plugin written in PHP programming language and running on the PocketMine platform that works stably on the API 3.25.0 platform

This is a plugin written in PHP programming language and running on the PocketMine platform that works stably on the API 3.25.0 platform. It allows you to hear the sound

Thành Nhân 10 Sep 27, 2022
PDF API. JSON to PDF. PDF Template Management, Visual HTML Template Editor and API to render PDFS by json data

PDF Template Management, Visual HTML Template Editor and API to render PDFS by json data PDF ENGINE VERSION: development: This is a prerelease version

Ajous Solutions 2 Dec 30, 2022
A @laravel based RAD platform for back-office applications, admin/user panels, and dashboards.

For the full documentation, visit orchid.software. Introduction Orchid is a free Laravel package that abstracts standard business logic and allows cod

Laravel Orchid 3.4k Jan 7, 2023
Lavarel-based school management platform for small and medium institutions

About this project Academico is an open-source, Lavarel-based school management platform. Its main features include course management, enrolments mana

Academico 160 Dec 24, 2022
Silverstripe-sspy - Python based SSPAK export with higher reliability and cross-platform compatibility

SSPY - Python Stand-alone SSPAK solution © Simon Firesphere Erkelens; Moss Mossman Cantwell Usage: sspy [create|load|extract] (db|assets) --file=my.

Simon Erkelens 1 Jun 29, 2021
Faker-driven, configuration-based, platform-agnostic, locale-compatible data faker tool

Masquerade Faker-driven, platform-agnostic, locale-compatible data faker tool Point Masquerade to a database, give it a rule-set defined in YAML and M

elgentos ecommerce solutions 219 Dec 13, 2022
Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.

TARS - A Linux Foundation Project TARS Foundation Official Website TARS Project Official Website WeChat Group: TARS01 WeChat Offical Account: TarsClou

THE TARS FOUNDATION PROJECTS 9.6k Jan 1, 2023
Nuber is an open source container management platform it provides a front end to manage your own cloud infrastructure, using Linux Containers virtualization technology

Nuber is an open source container management platform it provides a front end to manage your own cloud infrastructure, using Linux Containers virtualization technology

null 33 Dec 14, 2022
Project template for starting your new project based on the Sulu content management system

Sulu is a highly extensible open-source PHP content management system based on the Symfony framework. Sulu is developed to deliver robust multi-lingua

Sulu CMS 188 Dec 28, 2022
A text-based, persistent browser-based strategy game (PBBG) in a fantasy war setting

Note: OpenDominion is still in development. Some features of the game have not been implemented yet. Introduction OpenDominion is a free and open-sour

null 180 Dec 28, 2022
The main website source code based on php , html/css/js and an independent db system using xml/json.

jsm33t.com Well umm, a neat website LIVE SITE » View Demo · Report Bug · Request a feature About The Project Desc.. Built Using Php UI Frameworks Boot

Jasmeet Singh 5 Nov 23, 2022
Enables developers to modify Magento installations (configuration, data) based on the given environment using n98-magerun.

Enables developers to modify Magento installations (configuration, data) based on the given environment using n98-magerun.

LimeSoda Interactive Marketing GmbH 73 Apr 1, 2022
The Assure Alliance support website. This website is based on Questions2Answers and is a forum for support using Biblical Tools

The Assure Alliance support website. This website is based on Questions2Answers and is a forum for support using Biblical Tools

United Bible Societies Institute for Computer Assisted Publishing 3 Jul 29, 2022
Personal PHP MySQL query handler based on Eloquent using PDO.

?? Equivoluent Welcome to "Equivoluent" my personal PHP MySQL query handler using PDO. Equivoluent is based on Laravel's Eloquent. The goal of "Equivo

Wob Jelsma 2 Sep 7, 2022