Question

I have a Drupal 8 installation with different content types, paragraphs defined, views and taxonomy vocabularies. Ideally I wanted to be able to export some of these features and import them in another site, to deploy sites quickly without having to define them.

So first I tried with the module Features, I have followed the tutorial http://www.beaconfire-red.com/epic-stuff/how-setup-features-module-drupal-8, but this module only brings problems. I have also tried the Configuration Installer module, but also gives me problems. And also changing the uuid in the new installation and trying to import the configuration. But there are always problems and errors. So the only solution I can find is just cloning the database, but I think it's just a dirty solution.

I'm not an expert using drush, but I was wondering if it is possible in Drupal 8, to create a profile installation where you can define the content types, paragraphs and views created to reuse them. Is it possible?

Is there another way to achieve what I need? How is it possible that there is not an easier way to export just part of the functionality of a site?

Was it helpful?

Solution

There currently is no simple (UI guided/mouse click) way to export and reuse complex features. Period.

A) Features works well for simple features (e.g. a paragraph with a few basic fields), but fails quickly when adding advanced features (adding entity references, dependency on modules, image styles,....).

B) It is moderately easy to export and reuse the complete feature set into a fresh new site. See my own conclusions in a similar question: Can I safely use the same UUID on independent sites?

There is some undergoing work to make variant B better/easier using configuration installer, but currently requires a core patch. See Acquia's blog post => section "Solution (Drupal 8.4.x)" how to use the new (and IMHO better solution than features) to clone an entire site's feature set

OTHER TIPS

If you want to just extract specific functionality, you need Features.

If you just want to clone an entire site, first you need to export the site config with drush. Then, you will need to wipe all UUIDs from config export files using a script, here is an example:

#!/bin/bash
FILES=/path/to/your-site/config/*
for f in $FILES
do
  echo "Processing $f file..."
  sed -i '' '/^uuid:/d' $f
done

From here, you can install a brand new Drupal 8 site, and then drop the config in and do a drush cmi to overwrite the entire config state to the one you exported.

I've used this method a few times to clone entire sites. You don't need to copy the database, in fact I would strongly advise against this.

If you wanted to make an install profile, you could do that too, and one route to doing that is to put your feature modules in a profile, include them as dependencies in the profile info file, and optionally add an installer script to configure the site a little further (default content?). But yeah, you will have to dive in a bit here.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top