Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Universal config composition #175

Closed
shiftedreality opened this issue Mar 24, 2020 · 2 comments
Closed

Universal config composition #175

shiftedreality opened this issue Mar 24, 2020 · 2 comments
Assignees

Comments

@shiftedreality
Copy link
Member

shiftedreality commented Mar 24, 2020

Since the introduction of .magento.docker.yaml file, there were added multiple sources to handle different approaches.

Universal file introduction: #160

Sources overview

The Source is a PHP entity responsible for reading the configuration from different file sources.

Composition

All the sources are being composed according to the preferred hierarchy.

build:compose command

This command is backward-compatible with Cloud Docker 1.0, this means that all CLI options and Magento Cloud Docker configurations are preserved. On top of it, we added support of .magento.docker.yaml file.

The composition hierarchy is next (left to right priority):

BaseSource -> CloudBaseSource -> CloudSource -> ConfigSource -> CliSource

        $config = $this->configFactory->create([
            $this->sourceFactory->create(Source\BaseSource::class),
            $this->sourceFactory->create(Source\CloudBaseSource::class),
            $this->sourceFactory->create(Source\CloudSource::class),
            $this->sourceFactory->create(Source\ConfigSource::class),
            new Source\CliSource($input)
        ]);

This means next:

  • CliSource has higher priority, so it's possible to change any configuration via CLI
  • ConfigSource has a higher priority than CloudSource. This means that Developers who want to apply custom local changes on top of .magento.app.yaml and .magento/services.yaml have such a possibility.

build:custom:compose future command

This command can be added in the future to specify what source you want to use. This may be useful for CI/CD infrastructure where you want to have full control over the Deployment environment specification.

This command will work using 1 Source - JsonSource which converts input string to universal representation.

Possible arguments:

  • config - A JSON string to represent the full configuration list.
@shiftedreality shiftedreality added the architecture Issue type label Mar 24, 2020
@shiftedreality shiftedreality pinned this issue Mar 24, 2020
@NadiyaS
Copy link
Contributor

NadiyaS commented Mar 26, 2020

@shiftedreality

  • what possible list of sources for build:custom:compose? It cannot be all provided sources. So, just CloudSource or ConfigSource?
  • but, if we want to have separate command build:custom:compose which reads configs only from one file, then this file should not be the same as for build:compose, as for the second CLI command this file may contain only one config, when for the build:custom:compose this file should have all necessary configurations.

@shiftedreality
Copy link
Member Author

shiftedreality commented Mar 26, 2020

@NadiyaS

  1. There will be only one source - JsonCliSource or CustomCliSource, which can only transfer input string to universal representation
  2. There won't be config file sources for this command.

So, it will look like:

BaseSource -> CloudSource -> JsonSource

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants