0

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?

  • What problems or errors were you getting? No one can help without detailed information. Plenty of people use Features. It is also worth your while to learn Drush. – Kevin Oct 6 '17 at 13:37
0

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

  • I tried the method described at Acquia and it worked. I only had problems at the end of the process, when the system was updating the translation of the languages installed, there were two active languages: Spanish and English. And strings were not translated, I had to uninstall Spanish, install it again and clear caches to get it right. – jmzea Oct 9 '17 at 8:40
  • Error: An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /mp2017-8.4/core/install.php?rewrite=ok&langcode=es&profile=config_installer&id=3&op=do_nojs&op=do StatusText: OK ResponseText: - Lemon Seed import url("/mp2017-8.4/core/assets/vendor/normalize-css/normalize.css?oxeutp"); import url("/mp2017-8.4/core/themes/stable/css/system/components/ajax-progress.module.css?oxeutp"); import url("/mp2017-8.4/core/themes... – jmzea Oct 9 '17 at 8:41
  • I have tried this method again,using Config Installer and it was successful, there are a couple of things. 1. After the installation I went to Synchronize Configuration and there were 100 hundred differences, I don’t understand why, the installation used the same configuration files. 2. After updating the changes, there are still 34 differences, no matter what I do, exported and imported the files again, rebuild cache... those changes are not imported. They are related to paragraphs, content type teasers and previews.Modules installed are the same on both. What can I do to fix this? – jmzea Oct 11 '17 at 11:44
0

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.

  • I tried the script but I got the error: sed: /Users/jm/Documents/Temp/sync: in-place editing only works for regular files – jmzea Oct 6 '17 at 15:45
  • Not sure what that means, I have used this a lot. What OS are you running? There are small nuances between OSX and Linux. – Kevin Oct 6 '17 at 15:58
  • I'm using OSX . – jmzea Oct 6 '17 at 15:59
  • Yeah it might need a slight tweak for compat reasons. I ran into this with sed before. – Kevin Oct 6 '17 at 17:00
  • You could try... sed -i.bak '' '/^uuid:/d' $f – Kevin Oct 6 '17 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.