Giuseppe Lavagetto has submitted this change and it was merged.

Change subject: mediawiki::web: get rid of envvars.appserver
......................................................................


mediawiki::web: get rid of envvars.appserver

Amazingly, the envvars file we provision on app servers does absolutely
nothing, since it attempts to modify the invocation of apache2 by manipulating
the $HTTPD shell var, which /etc/init.d/apache2 and apache2ctl no longer
care for.

We replace this "no-op" file with a standard file for the distribution,
so that we restore the default behavior. This is a transitional choice
to allow us to restore a sane default, this will be removed in a
subsequent change and modifications to the file will be managed via
apache::def as expected.

Also remove /etc/wikimedia-image-scaler on image scalers. The only use of that
file was a check in the envvars script. If we decide to reintroduce it, it
should be an apache::def resource instead. We will clean up
/etc/wikimedia-image-scaler on the scalers manually.

Change-Id: I3fbf9bdb1ff01a0146ecd850990a35c3eb41f3ad
---
D modules/mediawiki/files/apache/envvars.appserver
A modules/mediawiki/files/apache/envvars.precise
A modules/mediawiki/files/apache/envvars.trusty
M modules/mediawiki/manifests/web.pp
4 files changed, 98 insertions(+), 38 deletions(-)

Approvals:
  Filippo Giunchedi: Looks good to me, but someone else must approve
  Giuseppe Lavagetto: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/mediawiki/files/apache/envvars.appserver 
b/modules/mediawiki/files/apache/envvars.appserver
deleted file mode 100644
index 60eb8ce..0000000
--- a/modules/mediawiki/files/apache/envvars.appserver
+++ /dev/null
@@ -1,31 +0,0 @@
-# Wikimedia configuration file, a hook into apache2ctl
-# This file is managed by Puppet!
-# vim: ft=sh :
-
-NICE=$((-`nice`))
-HTTPD="nice -n$NICE /usr/sbin/apache2 -DPHP5"
-
-# Image scaler detection
-if [ -e /etc/wikimedia-image-scaler ]; then
-       HTTPD="$HTTPD -DSCALER"
-fi
-
-# Core dump support
-if [ -e /etc/apache2/core-dump-max-size ]; then
-       ulimit -c "`cat /etc/apache2/core-dump-max-size`"
-       HTTPD="$HTTPD -DCORE_DUMPS"
-       mkdir -p /usr/local/apache/core
-       chown apache:apache /usr/local/apache/core
-       chmod 700 /usr/local/apache/core
-fi
-
-# For Ubuntu 10.04+
-APACHE_PID_FILE="/var/run/apache2.pid"
-
-. /etc/lsb-release
-if [ "$DISTRIB_CODENAME" = "trusty" ]; then
-       export APACHE_ARGUMENTS="$APACHE_ARGUMENTS -D HHVM"
-fi
-
-# Don't crash when NFS goes down
-cd /
diff --git a/modules/mediawiki/files/apache/envvars.precise 
b/modules/mediawiki/files/apache/envvars.precise
new file mode 100644
index 0000000..39db79d
--- /dev/null
+++ b/modules/mediawiki/files/apache/envvars.precise
@@ -0,0 +1,37 @@
+# envvars - default environment variables for apache2ctl
+
+# this won't be correct after changing uid
+unset HOME
+
+# for supporting multiple apache2 instances
+if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
+       SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
+else
+       SUFFIX=
+fi
+
+# Since there is no sane way to get the parsed apache2 config in scripts, some
+# settings are defined via environment variables and then used in apache2ctl,
+# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
+export APACHE_RUN_USER=www-data
+export APACHE_RUN_GROUP=www-data
+export APACHE_PID_FILE=/var/run/apache2$SUFFIX.pid
+export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
+export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
+# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
+export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
+
+## The locale used by some modules like mod_dav
+export LANG=C
+## Uncomment the following line to use the system default locale instead:
+#. /etc/default/locale
+#
+export LANG
+
+## The command to get the status for 'apache2ctl status'.
+## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
+#export APACHE_LYNX='www-browser -dump'
+
+## If you need a higher file descriptor limit, uncomment and adjust the
+## following line (default is 8192):
+#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'
diff --git a/modules/mediawiki/files/apache/envvars.trusty 
b/modules/mediawiki/files/apache/envvars.trusty
new file mode 100644
index 0000000..be22ed7
--- /dev/null
+++ b/modules/mediawiki/files/apache/envvars.trusty
@@ -0,0 +1,50 @@
+# envvars - default environment variables for apache2ctl
+
+# this won't be correct after changing uid
+unset HOME
+
+# for supporting multiple apache2 instances
+if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
+        SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
+else
+        SUFFIX=
+fi
+
+# Since there is no sane way to get the parsed apache2 config in scripts, some
+# settings are defined via environment variables and then used in apache2ctl,
+# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
+export APACHE_RUN_USER=www-data
+export APACHE_RUN_GROUP=www-data
+# temporary state file location. This might be changed to /run in Wheezy+1
+export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
+export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
+export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
+# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
+export APACHE_LOG_DIR=/var/log/apache2$SUFFIX
+
+## The locale used by some modules like mod_dav
+export LANG=C
+## Uncomment the following line to use the system default locale instead:
+#. /etc/default/locale
+
+export LANG
+
+## The command to get the status for 'apache2ctl status'.
+## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
+#export APACHE_LYNX='www-browser -dump'
+
+## If you need a higher file descriptor limit, uncomment and adjust the
+## following line (default is 8192):
+#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'
+
+## If you would like to pass arguments to the web server, add them below
+## to the APACHE_ARGUMENTS environment.
+#export APACHE_ARGUMENTS=''
+
+## Enable the debug mode for maintainer scripts.
+## This will produce a verbose output on package installations of web server 
modules and web application
+## installations which interact with Apache
+#export APACHE2_MAINTSCRIPT_DEBUG=1
+
+### WMF SPECIFIC ###
+export APACHE_ARGUMENTS="$APACHE_ARGUMENTS -D HHVM"
diff --git a/modules/mediawiki/manifests/web.pp 
b/modules/mediawiki/manifests/web.pp
index cc94834..d45d78a 100644
--- a/modules/mediawiki/manifests/web.pp
+++ b/modules/mediawiki/manifests/web.pp
@@ -39,15 +39,19 @@
         require => Package['apache2'],
     }
 
-    file { '/etc/apache2/envvars':
-        source  => 'puppet:///modules/mediawiki/apache/envvars.appserver',
-        owner   => 'root',
-        group   => 'root',
-        mode    => '0444',
-        before  => Service['apache2'],
-        require => Package['apache2'],
+    if ubuntu_version('>= trusty') {
+        file { '/etc/apache2/envvars':
+            ensure => present,
+            source => 'puppet:///modules/mediawiki/apache/envvars.trusty'
+        }
+    } else {
+        file { '/etc/apache2/envvars':
+            ensure => present,
+            source => 'puppet:///modules/mediawiki/apache/envvars.precise'
+        }
     }
 
+    # do not erase this for now, it may come handy soon...
     file { '/etc/apache2/wikimedia':
         ensure  => directory,
     }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3fbf9bdb1ff01a0146ecd850990a35c3eb41f3ad
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Filippo Giunchedi <fgiunch...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@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