Problem/Motivation
In #2788777: Allow a site-specific profile to be installed from existing config we made it possible to install a site-specific profile which contains its configuration in {$profile}/config/sync. However, this does not work for sites that were built with a starter profile or distribution.
Installing from configuration is a shift in how the installer works and profiles need to be re-written to be able to deal with it. For that reason site-specific profiles are not allowed to have an install hook.
Some distribution and starter profiles - for example minimal - are already ready for the config-install. It should be possible to install a site from existing configuration if the config directory is already set up and contains valid configuration.
Specifically the workflow with a site based off minimal and config_installer which currently is:
echo '$config_directories["sync"] = "../config/sync";' >> sites/default/default.settings.php && drush si config_installer
could become:
echo '$config_directories["sync"] = "../config/sync";' >> sites/default/default.settings.php && drush si minimal
Proposed resolution
Check for an existing config directory and install the site from there.
How to test
- Install the minimal profile
- Make some configuration changes - for example the site name
- Use drush config-export to export your configuration to the sync directory
- drop your database and re-create an empty on with the same name
- Visit your site - you'll be taken to the installer and on the profile select screen you will be able to choose "Use existing configuration"
Note if you repeat this with the standard profile you will not be able to do this because the standard profile has a hook_INSTALL(). See #2982052: Allow an install hook in profiles to install from configuration for more on this.


