Giuseppe Lavagetto has uploaded a new change for review.

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

Change subject: hhvm: make the puppet module more configurable
......................................................................

hhvm: make the puppet module more configurable

* Make it possible to change the run, log, cache and tmp directories
* Ensure all those directories are created by puppet
* Remove the same functions from the upstart script

Change-Id: I2b4838f2e102e012fcbc7f51673c928c0e3ccb66
---
M modules/hhvm/files/hhvm.conf
M modules/hhvm/manifests/init.pp
M modules/hhvm/templates/hhvm.default.erb
3 files changed, 31 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/08/179108/1

diff --git a/modules/hhvm/files/hhvm.conf b/modules/hhvm/files/hhvm.conf
index 0e7378c..658dd4f 100644
--- a/modules/hhvm/files/hhvm.conf
+++ b/modules/hhvm/files/hhvm.conf
@@ -4,17 +4,7 @@
 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:=/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}"
-  chown -R "${HHVM_USER:=www-data}:${HHVM_GROUP:=www-data}" "$HHVM_RUN_DIR" 
"$HHVM_TMP_DIR"
-  chown -R "syslog:${HHVM_GROUP}" "$HHVM_LOG_DIR"
-
+  # TODO: move to the package post-install.
   # 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`).
diff --git a/modules/hhvm/manifests/init.pp b/modules/hhvm/manifests/init.pp
index d03c72d..e5e1abc 100644
--- a/modules/hhvm/manifests/init.pp
+++ b/modules/hhvm/manifests/init.pp
@@ -55,10 +55,14 @@
 #  }
 #
 class hhvm(
-    $user          = 'www-data',
-    $group         = 'www-data',
-    $fcgi_settings = {},
-    $cli_settings  = {},
+    $user           = 'www-data',
+    $group          = 'www-data',
+    $run_dir        = '/run/hhvm',
+    $hhbc_repo_path = '/run/hhvm/cache',
+    $log_dir        = '/var/log/hhvm',
+    $tmp_dir        = '/var/tmp/hhvm',
+    $fcgi_settings  = {},
+    $cli_settings   = {},
 ) {
     requires_os('ubuntu >= trusty')
 
@@ -72,7 +76,6 @@
     package { [ 'hhvm-fss', 'hhvm-luasandbox', 'hhvm-tidy', 'hhvm-wikidiff2' ]:
         ensure => present,
     }
-
 
     ## Settings
 
@@ -130,7 +133,11 @@
             jit_a_cold_size   => $a_cold_size,
             jit_a_frozen_size => $a_frozen_size,
             perf_pid_map      => true,  # See 
<http://www.brendangregg.com/perf.html#JIT%20Symbols>
-            repo              => { central => { path => 
'/run/hhvm/cache/fcgi.hhbc.sq3' } },
+            repo              => {
+                central => {
+                    path => "${hhbc_repo_path}/fcgi.hhbc.sq3"
+                }
+            },
             admin_server      => { port => 9001 },
             server            => {
                 port                   => 9000,
@@ -146,7 +153,7 @@
             jit          => false,
             perf_pid_map => false,
             repo         => {
-                central => { path => '/run/hhvm/cache/cli.hhbc.sq3' },
+                central => { path => "${hhbc_repo_path}/cli.hhbc.sq3" },
                 local   => { mode => '--' },
             }
         }
@@ -224,7 +231,7 @@
         before  => Service['hhvm'],
     }
 
-    file { '/var/log/hhvm':
+    file { $log_dir:
         ensure => directory,
         owner  => 'syslog',
         group  => $group,
@@ -232,14 +239,21 @@
         before => Service['hhvm'],
     }
 
-    file { [ '/run/hhvm', '/run/hhvm/cache' ]:
+    file { [$run_dir, $tmp_dir]:
         ensure => directory,
         owner  => $user,
         group  => $group,
-        mode   => '0755',
+        mode   => '0775',
         before => Service['hhvm'],
     }
 
+    file { $hhbc_repo_path:
+        ensure => directory,
+        owner  => $user,
+        group  => $group,
+        mode   => '0750',
+        before => Service['hhvm'],
+    }
 
     # Prune stale symbol translation maps from /tmp. These files are
     # generated by HHVM to supply `perf` with language-level context.
diff --git a/modules/hhvm/templates/hhvm.default.erb 
b/modules/hhvm/templates/hhvm.default.erb
index c133b67..990b956 100644
--- a/modules/hhvm/templates/hhvm.default.erb
+++ b/modules/hhvm/templates/hhvm.default.erb
@@ -10,3 +10,9 @@
 # If set to an executable, that executable will be invoked with the path
 # to a stack trace as an argument whenever HHVM crashes.
 HHVM_TRACE_HANDLER="/usr/bin/logger --tag hhvm-fatal --file"
+
+
+# HHVM tmp directory
+HHVM_TMP_DIR="<%= @tmp_dir %>"
+HHVM_LOG_DIR="<%= @log_dir %>"
+HHVM_RUN_DIR="<%= @run_dir %>"

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

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

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

Reply via email to