I'd like to propose a change to how distributions are handled.

Today if someone builds a site from a distribution they are tied to that distribution. If the distribution is modified, or the site's configuration is modified beyond the distribution's bundled settings, or the distro falls behind how Drupal core or contrib manages certain configuration, the site has to work out how to handle that divergence.

Some of the problems and complexities of distributions were mentioned in #1356276: Allow profiles to define a base/parent profile.

Proposal: Distributions be changed to be a "starting template" for building a site, after the initial installation everything would be managed by that site.

To do this, distributions would need to be restructured:

  1. A distribution would primarily become a list of dependencies (info.yml or composer.json).
  2. A distribution could include the existing .install, .profile files.
  3. A distribution could include configuration listed in a config directory, which would be installed by default.
  4. Support would be dropped for a distribution to include its own modules, themes, etc, those would have to be built as their own projects and added via #1.
  5. It would no longer be possible to download a distribution from d.o.
  6. Distributions would become options for composer's create-project system, e.g. "composer create drupal/openatrium myproject".
  7. Creating a distribution project would create the codebase as normal, and clone the profile to web/profiles/myproject with the required files renamed.

The end result would a a site built from the distribution without any dependencies or custom code which could not be managed entirely by that site.

Comments

DamienMcKenna created an issue. See original summary.

berdir’s picture

Isn't that basically what install-from-config is? https://www.drupal.org/node/2897299, if you combine that with a composer.json and a way to get the config, what else is missing?

I think there is a valid use case for distributions that are more than just an starting template. The way we handle our internal distributions and also projects like thunder IMHO are built is that they're more than just that, they are continuously developed and deal with existing sites as well as new ones.

I think the long-term plan from @alexpott is to deprecate the current install profiles in favor of that, I suppose it doesn't make a big difference if the final piece of setting things up is in a module or install profile install hook, I still have some reservations though, for example. we mostly stopped providing config overrides/default config for simple config, but it's pretty common for modules to add more configuration settings or change defaults, and then you have to be *very* careful on every module update to update your override/exported config accordingly. That's why we do most of our simple config changes now in hook_install() with PHP code to just write the settings we want to change.

daniel.bosen’s picture

I like every single proposal of that, especially 4-7. But I don't get, why this would make distributions (even more) starting templates?
I think the current implementation is already very much aimed at that concept. And for Thunder it is actually quite a hassle to provide the Distribution in a more product-centric way with updates and continuous improvements. And we actually also use code to do the config changes over time.
Nonetheless, I think all your ideas would streamline working on, and with, a distribution.

damienmckenna’s picture

@Bedir: So the key part would be deprecating some of the pieces we have today that make this more complicated, and then doing the Composer pieces. Yes, it could even skip the install profile entirely if the script generated a settings.php file with the config sync path defined.

As for larger distributions like Thunder, the custom functionality would need to be moved into separate modules that would then be responsible for handling the config changes.

This whole idea is driven by seeing so many different projects start with a distribution but end up hamstrung by it because of either limitations or lack of maintenance, in just about every case the site would have been better off taking full control of the site's configuration after the initial launch and leaving the distribution behind.

daniel.bosen’s picture

As for larger distributions like Thunder, the custom functionality would need to be moved into separate modules that would then be responsible for handling the config changes.

Ok. So, If you decide to be a starter kit distribution, you just provide config files and a composer file, but if you want to be updateable, you additionally provide a management module.

Hm, interesting.

I guess we would have to be careful with install from config though, we should not end up with all sites having the same uuid...

damienmckenna’s picture

I didn't say this would be easy ;-)

daniel.bosen’s picture

Nope, not easy. But you came up with this idea at a time where I am totally reconsidering the way Thunder handles itself and the projects that are based on Thunder.
So, I am very interested :-)

vijaycs85’s picture

✅ +1 for this idea issue. I am not sure where we go with the implementation, but documentation on what is/isn't possible with install profiles, best practices, and things to avoid in the (relatively) new composer world would be a huge win.

✅ +1 for making the profile as lite as possible so that it is not another major upgrade activity for sites based on a profile.

Distributions be changed to be a "starting template" for building a site, after the initial installation everything would be managed by that site.

❓I am not sure how this would be true though. even having composer files with dependencies would require version bumps. Having an option to do it in a global location instead of every single site would be nice. e.g. use case would be to use the same version of drupal/redirect module on all sites created with the given install profile.
❓ This change would also mean site created using the install profile today would be different from the one created using the same profile in a month (as install profile got a new version with different modules or new version)

I guess we need a different solution for those on-going updates via a module or some other means?

freelock’s picture

It almost seems like if this is done right, it could overlap with Features.

I'm thinking having a starting point that enables a set of modules and a base starting config -- but if once that is installed, you no longer need the profile... then why not allow you to install another "profile" on the site to add additional config and modules?

damienmckenna’s picture

It's nice to see this idea being taken up by the core maintainers and featured by Dries in his Driesnote at DrupalCon: #3274999

pameeela’s picture

Is it fair to say that recipes are addressing this?

damienmckenna’s picture

Status: Active » Fixed

I think so, yes.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.