jenkins-bot has submitted this change and it was merged.

Change subject: hhvm: Cleanup configuration
......................................................................


hhvm: Cleanup configuration

The use of hdf files is no longer required. The operations/puppet
classes have been fixed for this for a while, so it was used as
a template update our class. Other small changes were made to bring our
hhvm class closer to the one that is used in operations/puppet.

A few additional HHVM ini settings were added that may help with local
debugging. Then again they may not. Reading HHVM source code to discover
what settings are used for is a bit of a dark art that I haven't quite
mastered yet.

Change-Id: Ic5b27158c322c0f20844f5c05d140ec77eb86e51
---
M puppet/hieradata/common.yaml
A puppet/modules/hhvm/files/hhvm.conf
M puppet/modules/hhvm/manifests/init.pp
D puppet/modules/hhvm/templates/hhvm.conf.erb
A puppet/modules/hhvm/templates/hhvm.default.erb
5 files changed, 103 insertions(+), 63 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/puppet/hieradata/common.yaml b/puppet/hieradata/common.yaml
index cdf2014..90d391e 100644
--- a/puppet/hieradata/common.yaml
+++ b/puppet/hieradata/common.yaml
@@ -31,7 +31,12 @@
       apc:
         enable_apc: true
         table_type: concurrent
+      fatal_error_message: true
     dynamic_extension_path: /usr/lib/x86_64-linux-gnu/hhvm/extensions/current
+    dynamic_extensions:
+      - fss.so
+      - luasandbox.so
+      - wikidiff2.so
     jit: false
     jit_afrozen_size: 100000000
     log:
@@ -43,12 +48,15 @@
       use_log_file: true
       use_syslog: false
       file: "%{hiera('hhvm::logroot')}/hhvm/error.log"
-      access:
-        file: "%{hiera('hhvm::logroot')}/hhvm/access.log"
-        format: "%h %l %u % t \\”%r\\” %>s %b"
+      admin_log:
+        file: "%{hiera('hhvm::logroot')}/hhvm/admin.log"
+    perf_pid_map: false
     debug:
       core_dump_report_directory: "%{hiera('hhvm::logroot')}/hhvm"
       server_error_message: true
+      full_backtrace: true
+      native_stack_trace: true
+      translate_source: true
     repo:
       central:
         path: /var/run/hhvm/hhvm.hhbc
@@ -76,6 +84,10 @@
 hhvm::fcgi_settings:
   max_execution_time: 180
   hhvm:
+    jit: true
+    repo:
+      central:
+        path: /var/run/hhvm/fcgi.hhbc.sq3
     xdebug-not-done:
       enable: 1
       remote_connect_back: 1
