Answers.Body: <p>That's a good question that should have a canonical answer but doesn't.</p>
  <p>Here's a recent similar question and answer: <a href="https://civicrm.stackexchange.com/questions/29002/method-for-versioning-configuration-of-civicrm">method for versioning configuration of civicrm?</a></p>
  <p>I suspect there are other good references out there, please add them here.</p>
  <p>Part of the challenge, which is not unique to CiviCRM, is that the definition of &quot;configuration&quot; can be grey in some areas.</p>
  <p>Here is a list of tools and techniques that can capture and copy some parts of commonly considered &quot;configuration&quot;:</p>
  <h2>1: The civicrm_domain and civicrm_setting tables.</h2>
  <p>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 &quot;settings&quot; type values.</p>
  <h2>2: Package ManagedEntities in an extension</h2>
  <p>Custom fields, search displays, FormBuilder forms, and many different option values (financial types, membership types, activity types, navigation menus, etc) can be <a href="https://docs.civicrm.org/dev/en/latest/extensions/managed/" rel="nofollow noreferrer">exported to an extension</a> using the <code>civix export</code> command. The extension code can then be checked into vcs.</p>
  <h2>3: civicrm_report_instance table</h2>
  <p>This can be backed up and restored on it's own, it's fairly safe.</p>
  <h2>4: civicrm_extension table</h2>
  <p>This is the list of installed extensions with configuration. You'll need to also have the matching extension directory.</p>
  <h2>5.1: Extension: org.civicoop.configitems</h2>
  <ul>
  <li><a href="https://lab.civicrm.org/extensions/configitems" rel="nofollow noreferrer">https://lab.civicrm.org/extensions/configitems</a></li>
  </ul>
  <p>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 <a href="https://civicrm.stackexchange.com/a/30475/149">Jaap's answer</a> on this question.)</p>
  <h2>5.2: Extension: CiviConfigure (eu.tttp.setting)</h2>
  <p>There's an extension which appears to be designed to solve this problem for settings (may not handle eg Contribution Pages which are <em>entities</em>?), but it's out of date, here:</p>
  <ul>
  <li><a href="https://civicrm.org/extensions/civiconfigure" rel="nofollow noreferrer">https://civicrm.org/extensions/civiconfigure</a></li>
  <li><a href="https://github.com/eileenmcnaughton/eu.tttp.setting" rel="nofollow noreferrer">https://github.com/eileenmcnaughton/eu.tttp.setting</a></li>
  </ul>
  <h2>5.3: CiviCRM Config Export (nz.co.fuzion.configexport)</h2>
  <p>Imports/exports config &amp; entities to YML.</p>
  <ul>
  <li><a href="https://github.com/fuzionnz/civicrm-configexport" rel="nofollow noreferrer">https://github.com/fuzionnz/civicrm-configexport</a></li>
  </ul>
  <h2>6 <code>bin/csv/export.php</code></h2>
  <p>A script you can use to export option values and tags and such. Assembly requied.</p>
  <h2>7: API</h2>
  <p>You can use the api to retrieve and set various entities, e.g. using the cv tool.</p>
  <h2>8: CiviCase specific</h2>
  <p>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.</p>
  <p>...</p>
  <p>I've left this as an open community wiki and encourage others to add to this list.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-01T14:28:29.717Z