Remaining tasks
- UX review.
- On commit update the CR https://www.drupal.org/node/2897299
User interface changes
See screenshot. New option on the installer profile select page.
API changes
Support new install parameter of existing_config. If this is set to TRUE (or 1) and a sync directory is defined in settings.php then the configuration contained in the directory will be used to install Drupal.
Data model changes
none.
| Comment | File | Size | Author |
|---|---|---|---|
| #47 | Select an installation profile Drupal.png | 1.01 MB | brooke_heaton |
| #35 | Screen Shot 2018-07-06 at 10.39.42.png | 176.34 KB | marcvangend |
| #33 | 2980670-33.patch | 17.81 KB | alexpott |
| #33 | 23-31-interdiff.txt | 3.33 KB | alexpott |
| #33 | Screen Shot 2018-07-05 at 11.14.35.png | 353.89 KB | alexpott |
Comments
Comment #2
bircherAttached a first working version. Tests pending.
Comment #3
bircherI am open to discuss the approach above, but it works well in our case.
Comment #4
bircherrun test-bot, note this still needs a test for this specific addition.
Comment #6
bircherActually it needs some fixing.
Comment #7
yogeshmpawarTriggering bots.
Comment #8
alexpottI think this could be an else?
Doing this in install_load_profile feels super odd. So here's the interesting thing - what happens if the install profile the user is in the process of choosing is different to the install profile in configuration. I think what would be better is that when there is existing configuration the option to use it for an install appears on the profile selection form as this needs to be decided then.
Comment #9
bircherYes I was thinking of that as well and so checking it is important and then it also makes sense to do it there.
The point is to do this a step before the UI changes. This is to avoid documenting that one should symlink the config sync directory into some profile like minimal or a distribution in order to make them behave the same way. I created another issue to deal with the UI changes.
Test still pending.
Comment #10
alexpottTurns out that I think a small UI is actually worth it. Rather than polluting the settings.php with a new setting that only is used during installs we can add an install state parameter to do this. Drush/Console can then set this when installing depending on a flag and they can work out the correct profile to use from config too.
Test still pending.
Comment #12
alexpottHere's test coverage.
Comment #13
bircherThe UI option is quite sleek yet informative so I don't think this would cause a UX regression. However, it leads currently to expectations we can not currently live up to.
In particular we know that we can not install a site from existing configuration when the profile has an install hook.
See #2982052: Allow an install hook in profiles to install from configuration
(Say one: installs standard, exports config, drops DB, selects the option, BAM! experiences error => not good UX)
In
system.installwe doSo we should hide the UI option in this case with a similar check and add :
//@TODO: remove this condition with https://www.drupal.org/project/drupal/issues/2982052Also add this to
system.installline 1007Comment #14
alexpottPatch addresses #13 and adds a test for this case.
Comment #15
alexpottComment #16
alexpottComment #17
alexpottAdding screenshot to summary. Shows that we need to add
word-wrap: break-word;somewhere :(Comment #18
alexpottFixing the word-break issue.
Comment #19
alexpottComment #20
bircherI think the current patch is significantly different from my patch contribution for me to RTBC this.
The code path is different and it now has a UI option.
I manually tested it and it works beautifully as expected.
Needs change record.
Comment #21
jibranThe patch looks great. It is a small feature but it is much needed. I just have on concern about the UI change. For a normal user, it can be confusing as first three options are installing profiles and last one states 'Use existing configuration'. I think it should state 'Use existing configuration to install %profile'. Adding UX review tag to loop in UX team.
I know this is an active initiative but should we not need a release and product manager review here after all this is affecting the way we install the product?
As mentioned in IS we are going to update https://www.drupal.org/node/2897299 on commit but IMO this should have a separate change record as well as stated above it is affecting the way we install Drupal.
s/Remove/removes.
Comment #22
webchickA UX team review was requested and so we looked at this patch on today's UX meeting, which will eventually be at https://www.youtube.com/watch?v=n4zlDxVVnnQ. The demo started at about an hour in and was pretty painful since Drush wasn't working. :D
- Big+1 for the feature itself. It's a very common use case to have a new developer come onto a project, for example, and to want to get them up and running with a current copy of the code + config.
- The new entry in the installer is a bit 😱😱😱...that directory name is frigging scary, and the wording there is extremely technical. But one nice thing is it only shows up if you're in this exact situation, meaning you deliberately put a bunch of config files into your sync directory and started installing Drupal from scratch. (e.g. you're a "user 1" type.)
- One suggestion to counteract that was to maybe do the same thing that we do with the Umami selection, and initially show much smaller help text (maybe something like "Install the Profile profile from pre-existing configuration.") and then only show the long scary directory name if the option is actually selected. (maybe transitions to append "The configuration will be imported from the [directory] directory.") This would make the initial list far more scannable and hopefully lead people to make better choices, vs. that one option leaping out due to its visual prominence. Because the scary text is only visible if you're in this exact situation, this suggestion doesn't have to block commit, but if it's easy it would be cool to do.
Otherwise, no UX concerns from us, with the caveat that none of our "usuals" in terms of designers/UX folks were on this week's call cos they're at Dev Days.
Also, we did hit one bug... I'm not moving down to "needs work" because it could've been something on my install, but since I couldn't get drush cex working, we did a slightly different workflow which was to:
1. Install the minimal profile
2. Make some configuration changes: changed site name during install, added a content type + field
3. Do a manual "Full export" from the config sync tool.
4. Copy/paste all of the files from the downloaded tarball to the config_xxx/sync directory
5. Drop your database and re-create an empty on with the same name
6. Reinstall choosing "Use existing configuration"
7. Everything imported properly, but the Tools and Administration menu blocks were gunked up: it said "This block is broken or missing. You may be missing content or you might need to enable the original module." But we didn't mess with any block-related stuff (and there's video proof! ;)).
So one more run-through using the Config Manager in core, not Drush, by someone who knows what they're doing, might be good. :)
Comment #23
alexpottThanks UX team for the review. Patch attached changes the visual weight by only displaying the path ala the Umami warning. I've updated the issue summary screenshots. Also what's nice about this is that we don't need the CSS change then.
I discussed the text and user experience with @gábor-hojtsy and have incorporated the feedback.
@jibran thanks for the review too. I don't think the profile name should be in the radio button title because then you've got a problem with which "Minimal". The most important thing is that you are installing from existing configuration.
@webchick - yeah I noticed the minimal menus when I was testing this morning too. I'm filed a follow-up to address this - #2983603: Move menu_ui_menu_* entity hook implementations to the Menu entity
Comment #24
alexpottComment #25
webchickScreenshots look great to me, thanks! And thanks for the follow-up, too. Good to know we found a legit bug. :)
Comment #27
webchickAlso, crediting @benjifisher for the "copy/paste from Umami's entry" idea.
Comment #28
jibranDo we need release and product manager review? The only thing left here is a change record with proper screens ;-) This looks a lot better now. Thanks, @webchick, and @alexpott!
Comment #29
webchickII don't *think* so? This is adding a new capability to an existing API, not a whole new subsystem and/or module to the system.
Comment #30
marcvangendRe #21 #22 #23:
I'd say the profile should not be mentioned in the install option. When I use a profile like minimal, it is a starting point. Once I start adding modules and building my site, I don't see it as minimal anymore. The fact that it once started as minimal is no longer relevant; it's my own site now.
What users need at that point, is confirmation that they are making the right choice, so they can predict the outcome. Mentioning the install profile is not going to give that confirmation and may even be confusing ("Which one is it, minimal or my own config?").
What would be really nice, is to extract some info from the existing config yml's, probably the site name, and present that to the user. So the radio button title could become "Install the site named %name using existing configuration."
Comment #31
webchickWell, if that suggestion is easy to do, I agree that'd be preferable.
Comment #32
alexpott@marcvangend great idea to use the site name! I'll implement that next unless someone else does in the next couple of hours.
Comment #33
alexpottI've added the site name to the radio description. I didn't add it the radio title because I think this will then bring up the difficulties of sorting the radio buttons, also the site name can be literally anything and any length so it presents a design problem. And it is not a profile but imagine you site was called "Profile". It'd be hard o make ha look right. At the moment the order is alphabetical apart from Standard (which always comes first) and Minimal (which always comes second). I will file a followup to discuss the UX issues of sorting this list because once 8.6.x is out and Umami is present I'm not sure the order makes sense.
Screenshots in the issue summary updated.
Comment #34
alexpottI've created #2983839: The sort of install profiles is interesting to discuss the install profile sorting issue.
Comment #35
marcvangendI tested this manually and it works as described in the issue summary. I'm happy to see the site name in the radio description, I think it's a big improvement for UX. Personally I'm not too concerned about the "scary" directory name (#22) because it now only shows up as a confirmation after selecting that option, and it has the friendly green color and check mark.
Regarding #22 point 7:
I tested the same scenario and indeed this message is rendered instead of the original block content: "This block is broken or missing. You may be missing content or you might need to enable the original module." See the screenshot:
Unfortunately this is to be expected and beyond the scope of this issue, I'm afraid. Custom blocks are part config (block id, label, placement, visibility settings etc.) and part content (the actual block content). Everywhere there is config depending on content (there are more examples, like embedding a node in the header of a view), you will see that config management cannot prevent this.
I'm calling this RTBC.
Comment #36
smazRelated issues for around block content not playing nicely with config in this way:
#2906919: Allow users to create a block content entity with a specific UUID if it is a missing dependency of a config object
#2756331: Custom blocks cannot be properly exported and imported
Comment #37
gábor hojtsyAdjusting credit.
Comment #39
gábor hojtsyCommitted 8fbece0 and pushed to 8.6.x. Thanks!
Still needs the change notice update. Should be marked fixed afterwards.
Comment #40
amateescu commentedI think this commit broke HEAD for PHP 5.5: https://www.drupal.org/pift-ci-job/1012684
Comment #42
alexpottI've updated https://www.drupal.org/node/2897299
Comment #43
neclimdulSo excited to finally see all this going in! Crazy good site builder DX wins!
Comment #44
webchickGood point, let's mention this explicitly as a highlight of 8.6.0! :D
Great work everyone!!
Comment #46
phuang07 commentedComment #47
brooke_heaton commentedDoes this actually work? I'm on 8.9 and have my configuration directory set in settings.php and do NOT see any option to install from configuration.
Comment #48
brooke_heaton commentedAh, okay, you can't do this if you use the Standard profile. Wow, that sucks.
Comment #49
gagarine commentedFor future reference. To work with the Standard profile this need to be fixed #2982052: Allow an install hook in profiles to install from configuration