Alexandros Kosiaris has submitted this change and it was merged.

Change subject: Change Prop: Purge RESTBase re-renders
......................................................................


Change Prop: Purge RESTBase re-renders

Currently, when emitting events to the EventBus, RESTBase also issues
HTCP requests to purge the Varnish caches, which is basically a hack.
Since Change Propagation follows the resource_change topic, use it to
purge Varnish content for all RESTBase-emitted URIs.

Note that at the same time of deploying this change, we will also be
disabling purging in RESTBase so as to minimise the period in which both
services emit the purge requests for the same content, so the additional
load incurred by Varnish will be short-lived.

Change-Id: If9bd7e2907986be944bd351b27a000cbb12f2448
---
M hieradata/labs/deployment-prep/common.yaml
M modules/changeprop/manifests/init.pp
M modules/changeprop/templates/config.yaml.erb
3 files changed, 29 insertions(+), 0 deletions(-)

Approvals:
  Ppchelko: Looks good to me, but someone else must approve
  Alexandros Kosiaris: Verified; Looks good to me, approved
  GWicke: Looks good to me, but someone else must approve



diff --git a/hieradata/labs/deployment-prep/common.yaml 
b/hieradata/labs/deployment-prep/common.yaml
index aa05601..baa6a54 100644
--- a/hieradata/labs/deployment-prep/common.yaml
+++ b/hieradata/labs/deployment-prep/common.yaml
@@ -16,6 +16,7 @@
 citoid::zotero_port: 1969
 changeprop::mwapi_uri: 
http://deployment-mediawiki02.deployment-prep.eqiad.wmflabs/w/api.php
 changeprop::restbase_uri: 
http://deployment-restbase02.deployment-prep.eqiad.wmflabs:7231
+changeprop::purge_host: deployment-cache-text04.deployment-prep.eqiad.wmflabs
 changeprop::concurrency: 20
 graphoid::allowed_domains:
   http:
diff --git a/modules/changeprop/manifests/init.pp 
b/modules/changeprop/manifests/init.pp
index cfea89b..367993e 100644
--- a/modules/changeprop/manifests/init.pp
+++ b/modules/changeprop/manifests/init.pp
@@ -18,6 +18,12 @@
 #   The host/IP where to reach RESTBase. Default:
 #   http://restbase.svc.${::rb_site}.wmnet:7231
 #
+# [*purge_host*]
+#   The vhtcpd daemon host to send purge requests to. Default: 239.128.0.112
+#
+# [*purge_port*]
+#   The port the vhtcp daemon listens to. Default: 4827
+#
 # [*concurrency*]
 #   The maximum number of tasks the service can execute at any given point in
 #   time. Default: 100
@@ -26,6 +32,8 @@
     $zk_uri,
     $mwapi_uri    = "http://api.svc.${::mw_primary}.wmnet/w/api.php";,
     $restbase_uri = "http://restbase.svc.${::rb_site}.wmnet:7231";,
+    $purge_host   = '239.128.0.112',
+    $purge_port   = 4827,
     $concurrency  = 100,
 ) {
 
diff --git a/modules/changeprop/templates/config.yaml.erb 
b/modules/changeprop/templates/config.yaml.erb
index d057f53..436a0f6 100644
--- a/modules/changeprop/templates/config.yaml.erb
+++ b/modules/changeprop/templates/config.yaml.erb
@@ -8,6 +8,12 @@
           - pattern: /^https?:\/\//
   title: The Change Propagation root
   paths:
+    /{api:sys}/purge:
+      x-modules:
+        - path: src/sys/purge.js
+          options:
+            host: <%= @purge_host %>
+            port: <%= @purge_port %>
     /{api:sys}/links:
       x-modules:
         - path: src/sys/backlinks.js
@@ -78,3 +84,17 @@
                     redirect: false
                   headers:
                     cache-control: no-cache
+
+              purge_varnish:
+                topic: resource_change
+                match:
+                  meta:
+                    uri: '/^https?:\/\/[^\/]+\/api\/rest_v1\/(?<title>.+)$/'
+                  tags:
+                    - restbase
+                exec:
+                  method: post
+                  uri: '/sys/purge/'
+                  body:
+                    - meta:
+                        uri: 
'//{{message.meta.domain}}/api/rest_v1/{{match.meta.uri.title}}'

-- 
To view, visit https://gerrit.wikimedia.org/r/290748
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If9bd7e2907986be944bd351b27a000cbb12f2448
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mobrovac <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: BBlack <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Mobrovac <[email protected]>
Gerrit-Reviewer: Ppchelko <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to