diff --git a/puppet/modules/hhvm/files/hhvm.conf 
b/puppet/modules/hhvm/files/hhvm.conf
new file mode 100644
index 0000000..45c6d24
--- /dev/null
+++ b/puppet/modules/hhvm/files/hhvm.conf
@@ -0,0 +1,55 @@
+# hhvm - HipHop Virtual Machine
+# Starts HHVM in server (FastCGI) mode.
+# Configured via /etc/default/hhvm.
+description "HipHop Virtual Machine for PHP"
+
+start on (local-filesystems and net-device-up IFACE!=lo)
+
+pre-start script
+  [ ! -r /etc/default/hhvm ] && { stop; exit 0; }
+  . /etc/default/hhvm
+  mkdir -p -m0755 "${HHVM_RUN_DIR:=/var/run/hhvm}"
+  mkdir -p -m0750 "${HHVM_RUN_DIR}/cache"
+  mkdir -p -m0775 "${HHVM_LOG_DIR:=/var/log/hhvm}"
+  mkdir -p -m0775 "${HHVM_TMP_DIR:=/var/tmp/hhvm}"
+  # Chowns don't work on Vagrant's NFS mounted logroot, but they also should
+  # not be needed there due to the uid mapping configuration
+  chown -R "${HHVM_USER:=www-data}:${HHVM_GROUP:=www-data}" "$HHVM_RUN_DIR" 
"$HHVM_TMP_DIR" || /bin/true
+
+  # Update the symlink `/usr/lib/x86_64-linux-gnu/hhvm/extensions/current` so
+  # it points to the directory whose name matches the extension API version
+  # (e.g. `/usr/lib/x86_64-linux-gnu/hhvm/extensions/20140829`).
+  API_VERSION="$(/usr/bin/hhvm --version | grep -Po '(?<=API: ).+')"
+  ( cd /usr/lib/x86_64-linux-gnu/hhvm/extensions; ln -Trsf "$API_VERSION" 
current; )
+end script
+
+env REMOTE_ADDR="127.0.0.1"
+
+script
+  . /etc/default/hhvm
+  exec /sbin/start-stop-daemon --quiet --start \
+    --chuid "${HHVM_USER:-www-data}:${HHVM_GROUP:-www-data}" \
+    --make-pidfile --pidfile "${HHVM_RUN_DIR:-/run/hhvm}/hhvm.pid" \
+    --chdir "${HHVM_TMP_DIR:-/var/tmp/hhvm}" \
+    --startas /usr/bin/hhvm -- \
+      --config "${HHVM_CONFIG_DIR:-/etc/hhvm}/fcgi.ini" \
+      --mode server
+end script
+
+# Don't limit the size of core dumps.
+limit core unlimited unlimited
+
+# Increase the maximum number of open files.
+limit nofile 65536 65536
+
+# Increase the maximum size of the stack to 64MiB. See bug 71486.
+limit stack 67108864 unlimited
+
+# When 'hhvm.server.graceful_shutdown_wait' is set to a positive
+# integer, HHVM will perform a graceful shutdown on SIGHUP.
+kill signal HUP
+
+respawn
+respawn limit unlimited
+
+# vim: set ft=upstart:
diff --git a/puppet/modules/hhvm/manifests/init.pp 
b/puppet/modules/hhvm/manifests/init.pp
index c80e387..472ae28 100644
--- a/puppet/modules/hhvm/manifests/init.pp
+++ b/puppet/modules/hhvm/manifests/init.pp
@@ -6,16 +6,8 @@
 # The layout of configuration files in /etc/hhvm is as follows:
 #
 #   /etc/hhvm
-#   │
-#   ├── config.hdf        ┐
-#   │                     ├ Settings for CLI mode
-#   ├── php.ini           ┘
-#   │
-#   └── fcgi
-#       │
-#       ├── config.hdf    ┐
-#       │                 ├ Settings for FastCGI mode
-#       └── php.ini       ┘
+#   ├── php.ini  # Settings for CLI mode
+#   └── fcgi.ini # Settings for FastCGI mode
 #
 # The CLI configs are located in the paths HHVM automatically loads by
 # default. This makes it easy to invoke HHVM from the command line,
@@ -64,7 +56,7 @@
         require     => Package['hhvm'],
     }
 
-    file { ['/etc/hhvm', '/etc/hhvm/fcgi']:
+    file { '/etc/hhvm':
         ensure => directory,
     }
 
@@ -72,21 +64,29 @@
         content => php_ini($common_settings),
     }
 
