At this time (v 1.14.1), there is no easy way to add a bundle of config files to a site at one time (let's call it a feature recipe). You can import all the config files or you can import them one at a time. However, it would be really nice if I could export a batch of config files that together make up a feature recipe for something like a FAQ. 

A simple FAQ feature recipe, might include the following .json files (a simple example). 

  • field.instance.node.faq.body.json
  • node.type.faq.json
  • views.view.faq.json

Any ideas on how I could import this feature recipe all at once?

NOTE: If importing them one at a time, it's problematic, because you have to be careful to import them in the right order. You can not import the view.faq.json file before you import the node.typle.faq.json file. 

Accepted answer

[NOTE: 11/19/2019] Check status of this issue before using this method: https://github.com/backdrop/backdrop-issues/issues/4217

One solution to this problem is to:

  1. Export all the config for the entire site
  2. Add your new config files to the entire directory of config files
  3. Recompress the files into a tar.gz file and import them all

I tested this and it first it did not work for me. The problem appeared to be that in creating the tar.gz file, I was compressing the config directory itself. You can not include the config directory in your tar.gz file. 

I found this command to help me ONLY compress and bundle the config files without their parent directory. 

cd bd-config/ && tar -zcvf ../bd-confi.tgz . && cd -

Using this, I was able to follow the four steps listed above to import a "feature recipe." 

Hopefully, we can improve this process in the future.  https://github.com/backdrop/backdrop-issues/issues/3763

If anyone has a better way of doing this, before we get "recipes" in core, let me know.

EDIT (Nov 2, 2019): I just uploaded this video to Youtube on this topic - https://youtu.be/VgFibVrEZEw

Comments

[NOTE: 11/19/2019] Check status of this issue before using this method: https://github.com/backdrop/backdrop-issues/issues/4217

One solution to this problem is to:

  1. Export all the config for the entire site
  2. Add your new config files to the entire directory of config files
  3. Recompress the files into a tar.gz file and import them all

I tested this and it first it did not work for me. The problem appeared to be that in creating the tar.gz file, I was compressing the config directory itself. You can not include the config directory in your tar.gz file. 

I found this command to help me ONLY compress and bundle the config files without their parent directory. 

cd bd-config/ && tar -zcvf ../bd-confi.tgz . && cd -

Using this, I was able to follow the four steps listed above to import a "feature recipe." 

Hopefully, we can improve this process in the future.  https://github.com/backdrop/backdrop-issues/issues/3763

If anyone has a better way of doing this, before we get "recipes" in core, let me know.

EDIT (Nov 2, 2019): I just uploaded this video to Youtube on this topic - https://youtu.be/VgFibVrEZEw

I was just following my own advice and did the following:

  1. I exported all my current config
  2. I unzipped the file and added a batch of config files
  3. I zipped up the files as per my instructions above and imported them into the site

When I view the synchronize page it shows me 27 files added (as expected), but also shows that my webform.settings file has been deleted. In fact, I have not deleted my webform.settings and have doubled checked my loaded package of config and can see that it is there.

Is this a bug I should report or am I simply missing something?

EDIT: After further testing, I opened this issue with a bunch more details. 

NOTE: Don't import config files the way described here until this problem is sorted out

 

Wouldn't it work to put the new files into the staging directory, and then go to the Configuration management form? Or is the problem that that directory has other changes you don't want to import? It seems like you could get the right result by manipulating that.

@brad.bulger - Thanks for the suggestion.

I'm pretty sure that your suggestion would work if the user has access to the staging directory. In my tests, I was able to add a config recipe to the site in the following way:

  1. copy the entire contents of the active directory into the staging directory
  2. add additional config files (config recipe) to the staging directory
  3. use the configuration synchronize option in the UI to pull sync staging with active - admin/config/development/configuration/sync

I wasn't clear in the original post, but the intent of this topic was to provide a way (work around) for a site builder without direct access to the staging directory a way to upload a config recipe as per the discussion here: https://github.com/backdrop/backdrop-issues/issues/3763