Problem/Motivation
We support install profiles, to customize the installation experience to some degree.
And we support installing Drupal from a recipe, bypassing the profile entirely.
But what we don't yet support is the in-between zone: you want to customize the install experience, but you also want to apply a recipe (or set of recipes) at install time. This grey zone is where Drupal CMS exists, and it needs to do some hacky workarounds to make that possible.
Proposed resolution
Allow a profile's info file to specify a list of recipes that should be applied once modules are installed. These recipes would be applied in the order they are listed, by appending their batch operations to the ones from install_profile_modules.
User interface changes
None.
Introduced terminology
None.
API changes
A new recipes key would be supported in profile info files.
Release notes snippet
TBD
Issue fork drupal-3605549
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3605549-profile-recipes
changes, plain diff MR !16123
Comments
Comment #3
phenaproximaAdded this new ability, and a basic test to prove it works with core recipes.
The main missing thing here is path resolution. Core recipe paths are used as-is, but if we add this ability, then we need to resolve recipe directory paths relative to...somewhere. How should we handle that? A few possibilities:
drupal/recommended-projectlayout, the paths would be listed as../recipes/foo. This is the simplest, but it means profiles using this superpower would be tightly coupled to the project layout.drupal-recipepackages will be installed, and resolve relative to that. This is what Drupal CMS does, and is probably the most robust choice.$install_state['recipes_directory']variable, defaulting to../recipes. This could be overridden programmatically by callinginstall_drupal()directly, or by a custom profile which does a similar thing. This is probably the most lightweight "configurable" option, since $install_state is already a hodgepodge of various state flags used only by the installer.$install_state['profile_info'].Or maybe something else?
Comment #4
gábor hojtsyThis also needs to take into account translation at one point. If not here then modified later to do it :) That the recipe should get its translation file downloaded prior to being applied. The data from such .po file is not currently used but will be after #3472317: Config language adaptation and translation does not happen at all when config is applied from a recipe.
Comment #5
gábor hojtsyAnyway recipes do not support that yet, so we can get this in like so, I think its quite simple and elegant and well tested :)
Comment #6
gábor hojtsyComment #7
catchThis looks good. Maybe we can get the new slimmed down standard profile to install from a recipe and remove its shipped config just based on this issue?
Of the four options for directory discovery, this sounds encouraging, although also something we could do in a follow-up once this is committed.
However if we do that, what happens to core recipes in that case? Should we just special-case the core directory and get everything else from the recipes directory? Was also wondering here about recipes shipped inside the profile directory.
Comment #8
phenaproximaYes. We already explicitly make an allowance for core recipes in the recipe system, so we'd just be doing the same thing here. Either the referenced recipe is a directory relative to the web root, or it's derived from the Composer install location.
Is that something we need to support? IMHO, we shouldn't. Recipes are atomic Composer packages, and part of the rationale for that was specifically to avoid the "modules can contain other modules, oh and also the profile can have them too" extension scanning dance inherited from Ye Olden Days.
If a profile wants to include recipes, it needs to reference them as Composer dependencies. It doesn't get to ship them internally. :) Recipes are deliberately Composer-native.
Comment #9
catchThanks #8 makes sense. In that case I think we just need a follow-up to implement:
Comment #13
catchLet's get this in.
Do we need a separate follow-up to implement recipe translation in the installer or should that be folded into #3472317: Config language adaptation and translation does not happen at all when config is applied from a recipe ?
Also think we should have a follow-up to try to use the standard profile recipe in standard profile and drop the config.
Comment #15
catchAlso we should have a change record to inform people this is possible. Re-opening for that.
Comment #16
phenaproximaCR written: https://www.drupal.org/node/3612237
Comment #17
phenaproximaFollow-up added: #3612240: Ensure install profiles can apply contributed recipes