Gehel has submitted this change and it was merged.

Change subject: Create a portal-master dir in beta to serve master branch of 
portals
......................................................................


Create a portal-master dir in beta to serve master branch of portals

This creates a portal-master dir in beta cluster, similar in principle
to php-master. This is a temporary fix until scap3 is out and the portal
can be deployed independent from mediawiki-config.

Bug: T129427
Change-Id: I292e8698cf2cbce44ce95663d52c2df388270db6
---
M hieradata/labs/deployment-prep/common.yaml
M modules/beta/manifests/autoupdater.pp
M modules/beta/templates/wmf-beta-autoupdate.py.erb
M modules/mediawiki/manifests/web/sites.pp
M modules/mediawiki/templates/apache/sites/wwwportals.conf.erb
5 files changed, 56 insertions(+), 16 deletions(-)

Approvals:
  Gehel: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/hieradata/labs/deployment-prep/common.yaml 
b/hieradata/labs/deployment-prep/common.yaml
index e46d736..8510cbc 100644
--- a/hieradata/labs/deployment-prep/common.yaml
+++ b/hieradata/labs/deployment-prep/common.yaml
@@ -192,6 +192,7 @@
   scratch: false
   dumps: false
 mediawiki::web::sites::domain_suffix: "beta.wmflabs.org"
+mediawiki::web::sites::portal_dir: "portal-master"
 
 #
 # Zookeeper Cluster in Beta
diff --git a/modules/beta/manifests/autoupdater.pp 
b/modules/beta/manifests/autoupdater.pp
index 41d8ad1..6d141ff 100644
--- a/modules/beta/manifests/autoupdater.pp
+++ b/modules/beta/manifests/autoupdater.pp
@@ -46,6 +46,20 @@
         require   => Git::Clone['operations/mediawiki-config'],
     }
 
+    git::clone { 'beta-portal':
+        directory => "${stage_dir}/portal-master",
+        origin    => 'https://gerrit.wikimedia.org/r/p/wikimedia/portals.git',
+        branch    => 'master',
+        owner     => 'jenkins-deploy',
+        group     => 'wikidev',
+        require   => Git::Clone['operations/mediawiki-config'],
+    }
+
+    file { "${stage_dir}/docroot/wwwportal/portal-master":
+        ensure => 'link',
+        target => '../../portal-master/prod'
+    }
+
     file { "${stage_dir}/php-master/LocalSettings.php":
         ensure  => present,
         owner   => 'jenkins-deploy',
diff --git a/modules/beta/templates/wmf-beta-autoupdate.py.erb 
b/modules/beta/templates/wmf-beta-autoupdate.py.erb
index 1cbd6b4..a11da1c 100755
--- a/modules/beta/templates/wmf-beta-autoupdate.py.erb
+++ b/modules/beta/templates/wmf-beta-autoupdate.py.erb
@@ -15,6 +15,7 @@
 import subprocess
 import sys
 
+PATH_PORTAL = '<%= @stage_dir %>/portal-master'
 PATH_MWCORE = '<%= @stage_dir %>/php-master'
 PATH_MWEXT = '<%= @stage_dir %>/php-master/extensions'
 PATH_MWSKIN = '<%= @stage_dir %>/php-master/skins'
@@ -62,6 +63,7 @@
         update_repo(name='mwextupdate', path=PATH_MWEXT),
         pull_repo(name='mwskinpull', path=PATH_MWSKIN),
         update_repo(name='mwskinupdate', path=PATH_MWSKIN),
+        pull_repo(name='portal', path=PATH_PORTAL),
     ]
 
     logger.info("Executions completed %s", exit_codes)
diff --git a/modules/mediawiki/manifests/web/sites.pp 
b/modules/mediawiki/manifests/web/sites.pp
index 650af70..92d7a07 100644
--- a/modules/mediawiki/manifests/web/sites.pp
+++ b/modules/mediawiki/manifests/web/sites.pp
@@ -1,5 +1,6 @@
 class mediawiki::web::sites (
-    $domain_suffix = 'org'
+    $domain_suffix = 'org',
+    $portal_dir = 'portal'
 ) {
     tag 'mediawiki', 'mw-apache-config'
 
@@ -39,6 +40,7 @@
         priority => 0,
     }
 
