9

I have customized CiviCRM (translation, custom fields, module, view, report, menus, etc.) and I want to reproduce the configuration. What is the best way to go?

8

That's a good question that should have a canonical answer but doesn't.

Here's a recent similar question and answer: method for versioning configuration of civicrm?

I suspect there are other good references out there, please add them here.

Part of the challenge, which is not unique to CiviCRM, is that the definition of "configuration" can be grey in some areas.

Here is a list of tools and techniques that can capture and copy some parts of commonly considered "configuration":

1: The civicrm_domain and civicrm_setting tables.

You can back up these two tables and then restore them to a different site. This is a hack and could get you in trouble, but worth trying. Between the two of them, you've got most of the core "settings" type values.

2: Build your own extension to save your custom fields.

The instructions for building your own extension using civix show you how to generate an extension that saves the configuration of your custom fields.

3: civicrm_report_instance table

This can be backed up and restored on it's own, it's fairly safe.

4: civicrm_extension table

This is the list of installed extensions with configuration. You'll need to also have the matching extension directory.

5.1: Extension: org.civicoop.configitems

This extension allows you to export some site configuration to JSON, which you can package as a related custom extension for your site. (See also Jaap's answer on this question.)

5.2: Extension: CiviConfigure (eu.tttp.setting)

There's an extension which appears to be designed to solve this problem for settings (may not handle eg Contribution Pages which are entities?), but it's out of date, here:

5.3: CiviCRM Config Export (nz.co.fuzion.configexport)

Imports/exports config & entities to YML.

6 bin/csv/export.php

A script you can use to export option values and tags and such. Assembly requied.

7: API

You can use the api to retrieve and set various entities, e.g. using the cv tool.

8: CiviCase specific

For CiviCase, one of the original arguments for using external files was for versioning and managing dev/production. You can still use xml files for its config.

...

I've left this as an open community wiki and encourage others to add to this list.

  • For years, we have used a custom drush command to initialize our new Powerbase sites. That process was started before the API really came into being and the Managed Entities were a thing. Now we are moving towards putting things in discrete extensions. – Jamie May 1 '19 at 14:28
  • Maybe good to add this section to the developers/sysadmin guide at some point. – Jaap Jansma - CiviCooP May 3 '19 at 21:12
  • I really like the different extension which people have developed. With open source comes a bit of chaos – Jaap Jansma - CiviCooP May 3 '19 at 21:13
3

Usually I copy the site that is the best way to ensure all things are correct. But I can imagine that is sometimes cumbersome.

I have therefor used an extension org.civicoop.configitems (https://github.com/CiviCooP/org.civicoop.configitems)

An example configuration is stored in https://github.com/CiviCooP/nl.roparun.generic that configuration could be loaded with the config items extension.

This does not stores everything but at least it is a start.

| improve this answer | |
1

@bass Can you just make a copy of the civicrm database to initialize your new instance? Unless your issue is to 'merge' this configuration into another existing instance, in which case all comment so far do apply.

@japp Congrats on a well rounded extension. What are the pros/cons of this extension vs the managed entities mechanism (https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_managed/)?

| improve this answer | |
  • Yes I can. This is my first idea. I wrote scripts to replicate the database in a new instance, but I thought there should be a better method such as creating an extension as underlined by @Alan. – bass May 1 '19 at 23:55

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.