Skip to content

Commit

Permalink
Merge pull request #14 from spsoit/master
Browse files Browse the repository at this point in the history
Adds NG states to php-formula
  • Loading branch information
whiteinge committed Jun 8, 2014
2 parents f7526d5 + 7f90be9 commit feb3c03
Show file tree
Hide file tree
Showing 40 changed files with 886 additions and 11 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
===========
php-formula
===========

0.2.0
-----

- Added .ng states

0.1.0
-----

- Initial version
193 changes: 182 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ Installs the php package.
Installs the php-apc package.

``php.adodb``
------------
-------------

Installs the php-adodb package.

``php.cgi``
------------
-----------

Installs the php-cgi package.

``php.cli``
------------
-----------

Installs the php-cli package.

Expand All @@ -59,7 +59,7 @@ Installs the php-gd package.


``php.imagick``
------------
---------------

Installs the php-imagick package.

Expand All @@ -79,7 +79,7 @@ Installs the php-json package.
Installs the php-ldap package.

``php.mbstring``
---------------
----------------

Installs the php-mbstring package.

Expand All @@ -90,12 +90,12 @@ Installs the php-mcrypt package.


``php.memcache``
------------
----------------

Installs the php-memcache package.

``php.memcached``
------------
-----------------

Installs the php-memcached package.

Expand All @@ -105,7 +105,7 @@ Installs the php-memcached package.
Installs the php-mysql package.

``php.mysqlnd``
------------
---------------

Installs the php-mysqlnd package.

Expand All @@ -115,7 +115,7 @@ Installs the php-mysqlnd package.
Installs the php-pear package.

``php.pgsql``
------------
-------------

Installs the php-pgsql package.

Expand All @@ -125,11 +125,182 @@ Installs the php-pgsql package.
Installs the php-soap package.

``php.suhosin``
------------
---------------

Installs the php-suhosin package.

``php.xml``
------------
-----------

Installs the php-xml package.

Next-generation, alternate approach
===================================

The following states provide an alternate approach to managing PHP and FPM
pools, as well as code organization. Please provide feedback by filing issues,
discussing in ``#salt`` in Freenode and the mailing list as normal.

**Note:** php.ng states require the merge parameter of salt.modules.pillar.get(),
first available in the Helium release.

.. contents::
:local:

``php.ng``
----------

Installs the php package.

``php.ng.adodb``
----------------

Installs the php-adodb package.

``php.ng.apc``
--------------

Installs the php-apc package.

``php.ng.cgi``
--------------

Installs the php-cgi package.

``php.ng.cli``
--------------

Meta-state that combines `php.ng.cli.install`_ and `php.ng.cli.ini`_.

``php.ng.cli.install``
----------------------

Installs the php-cli package.

``php.ng.cli.ini``
------------------

Manages the php-cli ini file.

``php.ng.curl``
---------------

Installs the php5-curl package on Debian, and ensures that curl itself is
installed for RedHat systems, this is due to the curl libs being provided by
php-common, which will get installed with the main php package.

``php.ng.fpm``
--------------

Meta-state that combines all php.ng.fpm states.

``php.ng.fpm.config``
---------------------

Manages the (non-pool) php-fpm config files.


``php.ng.fpm.install``
----------------------

Installs the php-fpm package.


``php.ng.fpm.pools``
--------------------

Meta-state that combines `php.ng.fpm.service`_ and `php.ng.fpm.pools_config`_


``php.ng.fpm.pools_config``
---------------------------

Manages php-fpm pool config files.


``php.ng.fpm.service``
----------------------

Manages the php-fpm service.

``php.ng.gd``
-------------

Installs the php-gd package.


``php.ng.imagick``
------------------

Installs the php-imagick package.

``php.ng.imap``
---------------

Installs the php-imap package.

``php.ng.json``
---------------

Installs the php-json package.

``php.ng.ldap``
---------------

Installs the php-ldap package.

``php.ng.mbstring``
-------------------

Installs the php-mbstring package.

``php.ng.mcrypt``
-----------------

Installs the php-mcrypt package.


``php.ng.memcache``
-------------------

Installs the php-memcache package.

``php.ng.memcached``
--------------------

Installs the php-memcached package.

``php.ng.mysql``
----------------

Installs the php-mysql package.

``php.ng.mysqlnd``
------------------

Installs the php-mysqlnd package.

``php.ng.pear``
---------------