-    file { '/etc/hhvm/fcgi/php.ini':
+    file { '/etc/hhvm/fcgi.ini':
         content => php_ini($common_settings, $fcgi_settings),
         notify  => Service['hhvm'],
     }
 
-    file { '/etc/hhvm/config.hdf':
-        content => template('hhvm/config.hdf.erb'),
-        require => Package['hhvm'],
+    file { '/etc/default/hhvm':
+        ensure  => file,
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+        content => template('hhvm/hhvm.default.erb'),
         notify  => Service['hhvm'],
     }
 
     file { '/etc/init/hhvm.conf':
         ensure  => file,
-        content => template('hhvm/hhvm.conf.erb'),
-        require => [ Env::Alternative['hhvm_as_default_php'], 
File['/etc/hhvm/config.hdf'] ],
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+        source  => 'puppet:///modules/hhvm/hhvm.conf',
+        require => [
+          Env::Alternative['hhvm_as_default_php'],
+        ],
         notify  => Service['hhvm'],
     }
 
@@ -106,4 +106,16 @@
         content => template('hhvm/admin-apache-site.erb'),
         require => Class['::apache::mod::proxy_fcgi'],
     }
+
+    # Clean up legacy config files
+    file { [
+      '/etc/hhvm/config.hdf',
+      '/etc/hhvm/server.ini',
+      '/etc/hhvm/fcgi',
+      '/etc/hhvm/fcgi/php.ini',
+      '/etc/hhvm/fcgi/config.hdf',
+    ]:
+        ensure => absent,
+        force  => true,
+    }
 }
diff --git a/puppet/modules/hhvm/templates/hhvm.conf.erb 
b/puppet/modules/hhvm/templates/hhvm.conf.erb
deleted file mode 100644
index ad13fdb..0000000
--- a/puppet/modules/hhvm/templates/hhvm.conf.erb
+++ /dev/null
@@ -1,43 +0,0 @@
-# hhvm - HipHop Virtual Machine
-# Runs HHVM in server mode.
-description "HipHop Virtual Machine for PHP"
-
-start on (local-filesystems and net-device-up IFACE!=lo)
-
-pre-start script
-  mkdir -p -m0755 /var/run/hhvm
-  chown -R www-data:www-data /var/run/hhvm
-  mkdir -p -m0755 <%= @logroot %>/hhvm
-  # chowns don't work on Vagrant's NFS mounted logroot, but they also should
-  # not be needed there due to the uid mapping configuration
-  chown -R www-data:www-data <%= @logroot %>/hhvm || /bin/true
-
-  # Update the symlink `/usr/lib/x86_64-linux-gnu/hhvm/extensions/current` so
-  # it points to the directory whose name matches the extension API version
-  # (e.g. `/usr/lib/x86_64-linux-gnu/hhvm/extensions/20140829`).
-  API_VERSION="$(/usr/bin/hhvm --version | grep -Po '(?<=API: ).+')"
-  ( cd /usr/lib/x86_64-linux-gnu/hhvm/extensions; ln -Trsf "$API_VERSION" 
current; )
-end script
-
-env REMOTE_ADDR="127.0.0.1"
-
-exec /sbin/start-stop-daemon --quiet --start \
-  --chuid www-data:www-data \
-  --pidfile /var/run/hhvm/hhvm.pid \
-  --startas /usr/bin/hhvm -- \
-    --config /etc/hhvm/config.hdf \
-    --config /etc/hhvm/fcgi/php.ini \
-    --mode server -v Eval.Jit=true
-
-# Don't limit the size of core dumps.
-limit core unlimited unlimited
-
-# Increase the maximum number of open files.
-limit nofile 65536 65536
-
-# When 'hhvm.server.graceful_shutdown_wait' is set to a positive
-# integer, HHVM will perform a graceful shutdown on SIGHUP.
-kill signal HUP
-
-respawn
-# vim: set ft=upstart:
diff --git a/puppet/modules/hhvm/templates/hhvm.default.erb 
b/puppet/modules/hhvm/templates/hhvm.default.erb
new file mode 100644
index 0000000..b0ae76e
--- /dev/null
+++ b/puppet/modules/hhvm/templates/hhvm.default.erb
@@ -0,0 +1,4 @@
+# Default file for HHVM
+# This file is managed by Puppet.
+
+HHVM_LOG_DIR="<%= @logroot %>/hhvm"

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic5b27158c322c0f20844f5c05d140ec77eb86e51
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to