Add hhvm support to php ng formula

This commit is contained in:
Niels Abspoel 2015-07-25 11:39:50 +02:00
parent 16e7cb083b
commit b3e64eb600
6 changed files with 107 additions and 0 deletions

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 ini_settings = php.ini.defaults %}
{% do ini_settings.update(php.hhvm.config.ini.settings) %}
{% set conf_settings = php.lookup.hhvm.defaults %}
{% do conf_settings.update(php.hhvm.config.conf.settings) %}
php_hhvm_ini_config:
{{ php_ini(php.lookup.hhvm.ini, php.hhvm.config.ini.opts, ini_settings) }}
php_hhvm_conf_config:
{{ php_ini(php.lookup.hhvm.conf, php.hhvm.config.conf.opts, conf_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_cnfig
- 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', 'apache2': 'libapache2-mod-php5',
'curl': 'php5-curl', 'curl': 'php5-curl',
'fpm': 'php5-fpm', 'fpm': 'php5-fpm',
'hhvm': 'hhvm',
'gd': 'php5-gd', 'gd': 'php5-gd',
'gmp': 'php5-gmp', 'gmp': 'php5-gmp',
'geoip': 'php5-geoip', 'geoip': 'php5-geoip',
@ -50,6 +51,17 @@
('include', '/etc/php5/fpm/pool.d/*.conf'), ('include', '/etc/php5/fpm/pool.d/*.conf'),
]), ]),
}, },
'hhvm': {
'conf': '/etc/hhvm/server.ini',
'ini': '/etc/hhvm/php.ini',
'service': 'hhvm',
'defaults': odict([
('global', odict([
('pid', '/var/run/hhvm.pid'),
('error_log', '/var/log/hhvm.log'),
])),
]),
},
'cli': { 'cli': {
'ini': '/etc/php5/cli/php.ini', 'ini': '/etc/php5/cli/php.ini',
}, },
@ -198,6 +210,22 @@
}, },
'pools': {}, 'pools': {},
}, },
'hhvm': {
'service': {
'enabled': True,
'opts': {},
},
'config': {
'ini': {
'opts': {},
'settings': {},
},
'conf': {
'opts': {},
'settings': {},
},
},
},
'cli': { 'cli': {
'ini': { 'ini': {
'opts': {}, 'opts': {},