Installs the php-pear package.

``php.ng.pgsql``
----------------

Installs the php-pgsql package.

``php.ng.soap``
---------------

Installs the php-soap package.

``php.ng.suhosin``
------------------

Installs the php-suhosin package.

``php.ng.xml``
--------------

Installs the php-xml package.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.4
2 changes: 2 additions & 0 deletions php/map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'adodb_pkg': 'php5-adodb',
'pgsql_pkg': 'php5-pgsql',
'ldap_pkg': 'php5-ldap',
'php_ini': '/etc/php5/apache2/php.ini',
},
'RedHat': {
'php_pkg': 'php',
Expand All @@ -50,5 +51,6 @@
'adodb_pkg': 'php-adodb',
'pgsql_pkg': 'php-pgsql',
'ldap_pkg': 'php-ldap',
'php_ini': '/etc/php.ini',
},
}, merge=salt['pillar.get']('php:lookup')) %}
2 changes: 2 additions & 0 deletions php/ng/adodb.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% set state = 'adodb' %}
{% include "php/ng/installed.jinja" %}
2 changes: 2 additions & 0 deletions php/ng/apc.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% set state = 'apc' %}
{% include "php/ng/installed.jinja" %}
2 changes: 2 additions & 0 deletions php/ng/cgi.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% set state = 'cgi' %}
{% include "php/ng/installed.jinja" %}
9 changes: 9 additions & 0 deletions php/ng/cli/ini.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Manages the php cli main ini file
{% from 'php/ng/map.jinja' import php with context %}
{% from "php/ng/ini.jinja" import php_ini %}
{% set settings = php.ini.defaults %}
{% do settings.update(php.cli.ini.settings) %}
php_cli_ini:
{{ php_ini(php.lookup.cli.ini, php.cli.ini.opts, settings) }}
11 changes: 11 additions & 0 deletions php/ng/cli/init.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Installs php-cli and manages the associated php.ini

include:
- php.ng.cli.install
- php.ng.cli.ini

extend:
php_cli_ini:
file:
- require:
- sls: php.ng.cli.install
2 changes: 2 additions & 0 deletions php/ng/cli/install.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% set state = 'cli' %}
{% include "php/ng/installed.jinja" %}
2 changes: 2 additions & 0 deletions php/ng/curl.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% set state = 'curl' %}
{% include "php/ng/installed.jinja" %}
31 changes: 31 additions & 0 deletions php/ng/files/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{%- macro php_block(config) %}
{% for sections in config %}
{%- for section, settings in sections.items() -%}
{%- if settings is number or settings is string %}
{{ section }} = {{ settings }}
{%- else %}
[{{ section }}]
{%- for setting in settings -%}
{%- for key, value in setting.items() %}
{%- if value is number or value is string %}
{{ key }} = {{ value }}
{%- elif value is iterable -%}
{%- if key == 'error_reporting' %}
{{ key }} = {{ value|join(" & ") }}
{%- else %}
{{ key }} = {{ value|join(",") }}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{% endfor %}
{%- endmacro -%}

; PHP configuration file.
;
; **** DO NOT EDIT THIS FILE ****
;
; This file is managed by Salt via {{ source }}
{{ php_block(config) }}
15 changes: 15 additions & 0 deletions php/ng/fpm/config.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Manages the php-fpm 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.fpm.config.ini.settings) %}
{% set conf_settings = php.lookup.fpm.defaults %}
{% do conf_settings.update(php.fpm.config.conf.settings) %}
php_fpm_ini_config:
{{ php_ini(php.lookup.fpm.ini, php.fpm.config.ini.opts, ini_settings) }}
php_fpm_conf_config:
{{ php_ini(php.lookup.fpm.conf, php.fpm.config.conf.opts, conf_settings) }}
15 changes: 15 additions & 0 deletions php/ng/fpm/init.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Meta-state to fully install php.fpm

include:
- php.ng.fpm.config
- php.ng.fpm.service
- php.ng.fpm.pools

extend:
php_fpm_service:
service:
- watch:
- file: php_fpm_ini_config
- file: php_fpm_conf_config
- require:
- sls: php.ng.fpm.config
2 changes: 2 additions & 0 deletions php/ng/fpm/install.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% set state = 'fpm' %}
{% include "php/ng/installed.jinja" %}

0 comments on commit feb3c03

Please sign in to comment.