Merge pull request #56 from aboe76/hhvm

Add hhvm support to php ng formula
This commit is contained in:
puneet kandhari 2015-07-25 15:31:43 -05:00
commit 3f33a25a99
7 changed files with 145 additions and 0 deletions

View File

@ -270,6 +270,31 @@ Manages php-fpm pool config files.
Manages the php-fpm service.
``php.ng.hhvm``
---------------
Meta-state that combines php.ng.hhvm states
``php.ng.hhvm.config``
----------------------
Manages the php-hhvm config files
``php.ng.hhvm.install``
-----------------------
Installs the php-hhvm package
``php.ng.hhvm.repo``
--------------------
Configures the hhvm repo for debian/ubuntu
``php.ng.hhvm.service``
-----------------------
Manages the php-hhvm service.
``php.ng.gd``
-------------

16
php/ng/hhvm/config.sls Normal file
View File

@ -0,0 +1,16 @@
# Manages the php-hhvm main ini file
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/ini.jinja" import php_ini %}
{% set server_settings = php.lookup.hhvm.server %}
{% do server_settings.update(php.hhvm.config.server.settings) %}
{% set php_settings = php.lookup.hhvm.php %}
{% do php_settings.update(php.hhvm.config.php.settings) %}
php_hhvm_ini_config:
{{ php_ini(php.lookup.hhvm.conf, php.hhvm.config.server.opts, server_settings) }}
php_hhvm_conf_config:
{{ php_ini(php.lookup.hhvm.ini, php.hhvm.config.php.opts, php_settings) }}

23
php/ng/hhvm/init.sls Normal file
View File

@ -0,0 +1,23 @@
# Meta-state to fully install php.hhvm
include:
- php.ng.hhvm.repo
- php.ng.hhvm.config
- php.ng.hhvm.service
extend:
php_hhvm_service:
service:
- watch:
- file: php_hhvm_ini_config
- file: php_hhvm_conf_config
- require:
- sls: php.ng.hhvm.config
php_hhvm_ini_config:
file:
- require:
- pkg: php_install_hhvm
php_hhvm_conf_config:
file:
- require:
- pkg: php_install_hhvm

2
php/ng/hhvm/install.sls Normal file
View File

@ -0,0 +1,2 @@
{% set state = 'hhvm' %}
{% include "php/ng/installed.jinja" %}

19
php/ng/hhvm/repo.sls Normal file
View File

@ -0,0 +1,19 @@
# Manages the php-hhvm service.
{% from "php/ng/map.jinja" import php with context %}
include:
- php.ng.hhvm.install
{% if salt['grains.get']('os_family') == 'Debian' -%}
hhvm_repo:
pkgrepo.managed:
- name: deb http://dl.hhvm.com/{{ salt['grains.get']('os')|lower }} {{ salt['grains.get']('oscodename')}} main
- file: /etc/apt/sources.list.d/hhvm.list
- keyid: 0x5a16e7281be7a449
- keyserver: keyserver.ubuntu.com
- refresh_db: True
- require_in:
- pkg: php_install_hhvm
{%- endif %}

19
php/ng/hhvm/service.sls Normal file
View File

@ -0,0 +1,19 @@
# Manages the php-hhvm service.
{% from "php/ng/map.jinja" import php with context %}
{% from "php/ng/macro.jinja" import sls_block %}
{% set service_function = {True:'running', False:'dead'}.get(php.hhvm.service.enabled) %}
include:
- php.ng.hhvm.install
php_hhvm_service:
service.{{ service_function }}:
{{ sls_block(php.hhvm.service.opts) }}
- name: {{ php.lookup.hhvm.service }}
- enable: {{ php.hhvm.service.enabled }}
- require:
- sls: php.ng.hhvm.install
- watch:
- pkg: php_install_hhvm

View File

@ -11,6 +11,7 @@
'apache2': 'libapache2-mod-php5',
'curl': 'php5-curl',
'fpm': 'php5-fpm',
'hhvm': 'hhvm',
'gd': 'php5-gd',
'gmp': 'php5-gmp',
'geoip': 'php5-geoip',
@ -50,6 +51,30 @@
('include', '/etc/php5/fpm/pool.d/*.conf'),
]),
},
'hhvm': {
'conf': '/etc/hhvm/server.ini',
'ini': '/etc/hhvm/php.ini',
'service': 'hhvm',
'defaults': {},
'server': odict([
('pid', '/var/run/hhvm.pid'),
('hhvm.server.port', '9000'),
('hhvm.server.type', 'fastcgi'),
('hhvm.server.default_document', 'index.php'),
('hhvm.log.use_log_file', 'true'),
('hhvm.log.file', '/var/log/hhvm/error.log'),
('hhvm.repo.central.path', '/var/run/hhvm/hhvm.hhbc'),
]),
'php': odict([
('session.save_handler', 'files'),
('session.save_path', '/var/lib/hhvm/sessions'),
('session.gc_maxlifetime', '1440'),
('hhvm.log.level', 'Warning'),
('hhvm.log.always_log_unhandled_exceptions', 'true'),
('hhvm.log.runtime_error_reporting_level', '8191'),
('hhvm.mysql.typed_results', 'false'),
]),
},
'cli': {
'ini': '/etc/php5/cli/php.ini',
},
@ -198,6 +223,22 @@
},
'pools': {},
},
'hhvm': {
'service': {
'enabled': True,
'opts': {},
},
'config': {
'server': {
'opts': {},
'settings': {},
},
'php': {
'opts': {},
'settings': {},
},
},
},
'cli': {
'ini': {
'opts': {},