HHVM settings for CentOS6 (chef recipe/file/template)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: hhvm | |
# Recipe:: gleez | |
# | |
# Copyright (c) 2015 The Authors, All Rights Reserved. | |
%w{ | |
epel-release | |
libmcrypt-devel jemalloc-devel tbb-devel libdwarf-devel mysql-devel | |
libxml2-devel libicu-devel pcre-devel gd-devel boost-devel sqlite-devel pam-devel | |
bzip2-devel oniguruma-devel openldap-devel readline-devel libc-client-devel libcap-devel | |
libevent-devel libcurl-devel libmemcached-devel | |
}.each do |p| | |
package p | |
end | |
{ | |
"gleez-repo" => "http://yum.gleez.com/6/x86_64/gleez-repo-6-0.el6.noarch.rpm", | |
"remi-release" => "http://remi.kazukioishi.net/enterprise/remi-release-6.rpm" | |
}.each do |r,u| | |
execute "rpm -i #{u}" do | |
not_if "rpm -q #{r}" | |
end | |
end | |
%w{mysql mysql-devel mysql-libs}.each do |p| | |
package p do | |
action :upgrade | |
options '--enablerepo=remi,epel --disablerepo=base' | |
end | |
end | |
# this version has been removed by original remi repository | |
execute "rpm -i http://mirrors.neterra.net/remi/enterprise/6/olds/x86_64/libwebp-0.3.1-2.el6.remi.x86_64.rpm" do | |
not_if "rpm -q libwebp-0.3.1-2.el6.remi.x86_64" | |
end | |
package 'hhvm' do | |
options '--nogpgcheck' | |
end | |
execute "sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/gleez.repo" do | |
not_if "grep -q 'enabled=0' /etc/yum.repos.d/gleez.repo" | |
end | |
cookbook_file "init.d.hhvm" do | |
path "/etc/init.d/hhvm" | |
mode 0755 | |
end | |
template "/etc/hhvm/server.ini" do | |
source "server.ini.erb" | |
variables({ | |
:user => "nginx", | |
:deploy_to => node['deploy_to'], | |
:memory => [("#{node[:memory][:total]}"[/\d+/].to_f * 1024 * 0.4).to_i, 268435456].min # 40% of memory, or 256MB | |
}) | |
notifies :restart, "service[hhvm]", :delayed | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# /etc/rc.d/init.d/hhvm | |
# | |
# Starts the hhvm daemon | |
# | |
# chkconfig: 345 26 74 | |
# description: HHVM (aka the HipHop Virtual Machine) is an open-source virtual machine designed for executing programs written in Hack and PHP | |
# processname: hhvm | |
### BEGIN INIT INFO | |
# Provides: hhvm | |
# Required-Start: $local_fs | |
# Required-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: start and stop hhvm | |
# Description: HHVM (aka the HipHop Virtual Machine) is an open-source virtual machine designed for executing programs written in Hack and PHP | |
### END INIT INFO | |
# Source function library. | |
. /etc/init.d/functions | |
prog="hhvm" | |
pidfile="/var/run/hhvm/hhvm.pid" | |
lockfile="/var/lock/subsys/hhvm" | |
commands="/usr/bin/hhvm --config /etc/hhvm/server.ini --mode daemon" | |
start() { | |
echo -n $"Starting $prog: " | |
daemon --pidfile=${pidfile} ${commands} | |
RETVAL=$? | |
echo | |
[ $RETVAL = 0 ] && touch ${lockfile} | |
return $RETVAL | |
} | |
stop() { | |
echo -n $"Stopping $prog: " | |
killproc -p ${pidfile} ${prog} | |
RETVAL=$? | |
echo | |
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status -p ${pidfile} hhvm | |
;; | |
restart) | |
stop | |
start | |
;; | |
reload|condrestart|probe) | |
echo "$1 - Not supported." | |
;; | |
*) | |
echo "Usage: hhvm {start|stop|status|restart}" | |
exit 1 | |
;; | |
esac | |
exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; php options | |
date.timezone = Asia/Tokyo | |
mbstring.language = Japanese | |
mbstring.internal_encoding = UTF-8 | |
mbstring.http_input = pass | |
mbstring.http_output = pass | |
default_charset = UTF-8 | |
expose_php = off | |
upload_max_filesize = 10M | |
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT | |
; hhvm specific | |
hhvm.server.user = <%= @user %> | |
hhvm.server.default_document = index.php | |
pid = /var/run/hhvm/hhvm.pid | |
hhvm.server.type = fastcgi | |
hhvm.server.file_socket = /var/run/hhvm/hhvm.sock | |
hhvm.repo.central.path = /dev/shm/hhvm.hhbc | |
; hhvm.repo.authoritative = true | |
; hhvm.php7.all = true | |
hhvm.jit_a_size = <%= @memory %> ; 40% of memory | |
hhvm.jit_a_hot_size = <%= @memory / 2 %> ; 20% of memory | |
hhvm.jit_a_cold_size = <%= @memory / 2 %> ; 20% of memory | |
hhvm.jit_a_frozen_size = <%= @memory %> ; 40% of memory | |
hhvm.jit_a_prof_size = <%= @memory %> ; 40% of memory | |
hhvm.jit_a_max_size = <%= @memory %> ; 40% of memory | |
hhvm.jit_global_data_size = <%= @memory %> ; 40% of memory | |
hhvm.keep_perf_pid_map = 0 | |
hhvm.perf_pid_map = 0 | |
hhvm.perf_data_map = 0 | |
hhvm.eval.pcre_table_size = 1048576 | |
hhvm.log.level = Warning | |
hhvm.log.always_log_unhandled_exceptions = true | |
hhvm.log.runtime_error_reporting_level = 8191 | |
hhvm.log.use_log_file = true | |
hhvm.log.header = true | |
hhvm.log.use_cronolog = true | |
hhvm.log.sym_link = true | |
hhvm.log.file = /var/log/hhvm/error.log | |
hhvm.error_handling.notice_frequency = 1 | |
hhvm.error_handling.warning_frequency = 1 | |
hhvm.mysql.typed_results = false | |
hhvm.admin_server.port = 9002 | |
hhvm.admin_server.password = |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment