Add support for multi-storefront Magento#869
Conversation
|
|
This is not needed to run multistore. I managed to have running instance with adding a file for mapping a domain to run code: I have a file In @markshust what do you think about adding readme for this instead of the PR. The proposed solution isn't generic as |
|
@piotrkwiecinski I actually kinda like this PR. So often, I hear from devs that they do not know how to make updates to the Docker image/config and there are a few steps in play. @h3xx so sorry for the delay, I've not been attentive to OSS lately. I like this PR. To clarify, one would need to just create Also, does just adding a |
I really want to know if the method described under
How multi-storefront switching worksis the standard way of switching between storefronts, or if it's just a technique peculiar to my workplace.This may be going too far towards how one hosting solution (Adobe's Magento Cloud service) sets things up; other hosting solutions are available.
My change
(Aside from a slight refactor to make it easier) this change adds an additional YAML file,
compose.multi-storefront.yaml, that adds 2 additional volumes toappandphpfpm:src->/app- this mimics the directory layout when deployed to Magento Cloud.src/php.ini->/usr/local/etc/php/conf.d/local-php.ini- mapped so that PHP will load it.It only uses
compose.multi-storefront.yamlif bothsrc/php.iniandsrc/magento-vars.phpexist.How multi-storefront switching works
Multi-storefront switching is performed by modifying the
$_SERVER['MAGE_RUN_CODE']and$_SERVER['MAGE_RUN_TYPE']values inside of$_SERVER. It's done in a special file calledmagento-vars.php. Here's an example:This file is included in every request via
src/php.ini:Using our same example domains, getting this setup for local development depends on modifications to
/etc/hoststo make bothdefaultstore.example.devandstore1.example.devwork in the browser:Running
bin/setup-ssl defaultstore.example.dev store1.example.devis not a bad idea either.