Default Content Deploy

Component ID

2882420

Component name

Default Content Deploy

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

307

Component created

Component changed

Component body

A default content deploy solution for Drupal 8.

Introduction

This module (DCD) provides content deployment and allows development and building sites without the need to transfer database between the sites. The development team can export and deploy all content via Git and content can be deployed to the staging servers automatically during common deploy processes. Module provides useful drush commands for export/import content. Import function can also be ran from administration interface.

Requirements

Install

Download and enable module.

Configuration

Set DCD content directory in settings.php. We recommend to place directory outside of the document root. If no configuration is found, directory is created automatically at 'public://content_' . $hash_salt;

Example

// relative path
$config['content_directory'] = '../content';
// absolute path
$config['content_directory'] = '/var/dcd/content';

Usage - Drush commands

Read detail information about drush commands in README.md.

  • drush default-content-deploy-export, drush dcde
  • drush default-content-deploy-export-with-references, drush dcder
  • drush default-content-deploy-export-site, drush dcdes
  • drush default-content-deploy-export-aliases, drush dcdea
  • drush default-content-deploy-import-aliases, drush dcdia
  • drush default-content-deploy-import, drush dcdi

How the content is imported

drush dcdi

  1. Imported entity is determined by UUID (it can be either new or already existing).
  2. ID of entity is preserved, so entity can not change its ID.
  3. Non-existing entity (the new one) is created with exported ID.
  4. Existing entity is updated only if imported entity is newer (by timestamp of the last entity change).
  5. Imported entity with the same or older time than the current existing entity is skipped.
  6. If a file entity does not have an existing file, the file will be created. The file will be recreated even if there is a existing file entity but its file has been deleted.
  7. If the new entity ID is already occupied by some existing entity, it is skipped.
  8. This behavior can be changed by parameter --force-update

drush dcdi --force-update

  • Existing entity is overwritten by the imported entity (the old entity is deleted and a new entity with the same ID is created from imported JSON file).
  • There is an exception for the user-type entity that only updates the UUID and the username, because overwriting a user entity would result in creating a blocked user without password and email (the user entity export JSON file doesn't contain such information).

drush dcdi --verbose
Print detailed information about importing entities.

If you can not use Drush for import, go to page /admin/config/development/dcd-import.

Team workflow - how to synchronize configuration and content between sites

Please, read the README.md for detailed information.

Credits

Written by @martin_klima and @hnilickajakub with kind support of @hideaway.