Deploying a Drupal update

Body

This documentation needs work. See "Help improve this page" in the sidebar.

 

This is how to deploy a Drupal update to a server. Deployment is the process of taking changes from the local development environment to a live web site, either an update of Drupal, or a new feature.

First update Drupal core via Composer on a local copy and test that everything works, then repeat the changes on the server, to update the live web site. These are the steps to deploy these changes from the local environment and to your server.

  1. Locally: Update Drupal core via Composer in your local development environment.
  2. When everything works well, either repeat all the steps on your server, or simply move the new composer.lock file to your server. For more see Basic Composer usage and Composer: It’s All About the Lock File.
  3. On the server: Update Drupal's code and contrib modules as defined in the updated composer.lock file by running this command. Add --dry-run to first do a test run:
    composer install
  4. Run Drupal updates.

Your web site should now be updated, according to the version requirements in the composer.lock file.

Deployment of a new feature with configuration management and Git

These are the basic steps, for creating a new feature locally, and moving it to your server.

Local environment

  1. Update Drupal configuration in your local development environment
  2. Export the updated configuration with Drush
  3. Commit the updated configuration and composer.lock file with Git

Deploy to server

  1. Build the codebase from composer.lock by running composer install
  2. Run Drupal updates
  3. Import configuration with Drush. Note this is the opposite of development steps.

The last two steps can be replaced by the drush deploy command that wraps them up into a consistent command and adds useful features.

Knowledge Category