-
Notifications
You must be signed in to change notification settings - Fork 2
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
Default setup for Config Split #119
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@becw this looks great. I like how you've split out the environments to their own build settings files. That definitely keeps things cleaner.
Re:
Is adding a Drupal install profile introducing a maintainability problem?
I'd say yes. I think committing the install profile to code means we'll have a lot of updates to do for almost every minor core update. I've seen this on Federated Search Demo, where I've rebuilt a few times to get Umami changes. I added some comments inline on how we might achieve what I think is a similar result. If you had other changes committed to code, I think we should be able to put all of those into the .install
file you started (which I really like).
* | ||
* @see system_install() | ||
*/ | ||
function the_build_install() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving all these to the profile is awesome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I totally re-used most of the stuff from the standard
install profile here :)
<arg value="drupal/config_split" /> | ||
<arg value="drupal/devel" /> | ||
<arg value="drupal/workbench" /> | ||
<arg value="drupal/workbench_tabs" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional recommendations:
https://www.drupal.org/project/stage_file_proxy
https://www.drupal.org/project/admin_toolbar
I also like to use https://www.drupal.org/project/environment_indicator, but I realize that might not be for everyone.
I think we can hold off on installing any of the more specific functionality like search_api, as that'll prob be on a project-by-project basis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI I've created an issue (palantirnet/drupal-skeleton#83) which adds this list of modules into composer.json > suggest. PR: palantirnet/drupal-skeleton#84
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jesconstantine that's cool, but do we have any rationale between why some are pre-installed and some are just suggested? (prob a question for @becw too) but it seems like all of those in suggested could just move to require
, as they could always be removed too.
@@ -24,6 +24,9 @@ | |||
$settings['file_public_path'] = '${drupal.site.settings.file_public_path}'; | |||
$settings['file_private_path'] = '${drupal.site.settings.file_private_path}'; | |||
|
|||
// Enable/disable config_split configurations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might recommend changing this to the following (or adding):
To simulate other config split environments, change
development
tostaging
orproduction
, then rundrush cr && drush cim -y
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
$date_settings->set('timezone.default', 'America/Chicago'); | ||
$date_settings->set('timezone.user.configurable', FALSE); | ||
$date_settings->save(TRUE); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we remove the config, it might be good to add/remove modules with some code like this: https://github.com/palantirnet/akamai/blob/e267bbf5ebe8ea6ff59b07caecc1e9dd93c53fb4/web/modules/custom/ak_utilitiy/ak_utility.install#L11-L20
$old = ['automated_cron', 'big_pipe', 'contact', 'history', 'search', 'tour'];
$new = ['admin_toolbar', 'admin_toolbar_tools', 'config_split', 'workbench_tabs'];
\Drupal::service('module_installer')->install($new);
\Drupal::service('module_installer')->uninstall($old);
I left out devel and stage_file_proxy since they'll have to be set up split to the development environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we can extend the 'standard' install profile, given that #1356276 Allow profiles to define a base/parent profile and load them in the correct order is still open, which means that we wouldn't be uninstalling those modules like this... unless we provided the code that is currently an install profile as a module instead -- is that what you're thinking here?
The challenge I found with the standard install profile is that it is difficult to uninstall some of the modules that are enabled by default -- specifically, contact
and comment
, because the entity types/fields have to be explicitly deleted before they can be uninstalled. I think it's important to uninstall those modules because they present forms for user input that we don't usually use -- and that's not great, if we forget to uninstall them later.
... but if we don't use the standard install profile, we don't get things like the default block placement, the 'basic' block type, and the article/page content types... etc., etc.
So if I change this to be a utility module, then I would probably just do the extra work to fully uninstall contact
and comment
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I didn't fully think it out before, but without having any config then moving this into a module (like the_build_utility
or the_build_installer
as you suggested via Slack) I think would be the right path.
You present some good points, and I'm torn on where to start. I often think Minimal might be a better starting point since we're always overriding something in Standard, but then I look and Minimal is soooo little. I think your idea above sounds like the best compromise. With the existing install code it shouldn't (🤞) be too much work to remove those fields and disable the modules. That way instead of trying to track the changes to Standard with new Core updates we just have to make any modifications to our install steps, which should be much easier to maintain.
@becw one more thing I forgot to add: I wrote some pretty decent documentation for how to manage splits here https://github.com/palantirnet/umhs-acquia/blob/unified-search/docroot/config/README_CONFIG.md. Where do you think the most useful place for that to live would be? |
@becw I believe I've successfully moved all of the desired functionality and configuration out of the install profile and drupal-first-install task and into a custom module. I just have 1 outstanding question:
To test
|
|
defaults/config/modules/custom/the_build_utility/the_build_utility.info.yml
Outdated
Show resolved
Hide resolved
$date_settings->save(TRUE); | ||
|
||
// Install modules that we want but are not included with standard profile. | ||
$install = ['config_split', 'devel', 'workbench', 'workbench_tabs']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we add Admin Toolbar, these modules should be added:
admin_toolbar, admin_toolbar_tools
… by git, and devs don't try to edit it.
I made two small changes, and I'm happy with how this looks. Thank you so much, @jesconstantine and @froboy! I have one remaining problem: when I visit the admin section after the first install, I get errors suggesting that the What do you think? Do we need to adopt the same profile-changing approach that you used on Akamai? |
@becw @jesconstantine I'm trying to test this out, but having some trouble. I've required this branch and run the installer, but Drupal is having trouble seeing
I've checked and the module exists and is symlinked into the right place, but |
I've tested this on a fresh skeleton and it worked fine. Not sure what was happening above. @becw re: above:
This should be moot, as that line shouldn't be in
|
I removed that line (see ⬆️ ) and the message goes away but install still proceeds correctly. I think I'm seeing a similar notice on first login. No idea if this is something we should try to resolve, but it doesn't seem to be breaking anything and it doesn't appear on reinstall. Since we're always dealing with a fresh install case here I don't think we need to use the update-hook method... Maybe just advise folks to reinstall once after the initial before committing a db (which I'd assume almost everyone will do anyway).
|
Addresses #112.
This work changes the
drupal-first-install
target to use a custom install profile that lives within the-build. This pulls the module enabling/disabling and configuration changes out of the target, and puts them into the install profile.The new install profile is a close sibling of the "standard" install profile, minus some modules that should be disabled on our sites, and plus config_split, devel, workbench, and workbench_tabs.
The new install profile also sets up three config_split environments:
development
,staging
, andproduction
; these splits are switched on in our settings.php filesTesting:
vendor/bin/the-build-installer
config/config_split/development/
directory with some configuration in itOther questions: