Giuseppe Lavagetto has submitted this change and it was merged.

Change subject: prevent apache2 service log churn on non-web mediawiki servers
......................................................................


prevent apache2 service log churn on non-web mediawiki servers

This fixes a bug I introduced in the patch series that culminated in
Ie0807c706, the result of which is the apache2 service getting picked up by the
non-web application servers.

* Rename mediawiki::service to mediawiki::web
* Move contents of mediawiki::config::apache to mediawiki::web
* ...with the exception of File['/etc/cluster'], which belongs in init.pp.
* Include mediawiki::web in role::mediawiki::webserver.

There is substantial clean-up work remaining: the whole mediawiki::config::*
hierarchy ought to be dissolved, with mediawiki::config::php moved up to
mediawiki::php, but this is a first step.

To validate this patch after it is merged:

* Run Puppet on mw1114 (api), mw1021 (app), mw1149 (bits) and confirm that the
  patch is a no-op on these host classes.

* Run Puppet on mw1157 (image scaler), mw1002 (job runner), and tmh1001 (video
  scaler) and confirm that the apache service is stopped and not restarted.

Change-Id: I0b2580a757fc1c54987a290d1d3aaf006f7f794e
---
M manifests/role/mediawiki.pp
D modules/mediawiki/manifests/config/apache.pp
M modules/mediawiki/manifests/init.pp
D modules/mediawiki/manifests/service.pp
A modules/mediawiki/manifests/web.pp
5 files changed, 87 insertions(+), 91 deletions(-)

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



diff --git a/manifests/role/mediawiki.pp b/manifests/role/mediawiki.pp
index aeb9be3..fae4df9 100644
--- a/manifests/role/mediawiki.pp
+++ b/manifests/role/mediawiki.pp
@@ -95,7 +95,9 @@
             role::mediawiki,
             role::mediawiki::configuration::php
 
