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

Impossible to site-install --config-dir with any profile other than minimal #2953

Closed
danepowell opened this issue Sep 22, 2017 · 25 comments
Closed

Comments

@danepowell
Copy link
Contributor

danepowell commented Sep 22, 2017

As of #1921 and Drush 9, it's impossible to install a site using the config-dir parameter and any profile other than minimal.

This was apparently an intentional change to fix problems with UUID changes and content imports, but it had the side effect of basically breaking any profile other than minimal.

The problem is that once a site is installed with a given profile, you generally cannot change that profile via a configuration import. Attempting to do so results in all sorts of error messages like this:

Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization. in Drupal\Core\Config\ConfigImporter->validate() (line 728 of /var/www/foo/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php).
[error] The import failed due to the following reasons:
Unable to install the bar module since it does not exist.
Cannot change the install profile from foo to minimal once Drupal is installed.

Furthermore, when Drush forces the install profile to be minimal, that overwrites any value of $settings['install_profile']in settings.php to also be minimal. This could cause all kinds of problems. For instance, on read-only file systems, the install will completely fail. For other file systems, it will prevent you from changing to any other install profile, even if the config-import were successful. In fact, this might actually be what's generating the error message above (note that it's trying to change from a custom profile back to minimal for some reason).

I definitely think the original issue in #1921 needs to be solved, but not by forcing the install profile to be minimal. It's something that likely needs to be fixed upstream in Drupal core.

@greg-1-anderson
Copy link
Member

Shoot, I spent quite a bit of time figuring out how to make this work some time ago, but now I can't remember exactly what was necessary.

The reason I can't remember is that I decided it wasn't worth the complexity, when the config installer profile exists (and hopefully someday is heading to core). Now, I just use config installer, which works with any profile.

@danepowell
Copy link
Contributor Author

The Config Installer profile is completely undocumented, can you propose how to use it to install something like a Lightning sub-profile? AFAICT, that's impossible.

@greg-1-anderson
Copy link
Member

I think I did that, but my PR is out of date, and probably not working right now. It's not using config installer at the moment, though, so I'm not sure whether I did or did not try that permutation.

pantheon-systems/example-drops-8-composer#33

@balsama
Copy link
Contributor

balsama commented Sep 28, 2017

It looks like the Config Installer profile makes an exception and scans the directory of the profile listed in core.extensions.yml for extensions in addition to the regular places Drupal would look for extensions.

Unfortunately, if your site is using the core patch to allow for inherited profiles, there might be more than one profile directory that contains extensions to be enabled. And the Config Installer profile will fail during install because it can't find those extensions.

configure_configuration_import_location___drupal

I wouldn't expect Config Installer to be making that exception for parent profiles, just noting that it won't work with a profile like Lightning that contains extensions and is generally used as a base profile.

/cc @danepowell

@alexpott
Copy link
Contributor

alexpott commented Oct 5, 2017

Forcing minimal seems really messy especially the install profile is stored in config now.

@weitzman
Copy link
Member

weitzman commented Oct 9, 2017

I'd love some guidance from folks about how to proceed.

IIRC, the forcing of 'minimal' came after a steady stream of support requests from people trying to use --config-dir with standard profile. They were getting something like 'shortcut content must be deleted' before import'

@alexpott
Copy link
Contributor

alexpott commented Oct 9, 2017

Well ideally we'd have https://www.drupal.org/node/2788777 in core and we'd just move https://www.drupal.org/project/install_profile_generator into core drush and then people could create their own install profiles.

Basically config import was not designed to work the way drush is using it. A potential solution would be for drush to install minimal, delete all config entities, swap the profile to the one from config, and then do the config import.

@weitzman
Copy link
Member

weitzman commented Oct 13, 2017

Sounds good. PRs appreciated.

@weitzman
Copy link
Member

Anyone?

@balsama
Copy link
Contributor

balsama commented Feb 2, 2018

For those trying to solve the problem of installing a site from config, the Configuration installer profile works quite nicely. I've tested and documented our usage of it here: http://lightning.acquia.com/blog/using-configuration-installer-lightning

Ultimately, I think this is the parent issue https://www.drupal.org/project/drupal/issues/1613424

@bradjones1
Copy link
Contributor

At the very least I think we should add a warning if a profile is specified along with --config-dir? It would save me from learning this lesson anew every 6 months ;-)

@weitzman
Copy link
Member

weitzman commented Sep 21, 2018

try drupal 8.6 and drush si's new --existing-config option.

@rotemreiss
Copy link
Contributor

rotemreiss commented Nov 11, 2018

@weitzman How come it is not on the documentation?
Isn't that being automatically generated from the code annotations? I'll be glad to help with that if we need to update something 😉

@weitzman
Copy link
Member

Thats not official documentation. Thats a 3rd party site that is rarely updated.

@geerlingguy
Copy link

@weitzman - That 3rd party, site, unfortunately, is the #1 search result for almost any kind of drush-related query on Google. Is there any chance it could be adopted or subsumed by the project?

The fact that it's also the first link relating to Drush Commands on the official docs site lends credence and also can lead to some confusion :/

@geerlingguy
Copy link

Also just noting that when --existing-config is used with the standard install profile you still hit:

In install.core.inc line 2289:
                                                                                                                   
  Configuration install: standard                                                                                  
                                                                                                                   
  The selected profile has a hook_install() implementation and therefore can not be installed from configuration.  

Drupal.org issue, for reference: Allow an install hook in profiles installing from configuration. So for now the only real option to use Drush/Drupal's built-in install-from-config option is to use minimal as your install profile, or some other very simple profile, and do any non-config-related work via some other mechanism (e.g. default_content, migrations, individual module install hooks, etc.).

@reissr
Copy link

reissr commented Feb 12, 2019

@geerlingguy you can use https://www.drupal.org/project/config_installer . This is what I'm doing, and it works great.

@weitzman
Copy link
Member

Is there any chance it could be adopted or subsumed by the project?

I've asked. It was a while ago. If someone could make that happen I'd love to receive that site ... i've removed the docs links.

@chilaa
Copy link

chilaa commented Feb 10, 2020

try drupal 8.6 and drush si's new --existing-config option.

@weitzman How do you specify config dir? on drupal 8.8.x

@rogerpfaff
Copy link

in settings.php you would need $settings['config_sync_directory']

@Greg-Boggs
Copy link

If anyone else runs into this and wants a quick fix, delete the install hook from standard profile for a second and it runs fine. :)

@maskedjellybean
Copy link

maskedjellybean commented Mar 25, 2022

Should this issue be closed? It's not fixed as far as I can tell.

When I run:

drush site-install -y --existing-config

I get:

In install.core.inc line 2304:
                                                                                                                   
  Configuration install: standard                                                                                  
                                                                                                                   
  The selected profile has a hook_install() implementation and therefore can not be installed from configuration.  
                                                                                                                   
  Database settings:                                                                                               
                                                                                                                   
  Array      

@weitzman
Copy link
Member

Its closed because the limitation comes from Drupal core, not Drush

@maskedjellybean
Copy link

Got it, thank you.

@hkirsman
Copy link

Should this issue be closed? It's not fixed as far as I can tell.

When I run:

drush site-install -y --existing-config

I get:

In install.core.inc line 2304:
                                                                                                                   
  Configuration install: standard                                                                                  
                                                                                                                   
  The selected profile has a hook_install() implementation and therefore can not be installed from configuration.  
                                                                                                                   
  Database settings:                                                                                               
                                                                                                                   
  Array      

You need to update your core.extension.yml on 2 lines: https://www.hashbangcode.com/article/drupal-8-install-site-existing-configuration

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