Reader small image

You're reading from  Drupal 10 Masterclass

Product typeBook
Published inDec 2023
PublisherPackt
ISBN-139781837633104
Edition1st Edition
Tools
Concepts
Right arrow
Author (1)
Adam Bergstein
Adam Bergstein
author image
Adam Bergstein

Adam Bergstein is a product engineering leader and an architect. He has been a long-time Drupal community member, a routine speaker at Drupal community events around the globe, and provided keynotes for several events. He has maintained and contributed to many Drupal projects, including Password Policy, Taxonomy Menu, and more. Adam is the lead of Simplytest, a free service, and a project that offers Drupal community members testing sandboxes. He has also worked for both agencies building Drupal applications and Drupal service providers building Drupal-related products. He has led the Drupal Community Governance Task Force and is serving a term as a community board member of the Drupal Association.
Read more about Adam Bergstein

Right arrow

Maintaining Drupal

Every Drupal application requires maintenance. Those who adopt Drupal must understand common maintenance activities, including how to check for updates. Earlier chapters discussed code deployment workflows, environments, Composer, and more. This chapter brings these concepts together for a more comprehensive view of maintaining Drupal. This may propose practices that help automate the maintenance of Drupal new to some. Next, the book will discuss how to apply updates after the code is deployed. Finally, we share best practices when performing updates.

In this chapter, we’re going to cover the following main topics:

  • Types of maintenance
  • Code maintenance process
  • Best practices

Types of maintenance

Maintaining a Drupal site can take many forms. Drupal itself is always evolving. Changes can be very frequent because they span releases in all projects of a Drupal application, including core and contributed projects. Releases can even happen based on project dependencies, so changes to Drupal application code can be very frequent. Drupal also runs on a platform stack with physical infrastructure built on software that also evolves. It is also common for content to require maintenance, such as when new staff is hired at a company and the staff listing is no longer up to date. Content management activities are covered in Chapter 14. This chapter covers how to effectively maintain a Drupal application.

Code-related maintenance

Drupal projects often put out new releases, and those managing Drupal applications need a strategy for this. Releases can come in the form of major and minor releases. The semantics around major and minor are intentional. Major implies...

Code maintenance process

One of the technical and more frequent types of maintenance is around code updates. The community is already making efforts to lessen the technical burden of code updates through the Automatic Updates initiative worked on throughout Drupal 10 and, hopefully, in preparation for Drupal 11.

Reviewing code management and deployment concepts

Earlier chapters covered useful concepts when considering maintenance. A brief review of these concepts is important when considering code maintenance.

Chapter 6 covered the creation of a Drupal application through the Composer project template and common Composer commands. Every Drupal 10 application should have a corresponding and accurate composer.json and composer.lock file. Those files help understand what code is currently built in an application and which constraints the update logic should follow for installed projects.

Chapter 3 covered the concept of environments and code deployment workflows. Production...

Best practices

Maintaining Drupal has several best practices that can help promote efficacy and ease maintenance.

Backups

Before performing any maintenance, ensure environments are effectively backed up. While the aforementioned Drush commands are capable of exporting databases or downloading files, backups are often offered by platform hosting providers. Some providers have policies to perform automated backups periodically. Doing so can help ensure quick and effective restoration should there be an issue.

Restoring Drupal can be performed with a series of commands. Releases of a specific Drupal application often correspond to tags in Git. As an example, suppose there was an issue with the deployment of the application’s 1.1.20 release. The following example restores Git tag 1.1.19 and loads the database from a backup.sql file:

$ cd my_directory
$ git fetch –all
$ git reset –hard 1.1.19
$ cd web
$ ../vendor/bin/drush sql:cli < backup.sql
$ ../vendor...

Summary

Successful Drupal practitioners know how to effectively maintain Drupal applications. Performing maintenance with best practices and doing so routinely helps ensure Drupal applications continue to run well, are secure, and get the benefit of ongoing features and fixes furnished by the community. Applications must run on a well-maintained platform as well, which includes updates to PHP, MySQL, and operating systems. Maintenance of Drupal requires an effective code deployment strategy and an understanding of all parts of Drupal’s architecture (code, content, files, and configuration). Leveraging tools such as Composer and Drush provides code-base management and helps to perform automation. Finally, best practices exist by reviewing product life cycles, having backup strategies, harnessing managed services for hosting, Git, CDN, and update checkers, and adhering to environment-level differences. The next chapter explores Drupal features around content structures and language...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Drupal 10 Masterclass
Published in: Dec 2023Publisher: PacktISBN-13: 9781837633104
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Adam Bergstein

Adam Bergstein is a product engineering leader and an architect. He has been a long-time Drupal community member, a routine speaker at Drupal community events around the globe, and provided keynotes for several events. He has maintained and contributed to many Drupal projects, including Password Policy, Taxonomy Menu, and more. Adam is the lead of Simplytest, a free service, and a project that offers Drupal community members testing sandboxes. He has also worked for both agencies building Drupal applications and Drupal service providers building Drupal-related products. He has led the Drupal Community Governance Task Force and is serving a term as a community board member of the Drupal Association.
Read more about Adam Bergstein