Problem/Motivation

During a deploy in the production environment with the maintenance mode enabled, the Varnish server displays maintenance page instead of the cached page.
When you do a drush cache:rebuild, purge request are send to the Varnish server.

Steps to reproduce

During a deploy in the production environment, we do the following steps :
Enable maintenance mode
drush cache:rebuild
drush updatedb
drush config:import
drush cache:rebuild
disable maintenance mode

Proposed resolution

My opinion : Varnish should continue to serve cached pages (if in Varnish cache) during maintenance mode enabled.
To do that : adding an option to prevent purge request to be sended to Varnish server when maintenance mode is enabled.

if you want to purge all Varnish at the end of deployment script : disable maintenance mode, do the cache:rebuild after
or
if you want to check manually the result of your deploy : keep the maintenance mode enabled, check your backoffice, disable the maintenance mode, purge the whole site through the interface.

Remaining tasks

Unit tests

User interface changes

New option 'Prevent Varnish purge with Maintenance Mode' displayed in adv_varnish general options.

API changes

In CacheManage::sendRequest(), if the maintenance_mode and the puger_maintenance_mode are enabled, cancel the request.

Data model changes

New boolean value 'purge_maintenance_mode in cache_settings.general

CommentFileSizeAuthor
#4 3182362-04.patch2.32 KBbenroy
#3 3182362-01.patch2.32 KBbenroy
#2 3182362-01.patch2.32 KBbenroy
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

benroy created an issue. See original summary.

benroy’s picture

FileSize
2.32 KB

This is the patch

benroy’s picture

FileSize
2.32 KB
benroy’s picture

FileSize
2.32 KB

Fix error in sendRquest

David Castella’s picture

Issue summary: View changes
benroy’s picture

Issue summary: View changes

wengerk made their first commit to this issue’s fork.

benroy’s picture

Assigned: benroy » Unassigned
Status: Active » Needs review

Changing status to "need_review", the patch to review is 4

  • shumer committed 3fb15df on 8.x-3.x authored by benroy
    Issue #3182362 by benroy: Prevent purge Varnish when Drupal maintenance...
shumer’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.