-        class { "::mediawiki::config::apache": maxclients => $maxclients }
+        class { '::mediawiki::web':
+            maxclients => $maxclients,
+        }
 
         class { '::mediawiki::syslog':
             apache_log_aggregator => 
$role::mediawiki::mediawiki_log_aggregator,
diff --git a/modules/mediawiki/manifests/config/apache.pp 
b/modules/mediawiki/manifests/config/apache.pp
deleted file mode 100644
index d6f99d7..0000000
--- a/modules/mediawiki/manifests/config/apache.pp
+++ /dev/null
@@ -1,53 +0,0 @@
-# Configuration files for apache running on application servers
-# note: it uses $cluster for the apache2.conf
-#
-# requires mediawiki::packages to be in place
-class mediawiki::config::apache(
-    $maxclients='40'
-) {
-    require mediawiki::packages
-
-    Class['mediawiki::config::apache'] -> Class['mediawiki::config::base']
-
-    file { '/etc/apache2/apache2.conf':
-        owner   => root,
-        group   => root,
-        mode    => '0444',
-        content => template('mediawiki/apache/apache2.conf.erb'),
-    }
-    file { '/etc/apache2/envvars':
-        owner  => root,
-        group  => root,
-        mode   => '0444',
-        source => 'puppet:///modules/mediawiki/apache/envvars.appserver',
-    }
-    file { '/etc/cluster':
-        owner   => root,
-        group   => root,
-        mode    => '0444',
-        content => $::site,
-    }
-
-    if $::realm == 'production' {
-        file { '/usr/local/apache':
-            ensure => directory,
-        }
-        exec { 'sync apache wmf config':
-            require => File['/usr/local/apache'],
-            path    => '/bin:/sbin:/usr/bin:/usr/sbin',
-            command => 'rsync -av 10.0.5.8::httpdconf/ /usr/local/apache/conf',
-            creates => '/usr/local/apache/conf',
-            notify  => Service[apache]
-        }
-    } else {  # labs
-        # bug 38996 - Apache service does not run on start, need a fake
-        # sync to start it up though don't bother restarting it is already
-        # running.
-        exec { 'Fake sync apache wmf config on beta':
-            command => '/bin/true',
-            unless  => '/bin/ps -C apache2 > /dev/null',
-            notify  => Service[apache],
-        }
-    }
-
-}
diff --git a/modules/mediawiki/manifests/init.pp 
b/modules/mediawiki/manifests/init.pp
index 9aff034..16f3f55 100644
--- a/modules/mediawiki/manifests/init.pp
+++ b/modules/mediawiki/manifests/init.pp
@@ -4,7 +4,13 @@
     include ::mediawiki::cgroup
     include ::mediawiki::packages
     include ::mediawiki::config::base
-    include ::mediawiki::service
+
+    file { '/etc/cluster':
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+        content => $::site,
+    }
 
     class { '::twemproxy':
         default_file => 'puppet:///modules/mediawiki/twemproxy.default',
diff --git a/modules/mediawiki/manifests/service.pp 
b/modules/mediawiki/manifests/service.pp
deleted file mode 100644
index bacc76f..0000000
--- a/modules/mediawiki/manifests/service.pp
+++ /dev/null
@@ -1,36 +0,0 @@
-# mediawiki::service
-
-class mediawiki::service {
-    require mediawiki::config::base
-    require mediawiki::packages
-
-    include mediawiki::sync
-
-    # Start apache but not at boot
-    service { 'apache':
-        ensure    => running,
-        name      => 'apache2',
-        enable    => false,
-        subscribe => Exec['mw-sync'],
-        require   => Exec['mw-sync'],
-    }
-
-    # Sync the server when we see apache is not running
-    exec { 'apache-trigger-mw-sync':
-        command => '/bin/true',
-        notify  => Exec['mw-sync'],
-        unless  => '/bin/ps -C apache2 > /dev/null'
-    }
-
-    # Has to be less than apache, and apache has to be nice 0 or less to be
-    # blue in ganglia.
-    if $::lsbdistid == 'Ubuntu' and versioncmp($::lsbdistrelease, '12.04') >= 
0 {
-        file { '/etc/init/ssh.override':
-            ensure  => present,
-            owner   => root,
-            group   => root,
-            mode    => '0444',
-            content => 'nice -10',
-        }
-    }
-}
diff --git a/modules/mediawiki/manifests/web.pp 
b/modules/mediawiki/manifests/web.pp
new file mode 100644
index 0000000..ab6158d
--- /dev/null
+++ b/modules/mediawiki/manifests/web.pp
@@ -0,0 +1,77 @@
+# mediawiki::web
+
+class mediawiki::web ( $maxclients = '40' ) {
+    require mediawiki::config::base
+    require mediawiki::packages
+
+    include mediawiki::sync
+
+    file { '/etc/apache2/apache2.conf':
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+        content => template('mediawiki/apache/apache2.conf.erb'),
+        before  => Service['apache'],
+    }
+
+    file { '/etc/apache2/envvars':
+        owner  => root,
+        group  => root,
+        mode   => '0444',
+        source => 'puppet:///modules/mediawiki/apache/envvars.appserver',
+        before  => Service['apache'],
+    }
+
+    if $::realm == 'production' {
+        file { '/usr/local/apache':
+            ensure => directory,
+        }
+        exec { 'sync apache wmf config':
+            require => File['/usr/local/apache'],
+            path    => '/bin:/sbin:/usr/bin:/usr/sbin',
+            command => 'rsync -av 10.0.5.8::httpdconf/ /usr/local/apache/conf',
+            creates => '/usr/local/apache/conf',
+            notify  => Service['apache']
+        }
+    } else {  # labs
+        # bug 38996 - Apache service does not run on start, need a fake
+        # sync to start it up though don't bother restarting it is already
+        # running.
+        exec { 'Fake sync apache wmf config on beta':
+            command => '/bin/true',
+            unless  => '/bin/ps -C apache2 > /dev/null',
+            notify  => Service['apache'],
+        }
+    }
+
+    # Start apache but not at boot
+    service { 'apache':
+        ensure    => running,
+        name      => 'apache2',
+        enable    => false,
+        subscribe => Exec['mw-sync'],
+        require   => [
+            Exec['mw-sync'],
+            File['/etc/cluster'],
+        ],
+    }
+
+    # Sync the server when we see apache is not running
+    exec { 'apache-trigger-mw-sync':
+        command => '/bin/true',
+        notify  => Exec['mw-sync'],
+        unless  => '/bin/ps -C apache2 > /dev/null'
+    }
+
+    # Has to be less than apache, and apache has to be nice 0 or less to be
+    # blue in ganglia.
+    if $::lsbdistid == 'Ubuntu' and versioncmp($::lsbdistrelease, '12.04') >= 
0 {
+        file { '/etc/init/ssh.override':
+            ensure  => present,
+            owner   => 'root',
+            group   => 'root',
+            mode    => '0444',
+            content => 'nice -10',
+        }
+    }
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0b2580a757fc1c54987a290d1d3aaf006f7f794e
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to