Drupal configuration management and CI/CD

Drupal sites change in two places at once, code and configuration, so moving them safely needs a repeatable export, review and deploy path. This page covers the decisions, build sequence, effort drivers and checks for that path.

On this page

How Drupal configuration management keeps changes moving safely between environments

When changes to a Drupal site are made directly on development, staging and production and then copied by hand, nobody can say with confidence what is running where. The fix is a repeatable path in which custom code, Composer dependencies and exported configuration move together through version control, get reviewed in a pipeline, and reach production in the same order every time. Teams that adopt this path stop treating each release as a one-off manual task and start treating it as a tested, reversible change.

This is harder than it looks because a Drupal site is not one thing. Configuration, such as content types, fields, views, roles and module settings, lives in exported YAML files managed by the core Configuration Management system. Content lives in the database and is not part of that export, so a configuration change and a content change follow different paths and need different handling. Exports can also carry environment-specific values, such as hostnames, mail settings, API keys or development-only modules, which must be excluded or overridden per environment instead of being committed as-is.

Deploy order matters as well. After code and configuration are in place, the database updates must run, configuration must be imported, and caches must be rebuilt, and the sequence changes what visitors see during the window. Running these steps out of order, or on one server of several, can leave a site half-updated. Before committing to a design, confirm with your team which environment owns each setting, where content is authored, and which deploy steps must run before the site serves traffic again.

Which Drupal parts make up the configuration and deployment path

A Drupal change moves from a developer's environment to production as a set of linked artifacts: exported configuration, pinned code dependencies, environment settings, deployment commands, tests and a pipeline. Each part has one job, and each breaks in a predictable way when someone edits it by hand on a server.

Configuration sync directory

The directory holds the site's configuration as YAML files, which Drupal's core Configuration Management system exports from one environment and imports into another. Content types, views, permissions and module settings all live here. Check that changes are made through the UI in one environment and exported, not edited directly in production. Hand edits in production make the next import overwrite them or drift from what the code expects, and the site can differ from what the team reviewed.

System requirements

Composer manifest and lock file

The composer.json file declares Drupal core, contributed modules and themes, and the composer.lock file pins the exact versions that were tested. Together they define what code runs in each environment. Confirm that the lock file is committed and that every environment installs from it. Without a lock file, two servers can run different module versions, and a dependency update can reach production without a review step.

Environment settings files

The settings.php file and environment variables hold values that differ between local, staging and production, such as database credentials, hash salts, file paths, trusted host patterns and cache backends. Keep these out of the shared codebase and load them per environment. If credentials or environment-specific values are committed to the repository or typed into the server by hand, staging can reach production data, and secrets are exposed to everyone with repository access.

Drush deployment commands

Drush runs the steps that follow code arrival: applying database updates, importing configuration, clearing caches and running update hooks in a fixed order. Write the deployment as a single scripted sequence and confirm the order with the team's Drupal lead. Running these steps manually on each server invites skipped updates, a missed configuration import or a cache left stale, which often shows up as errors that only appear after a release.

Automated test suites

Automated tests cover custom modules, critical user journeys such as login, content editing and checkout, and configuration checks that fail when an export does not match the expected state. Ask which suites run on every change and which run only before release, and how long each takes. Without tests, the review stage depends on someone clicking through the site, and regressions from contributed module updates reach users unnoticed.

Pipeline runner and stages

The pipeline runner executes the build, test and deployment steps for review and production environments, and it controls who can approve a release. Confirm that production deploys require an approval step, that secrets are injected by the runner rather than stored in scripts, and that a failed step stops the release. A pipeline that deploys from a developer laptop, or one that skips tests for urgent fixes, removes the review control that makes configuration changes auditable.

Which configuration and deployment options fit your team

This table compares the main configuration and deployment choices for a Drupal site and what each one costs to run day to day. Read each row as a trade-off: the option on the left has an operating cost that falls on a named role, so match it to who will maintain the scripts, hold credentials and review changes.

