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

Adding support for config_split. #1102

Merged
merged 15 commits into from
Mar 21, 2017
Merged

Conversation

grasmash
Copy link
Contributor

No description provided.

@grasmash grasmash added in progress Enhancement A feature or feature request labels Feb 15, 2017

<target name="setup:config-import:config-split">
<drush command="en" assume="yes" alias="${drush.alias}" passthru="false">
<param>config-split</param>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command doesn't seem like it would work...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, need an underscore rather than a hyphen.

@geerlingguy
Copy link
Contributor

See also: #1138

@danepowell
Copy link
Contributor

I'm working to clean up documentation for this here, I'll open a PR when it's ready:
https://github.com/acquia/blt/blob/danepowell-patch-3/readme/configuration-management.md

Note that this replaces the features-workflow doc.

<drush command="config-import" assume="yes" alias="${drush.alias}" passthru="false">
<option name="partial"></option>
<param>${cm.core.config-dir.key}</param>
<mkdir dir="${cm.core.path}/${env.AH_SITE_ENVIRONMENT}"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do this in a Cloud environment? Wouldn't the filesystem at ${cm.core.path} be read-only?

Copy link
Contributor Author

@grasmash grasmash Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I guess we can't do it in a cloud env. Really, the user should be creating this directory manually. Not sure what happens when this doesn't exist. This may be problematic for ODEs... perhaps we should just skip import of the dir doesn't exist? @geerlingguy thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we should just skip import of the dir doesn't exist?

I like that idea.

@danepowell
Copy link
Contributor

We should bump the Drush version to ^8.1.10 since that's the minimum supported version with config split: https://github.com/acquia/blt/blob/8.x/template/composer.json#L21

@danepowell
Copy link
Contributor

This looks good to me except for my comments above.

@grasmash
Copy link
Contributor Author

grasmash commented Mar 9, 2017

This PR is currently failing because we need some example config_split config to use during CI testing.

<drush command="config-split-import" assume="yes" alias="${drush.alias}">
<!-- Cloud environments require vcs parameter. -->
<param>vcs</param>
<option name="split">${environment}</option>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note—the 'split' is now a param and not an option—so it should be:

<param>${environment}</param>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You actually shouldn't even put ${environment} as an option. The environment needs to be specified in settings.php
See
@geerlingguy @grasmash See a PR where I got the new version of config_split/config_filter working with Canary. Specifically:

https://github.com/acquia-pso/canary/pull/25/files#diff-e56cbd5daab22087fd0e4849dc38055dR14

https://github.com/acquia-pso/canary/pull/25/files#diff-2737999ec8b2368b193b40b46c5679c2R758

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arknoll Does it have to be done that way? I'd much rather use a param than write to settings.php.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does appear that you have to use the settings.php approach.

Based on the maintainers statement it appears it was by design:
"I think it is better to simplify the options of the command so that it is easier for everybody to use and understand. In my opinion and my experience it is better and safer to define which splits should be imported and exported in settings.php rather than scripts." -- https://www.drupal.org/node/2861266#comment-11990329

<drush command="config-import" assume="yes" alias="${drush.alias}" passthru="false">
<param>${cm.core.config-dir.key}</param>
<drush command="config-split-import" assume="yes" alias="${drush.alias}">
<option name="split">${environment}</option>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note—the 'split' is now a param and not an option—so it should be:

<param>${environment}</param>

@geerlingguy
Copy link
Contributor

@grasmash - Note also, it looks like beta4 might have a bug where it doesn't combine the split with config/default correctly, either. See Split no longer merges from default.

@arknoll
Copy link
Contributor

arknoll commented Mar 17, 2017

@danepowell
Copy link
Contributor

Yeah it looks like it's not really a bug in beta4, just a change in how config_split works. It now relies on overriding the configuration via settings.php (like Alex did for Canary) rather than passing the command line argument.

@grasmash grasmash force-pushed the issue-965-config-split branch from f88a46c to 86f7cb9 Compare March 20, 2017 20:37
@grasmash grasmash force-pushed the issue-965-config-split branch from 05bf66a to ec1551f Compare March 21, 2017 00:58
@grasmash grasmash merged commit f841b2e into acquia:8.x Mar 21, 2017
$config['config_split.config_split.dev']['status'] = FALSE;
$config['config_split.config_split.stage']['status'] = FALSE;
$config['config_split.config_split.prod']['status'] = FALSE;
$config['config_split.config_split.ci']['status'] = FALSE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grasmash - There are no extra settings for RA (many subscriptions have an ra environment as well). Do you think that might be something to add? Or just note that people should add an ra-specific split in their own settings.php if they need it?

One other note—for my sites I'm currently using a test split (not stage) to match the fact that Acquia Cloud still uses test as the machine name for the Stage environment... for those projects who are already set up using this kind of naming convention, I'll try to document how to switch the split name correctly. Just wanted to put that out there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also using test (mainly because that's what canary does... I haven't tested to see how it works yet).

Besides RA, a project could have any number of custom environments (typically dev1, dev2, etc... but they could be named anything). I think it would be awesome if we could create this configuration automatically, or as part of a wizard (i.e. "here are the typical environments, do you have any others?"). Short of that, just documenting it would be good.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danepowell - Also, ODE could throw a wrinkle depending on how you structure your config... it might be nice to say "any non-prod environment gets split xyz"...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also see my notes-in-progress here: #965 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement A feature or feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants