Dzahn has uploaded a new change for review.

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


Change subject: stats.wikimedia.org - replace webserver::apache::site / inline 
Apache config with apache_site and template in ./sites/apache
......................................................................

stats.wikimedia.org - replace webserver::apache::site / inline
Apache config with apache_site and template in ./sites/apache

To: - make it more uniform to the setup of most other misc apache
sites, especially metrics.wm on the same host, instead of being a one-off
    - make it easier to read Apache config in one place
    - and then enable HTTPS for RT #4749 without running into conflicts
      between the different site setups on one host
    - don't have to edit puppet class to change inline Apache config

RT #4749

Change-Id: I241e1964e127633084644de601bdb30fffd30a63
---
M manifests/misc/statistics.pp
A templates/apache/sites/stats.wikimedia.org
2 files changed, 78 insertions(+), 49 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/71/85971/1

diff --git a/manifests/misc/statistics.pp b/manifests/misc/statistics.pp
index fa0678e..aa6d2b9 100644
--- a/manifests/misc/statistics.pp
+++ b/manifests/misc/statistics.pp
@@ -1,3 +1,6 @@
+# stats.wikimedia.org
+# this file is for stat[0-9]/(ex-bayes) statistics servers (per ezachte - RT 
2162)
+
 class misc::statistics::iptables-purges {
        require "iptables::tables"
 
@@ -36,8 +39,6 @@
 
        # Labs has security groups, and as such, doesn't need firewall rules
 }
-
-# this file is for stat[0-9]/(ex-bayes) statistics servers (per ezachte - RT 
2162)
 
 class misc::statistics::user {
        $username = "stats"
@@ -159,7 +160,7 @@
 }
 
 # wikistats configuration for generating
-# stat.wikimedia.org data.
+# stats.wikimedia.org data.
 #
 # TODO: puppetize clone of wikistats?
 class misc::statistics::wikistats {
@@ -216,7 +217,7 @@
                mode    => 0750,
                require => Class['webserver::apache'],
        }
-       
+
        webserver::apache::module { ['rewrite', 'proxy', 'proxy_http']:
                require => Class['webserver::apache']
        }
@@ -260,54 +261,19 @@
                source  => "puppet:///private/apache/htpasswd.stats",
        }
 
-       webserver::apache::site { $site_name:
-               require => [Class["webserver::apache"], 
Webserver::Apache::Module["rewrite"], File["/etc/apache2/htpasswd.stats"]],
-               docroot => $docroot,
-               ssl => true,
-               certfile => '/etc/ssl/certs/stats.wikimedia.org.chained.pem',
-               certkey =>  '/etc/ssl/private/stats.wikimedia.org.key',
-               aliases   => ["stats.wikipedia.org"],
-               custom => [
-                       "Alias /extended $docroot/reportcard/extended",
-                       "Alias /staff $docroot/reportcard/staff \n",
-                       "RewriteEngine On",
+  install_certificate{ $site_name: }
 
-       # redirect stats.wikipedia.org to stats.wikimedia.org
-       "RewriteCond %{HTTP_HOST} stats.wikipedia.org
-       RewriteRule ^(.*)$ http://$site_name\$1 [R=301,L]\n",
-
-       # Set up htpasswd authorization for some sensitive stuff
-       "<Directory \"$docroot/reportcard/staff\">
-               AllowOverride None
-               Order allow,deny
-               Allow from all
-               AuthName \"Password protected area\"
-               AuthType Basic
-               AuthUserFile /etc/apache2/htpasswd.stats
-               Require user wmf
-       </Directory>",
-       "<Directory \"$docroot/reportcard/extended\">
-               AllowOverride None
-               Order allow,deny
-               Allow from all
-               AuthName \"Password protected area\"
-               AuthType Basic
-               AuthUserFile /etc/apache2/htpasswd.stats
-               Require user internal
-       </Directory>",
-       "<Directory \"$docroot/reportcard/pediapress\">
-               AllowOverride None
-               Order allow,deny
-               Allow from all
-               AuthName \"Password protected area\"
-               AuthType Basic
-               AuthUserFile /etc/apache2/htpasswd.stats
-               Require user pediapress
-       </Directory>",
-       ],
+  file {
+       "/etc/apache2/sites-available/stats.wikimedia.org":
+               ensure => present,
+               mode => '0444',
+               owner => root,
+               group => root,
+               content => template('apache/sites/stats.wikimedia.org.erb');
        }
 
-  install_certificate{ $site_name: }
+  apache_site { statswikimedia: name => 'stats.wikimedia.org' }
+
 }
 
 # community-analytics.wikimedia.org
diff --git a/templates/apache/sites/stats.wikimedia.org 
b/templates/apache/sites/stats.wikimedia.org
new file mode 100644
index 0000000..8a9b99e
--- /dev/null
+++ b/templates/apache/sites/stats.wikimedia.org
@@ -0,0 +1,63 @@
+# This file is managed by Puppet!
+
+<VirtualHost *:80>
+       ServerName stats.wikimedia.org
+       ServerAlias stats.wikipedia.org
+       ServerAdmin [email protected]
+
+       DocumentRoot /srv/stats.wikimedia.org/htdocs
+       <Directory /srv/stats.wikimedia.org/htdocs>
+               Options Indexes FollowSymLinks MultiViews
+               AllowOverride None
+               Order allow,deny
+               allow from all
+       </Directory>
+
+       ErrorLog /var/log/apache2/error.log
+       # Possible values include: debug, info, notice, warn, error, crit,
+       # alert, emerg.
+       LogLevel warn
+
+       CustomLog /var/log/apache2/access.log combined
+       ServerSignature On
+
+       Alias /extended /srv/stats.wikimedia.org/htdocs/reportcard/extended
+       Alias /staff /srv/stats.wikimedia.org/htdocs/reportcard/staff
+
+       RewriteEngine On
+       RewriteCond %{HTTP_HOST} stats.wikipedia.org
+       RewriteRule ^(.*)$ http://stats.wikimedia.org$1 [R=301,L]
+
+       <Directory "/srv/stats.wikimedia.org/htdocs/reportcard/staff">
+               AllowOverride None
+               Order allow,deny
+               Allow from all
+               AuthName "Password protected area"
+               AuthType Basic
+               AuthUserFile /etc/apache2/htpasswd.stats
+               Require user wmf
+       </Directory>
+       <Directory "/srv/stats.wikimedia.org/htdocs/reportcard/extended">
+               AllowOverride None
+               Order allow,deny
+               Allow from all
+               AuthName "Password protected area"
+               AuthType Basic
+               AuthUserFile /etc/apache2/htpasswd.stats
+               Require user internal
+       </Directory>
+       <Directory "/srv/stats.wikimedia.org/htdocs/reportcard/pediapress">
+               AllowOverride None
+               Order allow,deny
+               Allow from all
+               AuthName "Password protected area"
+               AuthType Basic
+               AuthUserFile /etc/apache2/htpasswd.stats
+               Require user pediapress
+       </Directory>
+       
+</VirtualHost>
+
+
+
+# vim: filetype=apache

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

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

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

Reply via email to