DecisionOptionOperating cost and fit
Where configuration livesExported configuration in version controlFits teams shipping changes through review. Developers maintain the export workflow and must keep the sync directory committed and clean.
Where configuration livesEditing production directlyFits only very small sites with no staging. Changes are untracked, so drift between environments and audit gaps grow over time.
Core and contributed codeComposer-managed core and modulesFits most teams. Someone must own dependency updates and review version constraints for each release window.
Core and contributed codeManual uploads of module filesFits no multi-environment site well. Versions drift between servers and nobody can reproduce a build from the repository.
Environment differencesOne shared export with overrides in settingsFits sites where few values differ. Developers must keep environment-specific settings out of exported config and document each override.
Environment differencesSplit configuration per environmentFits sites with many environment-specific values. Maintenance grows with each split, so review every new split for ongoing cost.
Running deploy stepsDrush commands in a documented sequenceFits teams already using Drush. The sequence is standard, but the team must keep the runbook current across Drupal versions.
Running deploy stepsCustom deployment scriptsFits teams with unusual hosting. The client's engineers must maintain the scripts through every core and PHP upgrade.
Where pipelines runHosted pipeline serviceFits teams without strict network rules. Deploy credentials sit with the provider, so confirm access controls and secret storage.
Where pipelines runSelf-hosted runner inside the client networkFits regulated teams that keep production reachable only internally. The client's platform team patches and monitors the runner.

How to build the export, review and deploy sequence

This sequence turns Drupal configuration into a versioned, reviewable artifact that moves through development, staging and production the same way each time. Each step closes with a check, so drift, untested changes and failed deployments are caught before they reach production users.

  1. Set up a clean codebase in version control

    Create a Git repository that holds the Composer project file, the lock file, custom modules, custom themes, the deployment scripts and the configuration directory. Contributed code is installed through Composer rather than copied into the repository, so every environment resolves the same versions. Exclude uploaded files, local settings and database dumps from version control. Done when a fresh clone can run the Composer install step without errors and the repository contains no generated or environment-specific files.

  2. Capture the baseline configuration export

    Take the configuration from a known-good environment, usually the one that matches production most closely, and export it with Drush or the Configuration Manager interface into the versioned configuration directory. The engineer who owns the site should review the first export for secrets, environment-specific URLs and content that should not be configuration. Done when a second, freshly built environment imports this baseline and a follow-up export shows no differences.

  3. Separate environment-specific settings

    Move database credentials, hash salts, mail server settings, API keys, trusted host patterns and environment flags out of the shared configuration and into environment files or secrets managed by the platform. Use settings files that load per environment and keep local overrides out of Git. Confirm the handling of configuration split or environment-specific modules with your team before choosing an approach. Done when the exported configuration contains no credentials and the same commit deploys to two environments with only their own settings differing.

  4. Define the developer workflow for changes

    Write down how a change is made: the developer edits in a local or development environment, runs the configuration export, reviews the diff, commits the configuration with the related code, and opens a merge request. The team agrees on one rule, that configuration is changed only through the codebase and not directly in production. Done when a test change, such as a field label update, travels from local edit to committed export and produces a diff that reviewers can read line by line.

  5. Add pipeline checks for drift and tests on review

    Configure the pipeline to run on every merge request. It installs dependencies from the lock file, imports the committed configuration into a clean database, runs a configuration status check to detect drift, and runs the automated tests the team has chosen. A failed drift check means someone changed configuration outside the codebase or forgot to export. Done when a deliberately unexported change fails the pipeline and a clean commit passes it.

  6. Deploy to staging with the production steps

    Run the same deployment script on staging that production will use: put the site in maintenance mode, pull the tagged code, run Composer install, run database updates, import configuration, rebuild caches and take the site out of maintenance mode. Keep the order identical so staging exercises the real path. Done when staging completes the script without manual edits and a second run of the configuration import reports no changes.

  7. Deploy to production with a rollback plan

    Before production, take a database backup and record the currently deployed code tag so the previous state can be restored. Run the same script used on staging, including maintenance mode and cache rebuild, and check the status page, key user journeys and logs after release. If a check fails, redeploy the recorded previous tag and restore the backup if database changes cannot be reversed. Confirm with your platform and database team how long backups and restores take in your environment. Done when a production release passes the post-deploy checks and a rollback has been rehearsed on staging.

How a change moves from review to production

A change starts in a developer's local environment, where configuration is exported with Configuration Management and the code is committed to version control. The pipeline then builds a review environment with Composer install and configuration import, runs automated tests and a drift check, and only then promotes the same artifact to staging. The same Drush deploy steps run in each environment, and a named approval gate sits before production. If a deploy fails, the path returns to the last known good release, so teams should confirm how rollback works for their own database and file storage.

Configuration and code moving from local work through review, staging and production.

How the pipeline changes by hosting model

A single web node is the simplest model for the deploy step. The pipeline can put the codebase in place, run database updates and import configuration in one sequence against one site, then clear caches, all on the same host. There is no need to coordinate between servers, so the main risk is downtime during the window when code and database disagree. Teams usually handle this with a maintenance page or by running the steps quickly in order.

  • Single ordered sequence: Run drush deploy or an equivalent script once, with code, drush updatedb and drush cim in a fixed order.
  • Maintenance window: Decide whether visitors see a maintenance page during the update and who approves the window.
  • Runner placement: The pipeline runner can often connect to the host over SSH, but the production credentials should be scoped to this one deploy path.
  • Composer source: Packages are normally pulled from public repositories, so confirm which registries the build may reach.
  • Rollback copy: Keep the previous release and a database backup so the sequence can be reversed.

Check with the platform owner whether the single node is a permanent design or a stepping stone, because that decides how much deploy tooling is worth building now.

What drives the effort and cost of a configuration pipeline

This table compares the factors that raise the effort of a Drupal configuration pipeline, how each one shows up in day-to-day work, and what teams can do to keep it contained. Read each row as a question to answer in discovery before committing to a pipeline design, since most of the cost comes from how many environments, teams and integrations the pipeline has to serve.

DriverHow it raises effortHow to keep it down
Number of environmentsEach environment that differs from production needs its own export, import and verification steps, and drift between them is hard to trace.Limit environments to those with a clear purpose, and script one deployment sequence that every environment runs.
Custom modules and contributed dependenciesCustom code and contributed projects change configuration schemas, so updates can break imports and each upgrade needs its own test pass.Keep custom modules small, pin Composer versions, and review contributed updates on the monthly release cycle rather than ad hoc.
Environment-specific configurationSettings such as URLs, API keys, mail routing and debug flags that live in exported configuration must be excluded, overridden or split out for every environment.Move secrets and host-specific values into environment variables or settings files, and keep only shared structure in the synced configuration.
Integrations whose settings must deploySingle sign-on, payment, search or CRM settings often sit partly in configuration and partly in external systems, so each change needs coordinated steps in two places.Document which integration values are code, which are secrets and which are managed by the external system, and test each integration path after every deploy.
Test coverage gapsWithout automated tests for content types, views, permissions and critical user paths, reviewers must check every change by hand, and regressions reach production.Start with smoke tests on login, key forms and critical pages, then add functional tests for areas that change most often.
Compliance evidence requirementsChange records, peer review, separated approvals and retained logs for each deployment add pipeline steps, access controls and storage that must be built and maintained.Ask your assessor or internal audit team which evidence they expect, then have the pipeline produce it automatically, such as linked tickets, signed merge approvals and deploy logs.
Number of teams committing to the same siteMultiple teams editing the same configuration create merge conflicts in exported YAML, and deployments queue behind one another.Assign configuration ownership by area, use short-lived branches, and set a clear rule for who may run production deploys.

How to verify the pipeline works and fails safely

The first check proves the export and import path works at all: build a fresh environment from the repository, run the configuration import, then export again and confirm that the second export produces no changes. Any diff on the second export means the repository does not fully describe the site, usually because a setting is overridden in settings.php, a module was enabled outside the configuration files, or an environment-specific value was saved into the active configuration. Pair this with a drift check that runs in the pipeline against production: export the live configuration, compare it with the committed files, and fail the build if they differ. Confirm with your Drupal team which settings are allowed to differ by environment, because that allowlist decides whether the drift check is useful or constantly noisy.

Automated tests should run on every review, not only before release. At minimum, this means the build step (Composer install from the lock file), the configuration import, the drift check and the test suite that your team has agreed on, whether that is PHPUnit, Behat or browser tests of critical editorial and visitor paths. A staging rehearsal of the production deploy is the check that matters most for trust: run the same deploy commands, in the same order, against a copy of production data, and record what failed. Include the database update step and any cache rebuild. The rehearsal should also confirm that configuration import does not silently disable modules or change roles that editors depend on.

Rollback needs its own test, because a restore that has never been run is an assumption. Restore the previous code release and a database backup taken before the deploy into a scratch environment, then confirm the site boots and the content and configuration match the earlier state. A failed deploy should stop before the cutover step, leave the previous release live, and post a failure notice to the on-call channel and the named release owner, with the failing command and the log location. Ask your implementation partner to show who receives these alerts, how they are acknowledged, and who is authorized to trigger the rollback, and confirm that the alert path is tested as part of each rehearsal.

How to protect credentials, configuration and production access

