Get started
Requirements
- Drupal core 11.3 or later. The main, export and media modules declare
Drupal 12 as well, tested on 12.0.0-beta1;
content_deployment_tools
declares Drupal 11 until Tool API declares 12.
- PHP 8.3 or later.
content_deployment_export: core's Workspaces and HTTP Basic
Authentication.
content_deployment_tools: Tool API.
Recommended modules
- Content Moderation, in core: drafts with a workflow state, and the Latest
version tab.
- Paragraphs and
Entity Reference Revisions:
paragraph trees.
- File Hash, with SHA-256: one media
item per set of bytes, and changesets that carry files.
- Config Read-only:
configuration locked on live, where changesets write content only.
- Pathauto and
Redirect: generated aliases are
reported and left to Pathauto; a changed alias leaves a redirect.
Modules
| Module |
Enable on |
Contains |
content_deployment |
every environment |
The content spec engine, review flow, robot account, changeset runner, Drush commands, and every permission the submodules check. |
content_deployment_export |
development environments only |
Exporting staging workspaces as changesets, from Drush and the workspace's Export changeset operation; the media upload and lookup endpoints. Needs Workspaces. |
content_deployment_media |
any |
content-spec:suggest-media and content-spec:illustrate. |
content_deployment_tools |
any |
Tool API plugins for the operations. Experimental while Tool API is in beta. Needs Tool API. |
Installation
composer require drupal/content_deployment
drush pm:install content_deployment
content_deployment_export is enabled per environment and kept out of the
exported configuration:
$settings['config_exclude_modules'] = ['content_deployment_export'];
Settings
| Setting |
Meaning |
$settings['content_deployment_directory'] |
Where changesets and their files live, in its changesets and files directories: an absolute path, or one relative to the Drupal root, outside the docroot. See Changesets. |
$settings['content_deployment_run_on_deploy'] |
TRUE runs pending changesets during drush deploy, after deploy:hook. Off by default: drush deploy then prints how many are pending, and the status report warns while any are. |
$settings['content_deployment_max_file_size'] |
Export only. The largest file an export carries, in bytes. Default 10485760, 10 MiB. |
Site setup
- Put the bundles that are written to under a workflow. The module works
without content moderation, using core non-default revisions, but under a
workflow editors get the Latest version tab and a recognizable draft
state.
- Let editors see and publish drafts. Under the core editorial workflow
that is
view latest version, view any unpublished content, view all
revisions, use editorial transition publish and use editorial
transition create_new_draft.
- Know the robot account. The first write creates
content_deployment, a
blocked account with no password and no roles. Drush commands and
changesets write as it, so it owns what they write. Tool API plugins write
as the account invoking them.
- Grant uploads only where content is built. The upload endpoint needs an
account with Upload content deployment media.
- Enable File Hash with SHA-256 where changesets carry files. Media
ingest finds bytes the site already has through it, and the runner refuses
a changeset with files without it. Run
drush filehash:generate once for
the files already there.
Permissions
| Permission |
Allows |
upload content deployment media |
Uploading and looking up media through the content_deployment_export endpoints, with basic auth. Restricted. |
export content deployment changesets |
Exporting a staging workspace as a changeset, from the workspace's Export changeset operation. Restricted: an export is the approval to publish what it carries. |
Publishing a draft from the review notice takes the workflow's transition to
its published state, or, without moderation, update access and edit access to
the published flag.
Commands
| Command |
Does |
content-spec:model |
The site's content model |
content-spec:query |
Find entities from a description |
content-spec:read |
An entity as a spec |
content-spec:create |
Create an entity from a spec, as a draft |
content-spec:apply |
Apply a spec to an entity, as a draft |
content-spec:media-ingest |
Files into media |
content-spec:pending |
Drafts awaiting review; --conflicts for those changesets left |
content-spec:publish |
Make a draft live; --langcode for one language's |
content-spec:unpublish |
Take the live version offline |
content-spec:suggest-media |
Rank the image library against a text |
content-spec:illustrate |
Fill empty image slots |
content-spec:kitchen-sink |
A page with every field filled in, for reviewing the theme |
content-deployment:status |
The changesets, and which have run here |
content-deployment:run |
Run the pending changesets |
content-deployment:export |
Export a staging workspace as the next changeset (content_deployment_export) |