+    $rewrite_portal = $portal_dir != 'portal'
     apache::site { 'wwwportals':
         content  => template('mediawiki/apache/sites/wwwportals.conf.erb'),
         priority => 1,
diff --git a/modules/mediawiki/templates/apache/sites/wwwportals.conf.erb 
b/modules/mediawiki/templates/apache/sites/wwwportals.conf.erb
index ce56555..cf4118f 100644
--- a/modules/mediawiki/templates/apache/sites/wwwportals.conf.erb
+++ b/modules/mediawiki/templates/apache/sites/wwwportals.conf.erb
@@ -21,9 +21,12 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wikipedia.org/index.html [L]
-    RewriteRule ^/portal/.*$ - [L]
-    <Location ~ "^/$|^/portal/">
+    RewriteRule ^/$ /<%= @portal_dir %>/wikipedia.org/index.html [L]
+    <%- if @rewrite_portal -%>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <%- end -%>
+    RewriteRule ^/<%= @portal_dir %>/.*$ - [L]
+    <Location ~ "^/$|^/<%= @portal_dir %>/">
         Header set Cache-Control "s-maxage=3600, must-revalidate, max-age=0"
     </Location>
 
@@ -87,8 +90,11 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wiktionary.org/index.html [L]
-    <Location ~ "^/$|^/portal/">
+    RewriteRule ^/$ /<%= @portal_dir %>/wiktionary.org/index.html [L]
+    <%- if @rewrite_portal -%>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <%- end -%>
+    <Location ~ "^/$|^/<%= @portal_dir %>/">
         Header set Cache-Control "s-maxage=3600, must-revalidate, max-age=0"
     </Location>
 
@@ -115,8 +121,11 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wikinews.org/index.html [L]
-    <Location ~ "^/$|^/portal/">
+    RewriteRule ^/$ /<%= @portal_dir %>/wikinews.org/index.html [L]
+    <%- if @rewrite_portal -%>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <%- end -%>
+    <Location ~ "^/$|^/<%= @portal_dir %>/">
         Header set Cache-Control "s-maxage=3600, must-revalidate, max-age=0"
     </Location>
 
@@ -143,8 +152,11 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wikiquote.org/index.html [L]
-    <Location ~ "^/$|^/portal/">
+    RewriteRule ^/$ /<%= @portal_dir %>/wikiquote.org/index.html [L]
+    <%- if @rewrite_portal -%>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <%- end -%>
+    <Location ~ "^/$|^/<%= @portal_dir %>/">
         Header set Cache-Control "s-maxage=3600, must-revalidate, max-age=0"
     </Location>
 
@@ -171,8 +183,11 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wikiversity.org/index.html [L]
-    <Location ~ "^/$|^/portal/">
+    RewriteRule ^/$ /<%= @portal_dir %>/wikiversity.org/index.html [L]
+    <%- if @rewrite_portal -%>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <%- end -%>
+    <Location ~ "^/$|^/<%= @portal_dir %>/">
         Header set Cache-Control "s-maxage=3600, must-revalidate, max-age=0"
     </Location>
 
@@ -199,8 +214,11 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wikibooks.org/index.html [L]
-    <Location ~ "^/$|^/portal/">
+    RewriteRule ^/$ /<%= @portal_dir %>/wikibooks.org/index.html [L]
+    <%- if @rewrite_portal -%>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <%- end -%>
+    <Location ~ "^/$|^/<%= @portal_dir %>/">
         Header set Cache-Control "s-maxage=3600, must-revalidate, max-age=0"
     </Location>
 
@@ -227,8 +245,11 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wikivoyage.org/index.html [L]
-    <Location ~ "^/$|^/portal/">
+    RewriteRule ^/$ /<%= @portal_dir %>/wikivoyage.org/index.html [L]
+    <%- if @rewrite_portal -%>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <%- end -%>
+    <Location ~ "^/$|^/<%= @portal_dir %>/">
         Header set Cache-Control "s-maxage=3600, must-revalidate, max-age=0"
     </Location>
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I292e8698cf2cbce44ce95663d52c2df388270db6
Gerrit-PatchSet: 10
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Gehel <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to