Configuration sync and automated deployment move powerful changes between environments, so the same pipeline that ships a content type or permission can also expose a password or reach production data. The six controls below separate what the pipeline holds, what it can reach, what gets committed and who must approve a release.

Deploy credentials in the secret store

Database passwords, deploy keys and API tokens belong in the CI/CD platform's secret store or a dedicated vault, injected at job runtime as environment variables. Nothing sensitive should appear in settings.php, .gitlab-ci.yml, a workflow file or a Composer config committed to the repository. Check the repository history as well as the current tree, because a credential removed in a later commit still exists in every clone. Ask your team how secrets are rotated and who can read them.

Deploy role limited to its target

Give the deploy job a database and file account that can reach only the environment it deploys to. Staging jobs should never hold production credentials, and production access should be granted to the deploy role rather than to individual developers' everyday accounts. Confirm that the deploy role can run configuration import and database updates but cannot grant itself new permissions in the database.

Exported configuration scrubbed of secrets

Configuration export writes the site's settings to YAML files that are committed to version control. Review each export for hashed passwords, API keys, environment-specific hostnames and mail server details before the merge. Keep these values in environment settings or overrides, and add a pre-commit or CI check that fails when a sensitive key appears in the config/sync directory.

Admin and local accounts excluded from sync

User accounts, their password hashes and role assignments for administrators are site content, not deployable configuration. Exclude them from the export so that a developer's test administrator does not reach production. Confirm that break-glass and local admin accounts are created and managed outside the pipeline, and that the deployed role mapping matches the identity provider's groups.

Separated approval for production deploys

Production deploys should require a reviewer who did not write the change, recorded in the pipeline as a manual approval or protected environment. Pair this with a code review of the exported configuration diff, because a config change can alter permissions or disable a security module without touching any code. Ask who can approve and whether the approver's rights are separate from the deploy role.

Audit trail for configuration changes

Record who changed configuration, what changed and when, using the Git history of the sync directory, the pipeline run log and Drupal's own logging of administrative actions. Keep these records in a system the deploy role cannot edit. Confirm with your compliance team how long each log must be retained and where it is stored, because the default retention in your hosting or CI platform may be shorter than your policy.

What to monitor, back up, upgrade and document after go-live

Once the pipeline is live, the recurring work is operational. Someone must own failed pipeline runs and configuration drift reports, and treat each one as a finding to resolve rather than noise to dismiss. A failed config import on staging should block promotion, and drift reported on production means someone changed the live site outside the export workflow. Confirm who receives pipeline alerts, how quickly they must acknowledge them, and whether drift checks run on a schedule or only on deploy, because those answers determine how long a bad change can sit unnoticed.

Before every production deploy, take a fresh backup of the database and the file store, and confirm it restores. The rollback steps depend on that backup, so the deploy runbook should name the backup command or snapshot, where it is stored, and who can restore it. Dependency updates belong on a regular review cycle. Run composer update or a targeted composer require in a branch, export any resulting configuration changes, and let the automated test suite decide whether the change can be promoted. Core releases follow the published windows on the Drupal core release schedule: bugfix releases on the first Wednesday of each month and security releases on the third Wednesday. Exercise the full pipeline on each of these updates, so a security patch is never the first time the deploy path runs.

Documentation is what lets someone other than the original builder run the system. Keep four records current: the export workflow (which environment is the source of truth for configuration, and how drush config:export output is committed), the deploy runbook (the ordered steps, including drush deploy and cache rebuilds), the rollback steps (restore order for database and files, and how the previous release is redeployed), and an owner for every secret, such as database credentials, deploy keys and API tokens used by the pipeline. Record a rotation schedule for each secret and confirm that the owners can still access their systems. Review these documents after each core or contributed module update, because a change in the deploy path that is not written down will fail at the worst possible moment.

Questions teams ask before building a Drupal CI/CD pipeline

What does a Drupal CI/CD pipeline cost to build, and what drives the price up?

The cost depends mostly on how many environments the pipeline must cover, how much of the site's configuration is already exported and under version control, and how many automated tests the team wants before a change reaches production. A build usually includes a Git repository layout, Composer-based builds, a configuration export and import workflow, Drush deployment steps, test jobs and approval gates in the CI tool. Each of these is a separate piece of work, and each needs its own owner after handover. Costs rise when the site has many contributed modules to pin and test, when environments need different settings, or when approvals must match an audit trail. Ask any provider for a written quote that lists each component, who builds it, and what the client must maintain afterward. Pipeline changes are mostly one-time work, while test maintenance and tool licenses recur.