Answers.Text: 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.
Answers.UserDisplayName: Jamie
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-03T21:12:28.203Z
Answers.Text: Maybe good to add this section to the developers/sysadmin guide at some point.
Answers.UserDisplayName: Jaap Jansma - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-03T21:13:15.500Z
Answers.Text: I really like the different extension which people have developed. With open source comes a bit of chaos
Answers.UserDisplayName: Jaap Jansma - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-01T14:14:10.370Z
Answers.LastActivityDate: 2024-09-25T15:29:44.097Z
Answers.LastEditDate: 2024-09-25T15:29:44.097Z
Answers.UserDisplayName: Alan Dixon
Answers.Body: <p>Usually I copy the site that is the best way to ensure all things are correct. But I can imagine that is sometimes cumbersome.</p>
  
  <p>I have therefor used an extension org.civicoop.configitems (<a href="https://github.com/CiviCooP/org.civicoop.configitems" rel="nofollow noreferrer">https://github.com/CiviCooP/org.civicoop.configitems</a>)  </p>
  
  <p>An example configuration is stored in <a href="https://github.com/CiviCooP/nl.roparun.generic" rel="nofollow noreferrer">https://github.com/CiviCooP/nl.roparun.generic</a> that configuration could be loaded with the config items extension.</p>
  
  <p>This does not stores everything but at least it is a start. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-01T14:38:23.277Z
Answers.LastActivityDate: 2019-05-01T14:38:23.277Z
Answers.UserDisplayName: Jaap Jansma - CiviCooP
Answers.Body: <p>@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.</p>
  
  <p>@japp Congrats on a well rounded extension. What are the pros/cons of this extension vs the managed entities mechanism (<a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_managed/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_managed/</a>)?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-01T23:55:12.870Z
Answers.Text: 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.
Answers.UserDisplayName: bass
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-01T18:07:09.573Z
Answers.LastActivityDate: 2019-05-01T18:07:09.573Z
Answers.UserDisplayName: cividesk
Body: <p>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?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-02T01:16:24.637Z
Comments.Text: See also: https://civicrm.stackexchange.com/questions/6652/how-can-civicrm-manage-and-deploy-configuration
Comments.UserDisplayName: Chris Burgess
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-02T01:16:39.020Z
Comments.Text: See also: https://civicrm.stackexchange.com/questions/29002/method-for-versioning-configuration-of-civicrm
Comments.UserDisplayName: Chris Burgess
Tags: <configuration><deployment>
Title: Reproduce CiviCRM configuration: best practice
ThreadText: # Reproduce CiviCRM configuration: best practice
  
  (Asked by: username_0 on 2019-04-29)
  
  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?
  
  **Tags:** configuration, deployment
  
  > **Comments:**
  > **username_1**: See also: https://civicrm.stackexchange.com/questions/6652/how-can-civicrm-manage-and-deploy-configuration  
  > **username_1**: See also: https://civicrm.stackexchange.com/questions/29002/method-for-versioning-configuration-of-civicrm  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2019-05-01. Score: 14
  
  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?](https://civicrm.stackexchange.com/questions/29002/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: Package ManagedEntities in an extension
  
  Custom fields, search displays, FormBuilder forms, and many different option values (financial types, membership types, activity types, navigation menus, etc) can be [exported to an extension](https://docs.civicrm.org/dev/en/latest/extensions/managed/) using the `civix export` command. The extension code can then be checked into vcs.
  
  ## 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.username_4.configitems
  
  * <https://lab.civicrm.org/extensions/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 [username_4's answer](https://civicrm.stackexchange.com/a/30475/149) 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:
  
  * <https://civicrm.org/extensions/civiconfigure>
  * <https://github.com/eileenmcnaughton/eu.tttp.setting>
  
  ## 5.3: CiviCRM Config Export (nz.co.fuzion.configexport)
  
  Imports/exports config & entities to YML.
  
  * <https://github.com/fuzionnz/civicrm-configexport>
  
  ## 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.
  
  > **Comments:**
  > **username_3**: 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.  
  > **username_4**: Maybe good to add this section to the developers/sysadmin guide at some point.  
  > **username_4**: I really like the different extension which people have developed. With open source comes a bit of chaos  
  
  ---
  
  ### Answer by username_4 on 2019-05-01. Score: 4
  
  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.username_4.configitems (<https://github.com/username_4/org.username_4.configitems>)
  
  An example configuration is stored in <https://github.com/username_4/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.
  
  
  ---
  
  ### Answer by username_5 on 2019-05-01. Score: 1
  
  @username_0 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/>)?
  
  > **Comments:**
  > **username_0**: 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 @username_2.  
  
  ---
  
  