Deploying a Drupal update
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.
- Locally: Update Drupal core via Composer in your local development environment.
- 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.
- On the server: Update Drupal's code and contrib modules as defined in the updated composer.lock file by running this command. Add
--dry-runto first do a test run:
composer install - 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
- Update Drupal configuration in your local development environment
- Export the updated configuration with Drush
- Commit the updated configuration and composer.lock file with Git
Deploy to server
- Build the codebase from composer.lock by running
composer install - Run Drupal updates
- 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.
Deleting a module
Deleting a module is not straight forward in a Git-based deployment process. Before doing anything else, you have to uninstall it on the server, with Drush or in the administrative GUI at /admin/modules/uninstall.
You must do this. Since in the deployment process, deleting or downloading modules with Composer is the first step, Drupal will be confused if an installed module is gone from the file system, but configuration is being requested for removal.
Uninstalling the module makes Drupal forget about the module, and cleans up the database.
Otherwise, if you use Git, and you deleted the module on the server already with a manual composer remove, you may get a Your local changes to the following files would be overwritten by merge: composer.json composer.lock ... Please commit your changes or stash them before you merge error, because the repository is now out of sync.
From Uninstall modules that were installed with composer, see also Managing your site's configuration.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion
Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.