How long does it take to set up a Drupal deployment pipeline?

Duration is set by the number of environments, the state of the existing codebase, and how many people must approve a release. A site whose configuration is already in version control, with one staging and one production environment, is a much smaller job than a multi-site platform with separate review environments and custom test suites. Teams also lose time when the Drupal version or contributed modules are out of date, because Composer dependencies must resolve before any pipeline step can run reliably. Approval rules, change windows and access requests from security teams often take longer than the technical build. Ask for a schedule that separates the repository and pipeline work from the test authoring and the handover, and confirm which steps depend on client approvals.

Can our internal team build a Drupal CI/CD pipeline without a partner?

Yes, a team with Drupal, Git and CI tool experience can build a pipeline alone, and many do. The skills needed are Composer dependency management, understanding how configuration export and import work, scripting Drush deployment commands, writing automated tests for Drupal functionality, and configuring the CI runner and secrets. The usual gap is not the first build but the ongoing ownership: updating pinned modules, keeping test data realistic, fixing pipelines after a Drupal minor release, and managing the approval process. Teams should decide whether they have one or two people who can own this for years. If not, a partner can build the pipeline and hand over documentation, runbooks and tests so the internal team can operate it.

What do we need to provide before a Drupal pipeline project can start?

The provider needs working access to the source repository, with permission to create branches, merge requests and pipeline configuration. It also needs access to each environment, including read access to the current configuration and deployment rights to staging, along with credentials stored in an approved secrets manager rather than in code. Test data is required, usually a sanitized copy of production content or a fixture set that covers the content types, roles and workflows the tests must check. Finally, the client should name one owner who approves changes to production, decides on release windows and signs off on test coverage. Without that owner, approvals stall and the pipeline ends up bypassed. Confirm each of these items in the written scope before work begins.

Can a Drupal CI/CD pipeline run inside a restricted or air-gapped network?

Yes, the pipeline can run inside a restricted network if the CI runners, package sources and container images are hosted inside that network. Composer packages, Drupal core, contributed modules and Node or PHP tooling must be available from an internal mirror or a proxied artifact repository, because the build cannot reach public package hosts directly. Teams should confirm which CI platform they can run on-premises, how runners are isolated, and how updates to Drupal core and contributed modules reach the internal mirror. Security reviewers will also want to know where secrets are stored, how deployment credentials are scoped, and how deployment logs are retained. Each of these decisions depends on the network design, so confirm them with the network and security teams before selecting tools.

Does configuration export replace a content migration?

No, configuration export and content migration move different things. Configuration management exports site structure such as content types, fields, views, roles, blocks and module settings into version-controlled YAML files that can be imported into another environment. It does not move the content entries, user accounts, files or revisions that editors create on the live site. If a project is moving from an older Drupal site, a separate migration is still needed for content, and the migration itself must be designed and tested. For a Drupal 7 source, the Drupal.org documentation describes migrating into a new site with the core Migrate modules or Drush, and notes that themes must be rebuilt. Plan these as two workstreams, and check which data each one moves before deciding the cutover sequence.

How DeployOpen works on this

DeployOpen plans, builds, tests, documents and supports Drupal configuration management and CI/CD inside your own infrastructure, whether that is your cloud account, a data center or an air-gapped network. Each engagement is fixed-scope, with the deliverables and timelines agreed in writing before work starts.

How we scope

  • Review your current environments, deployment steps and where configuration changes are made today.
  • Agree which environments, branches, pipeline stages and approval gates the written scope covers.
  • Confirm hosting, access model and which team owns production deployments and rollback decisions.

How we build

  • Set up configuration export and import with Drupal's Configuration Management system and version control rules.
  • Structure Composer, Drush deployment commands and environment settings so each release follows the same sequence.
  • Build automated tests and pipeline stages for review and production, with the approval steps you specify.

How we hand over

  • Deliver pipeline definitions, configuration policies and runbooks written for your own engineers to operate.
  • Walk your team through the review and production release steps, rollback procedure and failure handling.
  • Document access controls, secrets handling and the list of environments the pipeline is allowed to touch.

How we support

  • Offer ongoing support, upgrades and pipeline maintenance as a retainer after handover.
  • Keep the pipeline aligned with Drupal core and contributed module updates as your release cycle requires.
  • Confirm retainer scope, response expectations and service terms in writing before support starts.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.