Yurik has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/288033

Change subject: Set graphoid result headers
......................................................................

Set graphoid result headers

In production, set caching headers to 1hr. In betacluster - 10min.
On error, 5 min and 30 seconds.

Bug: T134542
Change-Id: I4b473b9821ac4bd8fa4ac8f50e32ae9d849d1553
---
M hieradata/labs/deployment-prep/common.yaml
M hieradata/role/common/scb.yaml
M modules/graphoid/manifests/init.pp
3 files changed, 20 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/33/288033/1

diff --git a/hieradata/labs/deployment-prep/common.yaml 
b/hieradata/labs/deployment-prep/common.yaml
index d35b0db..3a683c3 100644
--- a/hieradata/labs/deployment-prep/common.yaml
+++ b/hieradata/labs/deployment-prep/common.yaml
@@ -38,6 +38,10 @@
   wikidatasparql:
     - query.wikidata.org
     - wdqs-test.wmflabs.org
+graphoid::headers:
+  'Cache-Control': 'public, s-maxage=360, max-age=360'
+graphoid::error_headers:
+  'Cache-Control': 'public, s-maxage=30, max-age=30'
 lvs::configuration::lvs_services:
   apaches:
     description: "Main MediaWiki application server cluster"
diff --git a/hieradata/role/common/scb.yaml b/hieradata/role/common/scb.yaml
index 433a27f..ef6d491 100644
--- a/hieradata/role/common/scb.yaml
+++ b/hieradata/role/common/scb.yaml
@@ -29,6 +29,10 @@
     - upload.wikimedia.org
   wikidatasparql:
     - query.wikidata.org
+graphoid::headers:
+  'Cache-Control': 'public, s-maxage=3600, max-age=3600'
+graphoid::error_headers:
+  'Cache-Control': 'public, s-maxage=300, max-age=300'
 debdeploy::grains:
   debdeploy-scb:
     value: standard
diff --git a/modules/graphoid/manifests/init.pp 
b/modules/graphoid/manifests/init.pp
index 487cf31..158e572 100644
--- a/modules/graphoid/manifests/init.pp
+++ b/modules/graphoid/manifests/init.pp
@@ -16,10 +16,18 @@
 # [*timeout*]
 #   The timeout (in ms) for requests. Default: 5000
 #
+# [*headers*]
+#   A map of headers that will be sent with each reply. Could be used for 
caching, etc. Default: false
+#
+# [*error_headers*]
+#   A map of headers that will be sent with each reply in case of an error. If 
not set, above headers will be used. Default: false
+#
 class graphoid(
     $allowed_domains = {},
-    $domain_map = {},
-    $timeout    = 5000,
+    $domain_map    = {},
+    $timeout       = 5000,
+    $headers       = false,
+    $error_headers = false,
 ) {
 
     require ::graphoid::packages
@@ -32,6 +40,8 @@
             allowedDomains => $allowed_domains,
             domainMap      => $domain_map,
             timeout        => $timeout,
+            headers        => $headers,
+            errorHeaders   => $error_headers,
         },
         has_spec        => true,
         healthcheck_url => '',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b473b9821ac4bd8fa4ac8f50e32ae9d849d1553
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yurik <[email protected]>

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

Reply via email to