Commit 70b9bd403d24caa81b36ed6f3363f7c50da6aa6d

Authored by nollieheel
Committed by Earth Ugat
1 parent e853b45d

Bump to v0.2.1. Add defaults to php-fpm.

... ... @@ -17,7 +17,7 @@ provisioner:
17 17 platforms:
18 18 - name: ubuntu-14.04
19 19 driver:
20   - image_id: ami-3d2cce5d
  20 + image_id: ami-50946030
21 21 transport:
22 22 username: ubuntu
23 23 ssh_key: ~/.ssh/cfe_stg_20160222.pem
... ...
  1 +# 0.2.1
  2 +
  3 +Add some defaults for php-fpm
  4 +
1 5 # 0.2.0
2 6
3 7 Add basic proxied webserver config
... ...
... ... @@ -124,7 +124,10 @@ default['cfe-nginx-php-fpm']['nginx']['sites'] = [
124 124 #override['php-fpm']['user'] = node['nginx']['user']
125 125 #override['php-fpm']['group'] = node['nginx']['group']
126 126
127   -default['php-fpm']['skip_repository_install'] = true
  127 +default['php-fpm']['skip_repository_install'] = true
  128 +default['php-fpm']['emergency_restart_threshold'] = '10'
  129 +default['php-fpm']['emergency_restart_interval'] = '1m'
  130 +default['php-fpm']['process_control_timeout'] = '10s'
128 131 default['php-fpm']['pools'] = [
129 132 # Most likely, just use one pool for all PHP needs.
130 133 # (But there are exceptions, of course)
... ... @@ -139,30 +142,28 @@ default['php-fpm']['pools'] = [
139 142 #:user => node['nginx']['user'],
140 143 #:group => node['nginx']['group'],
141 144
142   - :max_requests => 500,
143   - :max_children => 50,
  145 + #:max_requests => 500,
  146 + #:max_children => 50,
144 147
145   - :access_log => false,
146   - :catch_workers_output => 'no',
  148 + #:access_log => false,
  149 + #:catch_workers_output => 'no',
147 150
148   - :process_manager => value_for_platform(
149   - 'ubuntu' => {
150   - '10.04' => 'dynamic'
151   - },
152   - 'default' => 'ondemand'
153   - ),
  151 + #:process_manager => value_for_platform(
  152 + # 'ubuntu' => { '10.04' => 'dynamic' },
  153 + # 'default' => 'ondemand'
  154 + #),
154 155
155 156 # Only used if process_manager is 'dynamic':
156   - :start_servers => 5,
157   - :min_spare_servers => 5,
158   - :max_spare_servers => 35,
159   -
160   - :php_options => {
161   - 'php_admin_value[cgi.fix_pathinfo]' => '0',
162   - 'php_admin_value[expose_php]' => 'Off',
163   - 'php_value[upload_max_filesize]' => '5M',
164   - 'php_value[post_max_size]' => '10M'
165   - }
  157 + #:start_servers => 5,
  158 + #:min_spare_servers => 5,
  159 + #:max_spare_servers => 35,
  160 +
  161 + #:php_options => {
  162 + # 'php_admin_value[cgi.fix_pathinfo]' => '0',
  163 + # 'php_admin_value[expose_php]' => 'Off',
  164 + # 'php_value[upload_max_filesize]' => '5M',
  165 + # 'php_value[post_max_size]' => '10M'
  166 + #}
166 167 }
167 168 ]
168 169
... ...
... ... @@ -4,7 +4,7 @@ maintainer_email 'sysadmin@chromedia.com'
4 4 license 'Apache License'
5 5 description 'Simplifies setup of Nginx+PHP-FPM in Chromedia.'
6 6 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7   -version '0.2.0'
  7 +version '0.2.1'
8 8
9 9 {
10 10 'php-fpm' => '0.7.5',
... ...
... ... @@ -31,6 +31,17 @@ node.default['php-fpm']['user'] = node['nginx']['user']
31 31 node.default['php-fpm']['group'] = node['nginx']['group']
32 32
33 33 if node['php-fpm']['pools']
  34 + def_pm = value_for_platform(
  35 + 'ubuntu' => { '10.04' => 'dynamic' },
  36 + 'default' => 'ondemand'
  37 + )
  38 + def_php_opts = {
  39 + 'php_admin_value[cgi.fix_pathinfo]' => '0',
  40 + 'php_admin_value[expose_php]' => 'Off',
  41 + 'php_value[upload_max_filesize]' => '5M',
  42 + 'php_value[post_max_size]' => '10M'
  43 + }
  44 +
34 45 is_hash = node['php-fpm']['pools'].is_a?(Hash) # either Hash or Array
35 46 meth = node['php-fpm']['pools'].method( is_hash ? :each : :each_with_index )
36 47 meth.call do |el1, el2|
... ... @@ -38,8 +49,10 @@ if node['php-fpm']['pools']
38 49 pool = is_hash ? el2 : el1
39 50 pool2 = mash_to_hash(pool)
40 51
41   - pool2['user'] = node['nginx']['user'] unless pool['user']
42   - pool2['group'] = node['nginx']['user'] unless pool['group']
  52 + pool2['process_manager'] = def_pm unless pool['process_manager']
  53 + pool2['php_options'] = def_php_opts unless pool['php_options']
  54 + pool2['user'] = node['nginx']['user'] unless pool['user']
  55 + pool2['group'] = node['nginx']['user'] unless pool['group']
43 56 pool2['listen'] =
44 57 node['cfe-nginx-php-fpm']['php_fastcgi_socket'] unless pool['listen']
45 58
... ...