When working on a Drupal site it is good practice to use one or more separate environments to develop and test your site without impacting the live site's availability to the world. Changes made to the code or configuration of your development site are then deployed via an automated (or manual) process in order to make them available on the live site. This allows you to, for example, create a new content type or change the configuration of your front page view in isolation so that you can preview the changes. You can then deploy those changes without having to resort to manually replicating the changes on the live site.
Drupal developers use a variety of different tools and Drupal APIs to facilitate the synchronization of code and configuration between environments. The complete process is known as a deployment workflow. At a very high level this includes the following steps:
- Make a change to configuration, or code, on a development environment
- Export any configuration changes to a file(s) that can be stored in version control
- Commit code and configuration changes to version control
- Synchronize version-controlled files to the live server
- Run database updates (update.php) and import any configuration changes
- Clear the cache
To improve the process further, figure out how to automate as much of that as possible using tools like Drush, Git, and continuous integration software. The goal is to create a repeatable, reliable process that reduces the time it takes, decreases downtime for your site, and minimize human error.
Drupal currently supports the deployment of code and configuration, but not user generated content. For more on the difference between the two, see Configuration Data Types. There is ongoing work to facilitate content deployment in future versions of Drupal 8 as part of the workflow initiative.
- Build a new View on your development environment and then deploy it to the production site
- Test and configure a new module locally and then update the production site when ready
- Make changes to your theme or module locally and deploy those changes to the live site
Deployment, and specifically what tools to use and how to use them, continues to evolve. The recommendation of using a development > staging > live workflow whenever possible isn't likely to change. The specifics of these workflows can vary, depending on your hosting provider and other factors. It's best to get a general understanding of the desired workflow and then work with your team to define the specifics for your application and available tools.
Git is the version control system of choice for Drupal developers. Learn how to use Git, and work with a team, to manage your application's source code and exported configuration.
Tools that aid deployment: