EBernhardson has uploaded a new change for review.

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

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

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, 52 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/97/276397/1

diff --git a/hieradata/labs/deployment-prep/common.yaml 
b/hieradata/labs/deployment-prep/common.yaml
index f9b945c..566bb7f 100644
--- a/hieradata/labs/deployment-prep/common.yaml
+++ b/hieradata/labs/deployment-prep/common.yaml
@@ -191,6 +191,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..223d47b 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/${::mediawiki::web::sites::portal_dir}":
+        ensure => 'link',
+        target => '../../portal-master'
+    }
+
     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..817f5b9 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..c58f983 100644
--- a/modules/mediawiki/templates/apache/sites/wwwportals.conf.erb
+++ b/modules/mediawiki/templates/apache/sites/wwwportals.conf.erb
@@ -21,7 +21,10 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wikipedia.org/index.html [L]
+    RewriteRule ^/$ /<%= @portal_dir %>/wikipedia.org/index.html [L]
+    <% if @rewrite_portal @>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <% end %>
     RewriteRule ^/portal/.*$ - [L]
     <Location ~ "^/$|^/portal/">
         Header set Cache-Control "s-maxage=3600, must-revalidate, max-age=0"
@@ -87,10 +90,16 @@
     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>
+    <% if @rewrite_portal %>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <% end %>
 
     # search-redirect.php, let it through
     RewriteRule ^/search-redirect.php /w/search-redirect.php [L]
@@ -115,7 +124,10 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wikinews.org/index.html [L]
+    RewriteRule ^/$ /<%= @portal_dir %>/wikinews.org/index.html [L]
+    <% if @rewrite_portal @>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <% end %>
     <Location ~ "^/$|^/portal/">
         Header set Cache-Control "s-maxage=3600, must-revalidate, max-age=0"
     </Location>
@@ -143,7 +155,10 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wikiquote.org/index.html [L]
+    RewriteRule ^/$ /<%= @portal_dir %>/wikiquote.org/index.html [L]
+    <% if @rewrite_portal @>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <% end %>
     <Location ~ "^/$|^/portal/">
         Header set Cache-Control "s-maxage=3600, must-revalidate, max-age=0"
     </Location>
@@ -171,7 +186,10 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wikiversity.org/index.html [L]
+    RewriteRule ^/$ /<%= @portal_dir %>/wikiversity.org/index.html [L]
+    <% if @rewrite_portal @>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <% end %>
     <Location ~ "^/$|^/portal/">
         Header set Cache-Control "s-maxage=3600, must-revalidate, max-age=0"
     </Location>
@@ -199,7 +217,10 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wikibooks.org/index.html [L]
+    RewriteRule ^/$ /<%= @portal_dir %>/wikibooks.org/index.html [L]
+    <% if @rewrite_portal @>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <% end %>
     <Location ~ "^/$|^/portal/">
         Header set Cache-Control "s-maxage=3600, must-revalidate, max-age=0"
     </Location>
@@ -227,7 +248,10 @@
     RewriteRule . - [E=RW_PROTO:http]
 
     # Front page...
-    RewriteRule ^/$ /portal/wikivoyage.org/index.html [L]
+    RewriteRule ^/$ /<%= @portal_dir %>/wikivoyage.org/index.html [L]
+    <% if @rewrite_portal @>
+        RewriteRule ^/portal/(.*)$ /<%= @portal_dir %>/$1 [L]
+    <% end %>
     <Location ~ "^/$|^/portal/">
         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: newchange
Gerrit-Change-Id: I292e8698cf2cbce44ce95663d52c2df388270db6
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: EBernhardson <[email protected]>

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

Reply via email to