When installing a Drupal 8 site with drush site-install, it's possible to add a --config /path/to/config/files option to import configuration. Assuming that you've got site-specific Git repositories that you're cloning with Aegir Hosting Git when you create sites, the site configuration should be available (if it was pushed to the repository).

I'd like for this to either happen automatically, or with a checkbox.

Do site Install tasks actually run drush site-install? I've been grepping through Provision, and can't find any references to it.

If so, it would be easy to add the option if the files are actually there so as not to have to manually run an Import Config task via Aegir Configuration Management.

In fact, drush config-import (which Aegir Configuration Management uses) isn't great anyway, as it requires you to remove all of the UUIDs every time you export. Otherwise, you get:

Site UUID in source storage does not match the target storage.

The core issue for this is Add an option to strip UUIDs from imported/exported config files.

Workarounds

Run `drush site-install --config /path/to/config/files` manually after the site is created

This is a waste of time because the site will be reinstalled, and it could take a while for certain distributions.

Update the site's UUID to match that of the site used to export the configuration

This would also need to be done manually after the site is created (and before the configuration is imported).

You can run something like this from the CLI:

SITE="example.aegir.local"; drush @$SITE config-set system.site uuid $(grep uuid $(find $(drush dd @$SITE) -name system.site.yml | grep $SITE) | cut -d" " -f2)

...and then hit the Import Config button. Or, have Aegir Configuration Management do this itself, set the UUID before the import.

Comments

colan created an issue. See original summary.

colan’s picture

Issue summary: View changes

If this doesn't make sense in core Aegir, we can move to Configuration Management.

Jon Pugh’s picture

Nope, Provision does not run drush site install. It essentially does what drush site install does:

It literally includes install.inc and runs the Drupal function site_install.

This is why Drush 9 cannot be included. This is why it's so confusing where the hosting platform ends and Drupal begins.

This is why we see so many "unknown drush errors".

The best solution is to create a pluggable install system, which I started when creating the "site_install" method == profile feature.

This is haphazardly solved in provision 4.x. I think I left it able to run "drush site-install".

I'm on my phone right now but I'm glad you are digging into this issue.

If provision is going to survive, this needs to be be addressed.

colan’s picture

So you're saying it wouldn't make sense to rip out this current Aegir 3 behaviour, and just run drush site-install instead? Would that cause too many problems?

ergonlogic’s picture

Another challenge is that, running drush site-install --config=... fails if it's passed an install profile with a hook_install(). So it is likely to require some pretty deep surgery to implement something like this.

colan’s picture