Alexandros Kosiaris has uploaded a new change for review.

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

Change subject: Reuse parsoid varnish for restbase
......................................................................

Reuse parsoid varnish for restbase

The idea is to rely on the Host header to distinguish between
parsoid and restbase, and reassign the req.backend variable rather late on
the vcl_recv in order to do the minimal possible changes in vcl.
Rely on a terminating return statement to avoid clamping the host
header and the rest of the parsoid code in vcl_recv. Avoid cache lookup and
storing.

Bug: T78194
Change-Id: Ifed6cc7ebc292b6678fca28f874c8ca7840a94d9
---
M manifests/role/cache.pp
M templates/varnish/parsoid-common.inc.vcl.erb
M templates/varnish/parsoid-frontend.inc.vcl.erb
3 files changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/61/191061/1

diff --git a/manifests/role/cache.pp b/manifests/role/cache.pp
index 7844d07..bb29c12 100644
--- a/manifests/role/cache.pp
+++ b/manifests/role/cache.pp
@@ -201,6 +201,9 @@
                 'citoid' => {
                     'eqiad' => 'citoid.svc.eqiad.wmnet',
                 },
+                'restbase' => {
+                    'eqiad' => 'restbase.svc.eqiad.wmnet',
+                },
             },
             'labs' => {
                 'api'    => {
@@ -1506,6 +1509,7 @@
                 'backend'          => 
$::role::cache::configuration::backends[$::realm]['parsoid'][$::mw_primary],
                 'cxserver_backend' => 
$::role::cache::configuration::active_nodes[$::realm]['cxserver'][$::site],
                 'citoid_backend'   => 
$::role::cache::configuration::active_nodes[$::realm]['citoid'][$::site],
+                'restbase_backend' => 
$::role::cache::configuration::active_nodes[$::realm]['restbase'][$::site],
             },
             director_options => {
                 'retries' => 2,
@@ -1526,6 +1530,11 @@
                     'probe'                 => false,
                 },
                 {
+                    'backend_match'         => '^restbase',
+                    'port'                  => 7231,
+                    'probe'                 => false, # TODO: Need probe here
+                },
+                {
                     'port'                  => 8000,
                     'connect_timeout'       => '5s',
                     'first_byte_timeout'    => '5m',
@@ -1544,6 +1553,7 @@
                 'backend'          => 
$::role::cache::configuration::active_nodes[$::realm]['parsoid'][$::site],
                 'cxserver_backend' => 
$::role::cache::configuration::active_nodes[$::realm]['cxserver'][$::site],
                 'citoid_backend'   => 
$::role::cache::configuration::active_nodes[$::realm]['citoid'][$::site],
+                'restbase_backend' => 
$::role::cache::configuration::active_nodes[$::realm]['restbase'][$::site],
             },
             director_type    => 'chash',
             director_options => {
@@ -1565,6 +1575,11 @@
                     'probe'                 => false,
                 },
                 {
+                    'backend_match'         => '^restbase',
+                    'port'                  => 7231,
+                    'probe'                 => false, # TODO: Need probe here
+                },
+                {
                 'port'                  => 3128,
                 'weight'                => $backend_weight,
                 'connect_timeout'       => '5s',
diff --git a/templates/varnish/parsoid-common.inc.vcl.erb 
b/templates/varnish/parsoid-common.inc.vcl.erb
index 6fdf257..93e172e 100644
--- a/templates/varnish/parsoid-common.inc.vcl.erb
+++ b/templates/varnish/parsoid-common.inc.vcl.erb
@@ -9,6 +9,10 @@
                set req.backend = citoid_backend;
                return (pass);
        }
+       if (req.http.Host ~ "restbase" ) {
+               set req.backend = restbase_backend;
+               return (pass);
+       }
        // Clamp the host header to 'parsoid'
        set req.http.host = "parsoid";
 
diff --git a/templates/varnish/parsoid-frontend.inc.vcl.erb 
b/templates/varnish/parsoid-frontend.inc.vcl.erb
index b91cafc..8eef1a2 100644
--- a/templates/varnish/parsoid-frontend.inc.vcl.erb
+++ b/templates/varnish/parsoid-frontend.inc.vcl.erb
@@ -25,4 +25,7 @@
        if (req.http.Host ~ "citoid") {
                return (hit_for_pass);
        }
+       if (req.http.Host ~ "restbase") {
+               return (hit_for_pass);
+       }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifed6cc7ebc292b6678fca28f874c8ca7840a94d9
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alexandros Kosiaris <akosia...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to