8

I am building a Drupal 8 site and I have done some research whenever I should use Configuration Management or Features to export configuration and include it in my profile. In order to export and import configuration with Configuration Management from one site to another, sites have to have the same UUID. It means that they have to be a clone of each other. There are two ways to achieve this:

  1. Clone the DB from one site to the other in order to have the same UUID
  2. Programmatically modify the UUID to match the one in configuration

The site I am going to build will have its own profile installation and my intention is to keep configuration or features within the profile. I have already created my profile installation but now I have to include configuration in a way it does not depend on UUID so I can:

  1. Spin up a fresh development environment using profile installation
  2. Develop new functionalities
  3. Export new functionalities in the profile
  4. Deploy it to prod and apply new functionalities without re-installing the site

How can I export configuration and add it to my profile? Should I use Configuration Management and manually remove the UUID or should I use Features and add it to my profile?

Using the Features module, I am not able to set the destination for my features. I would like to put all my features under profiles/my_profile/feature. When I create it I am not able to set a destination so it gets saved under modules/custom. I manually moved it from modules/custom to profile/my_profile/features. If I update it, it will not update the features I moved but instead it will create a new feature with the same name under modules/custom. How can I setup a custom destination?

2 Answers 2

4
+50

I would advise using Features. This would allow not only exporting functionality and compartmentalizing it a lot easier, but you could also have the ability to bring in features later from an external source, and/or, use certain features here on a different site that didnt start with your installation profile.

Currently there is an issue to support custom path generation for Features: https://www.drupal.org/node/2693123

When that is addressed, you can generate the features to the path of your choice. For now, you can generate the result, grab it out of modules/custom and place the generated feature module into your profile.

3
  • I am trying to use features but it generates it on modules/custom while I would like to keep it under profile/my_profile/my_feature. I can generate it and move it but then when I want to update it puts it again under modules/custom. How can I set a custom destination? Jul 2, 2016 at 14:57
  • I would file a issue in the Features queue (I think one already exists for the destination override). In the meantime, generate them and place them in your profile. I had done this previously for Drupal 7.
    – Kevin
    Jul 5, 2016 at 12:53
  • I have found the issue: drupal.org/node/2693123 . At the moment I am generating it under modules/custom and leaving it there, when I have my first release I will move it into profile/_myprofile_name/feature. If you expand your answer with more instructions I can give you the bounty. Jul 5, 2016 at 13:21
1

Adding some counter-argument info for assimilation/consideration:

Features module maintainer Mike Potter is encouraging folks to stop using the features module as ...

Features module is really no longer needed and shouldn’t be used to deploy configuration. However, Features still provides a powerful UI and plugin system for managing configuration and in combination with new modules such as Config Actions it might finally achieve its dream of packaging reusable functionality.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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