Update cookbooks for Ubuntu 16.04 TLS
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
---
|
||||
driver:
|
||||
name: vagrant
|
||||
|
||||
provisioner:
|
||||
name: chef_solo
|
||||
|
||||
platforms:
|
||||
- name: ubuntu-12.04
|
||||
- name: centos-6.4
|
||||
- name: fedora-21
|
||||
|
||||
suites:
|
||||
- name: default
|
||||
run_list:
|
||||
- recipe[php-fpm::default]
|
||||
attributes:
|
||||
php-fpm:
|
||||
pools:
|
||||
- name: web
|
||||
listen: '127.0.0.1:9081'
|
||||
@@ -1 +0,0 @@
|
||||
1.9.3-p327
|
||||
@@ -1,3 +0,0 @@
|
||||
source "https://supermarket.getchef.com"
|
||||
|
||||
metadata
|
||||
@@ -1,20 +0,0 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'berkshelf'
|
||||
|
||||
# Uncomment these lines if you want to live on the Edge:
|
||||
#
|
||||
# group :development do
|
||||
# gem "berkshelf", github: "berkshelf/berkshelf"
|
||||
# gem "vagrant", github: "mitchellh/vagrant", tag: "v1.6.3"
|
||||
# end
|
||||
#
|
||||
# group :plugins do
|
||||
# gem "vagrant-berkshelf", github: "berkshelf/vagrant-berkshelf"
|
||||
# gem "vagrant-omnibus", github: "schisamo/vagrant-omnibus"
|
||||
# end
|
||||
|
||||
gem 'test-kitchen'
|
||||
gem 'kitchen-vagrant'
|
||||
gem 'stove'
|
||||
gem 'serverspec'
|
||||
@@ -1,179 +0,0 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (3.2.19)
|
||||
i18n (~> 0.6, >= 0.6.4)
|
||||
multi_json (~> 1.0)
|
||||
addressable (2.3.6)
|
||||
akami (1.2.2)
|
||||
gyoku (>= 0.4.0)
|
||||
nokogiri
|
||||
berkshelf (2.0.18)
|
||||
activesupport (~> 3.2.0)
|
||||
addressable (~> 2.3.4)
|
||||
buff-shell_out (~> 0.1)
|
||||
chozo (>= 0.6.1)
|
||||
faraday (~> 0.8.5)
|
||||
hashie (~> 2.0)
|
||||
minitar (~> 0.5.4)
|
||||
rbzip2 (~> 0.2.0)
|
||||
retryable (~> 1.3.3)
|
||||
ridley (~> 1.7.0)
|
||||
solve (~> 0.8.2)
|
||||
thor (~> 0.18.0)
|
||||
buff-config (0.4.0)
|
||||
buff-extensions (~> 0.3)
|
||||
varia_model (~> 0.1)
|
||||
buff-extensions (0.5.0)
|
||||
buff-ignore (1.1.1)
|
||||
buff-ruby_engine (0.1.0)
|
||||
buff-shell_out (0.2.0)
|
||||
buff-ruby_engine (~> 0.1.0)
|
||||
builder (3.2.2)
|
||||
celluloid (0.16.0)
|
||||
timers (~> 4.0.0)
|
||||
celluloid-io (0.16.1)
|
||||
celluloid (>= 0.16.0)
|
||||
nio4r (>= 1.0.0)
|
||||
chef-api (0.5.0)
|
||||
logify (~> 0.1)
|
||||
mime-types
|
||||
chozo (0.6.1)
|
||||
activesupport (>= 3.2.0)
|
||||
hashie (>= 2.0.2)
|
||||
multi_json (>= 1.3.0)
|
||||
diff-lcs (1.2.5)
|
||||
erubis (2.7.0)
|
||||
faraday (0.8.9)
|
||||
multipart-post (~> 1.2.0)
|
||||
ffi (1.9.6)
|
||||
gssapi (1.0.3)
|
||||
ffi (>= 1.0.1)
|
||||
gyoku (1.2.2)
|
||||
builder (>= 2.1.2)
|
||||
hashie (2.1.2)
|
||||
hitimes (1.2.2)
|
||||
httpclient (2.5.1)
|
||||
httpi (0.9.7)
|
||||
rack
|
||||
i18n (0.6.11)
|
||||
json (1.8.1)
|
||||
kitchen-vagrant (0.15.0)
|
||||
test-kitchen (~> 1.0)
|
||||
little-plugger (1.1.3)
|
||||
logging (1.8.2)
|
||||
little-plugger (>= 1.1.3)
|
||||
multi_json (>= 1.8.4)
|
||||
logify (0.2.0)
|
||||
mime-types (2.4.2)
|
||||
mini_portile (0.6.0)
|
||||
minitar (0.5.4)
|
||||
mixlib-authentication (1.3.0)
|
||||
mixlib-log
|
||||
mixlib-log (1.6.0)
|
||||
mixlib-shellout (1.6.1)
|
||||
multi_json (1.10.1)
|
||||
multipart-post (1.2.0)
|
||||
net-http-persistent (2.9.4)
|
||||
net-scp (1.2.1)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh (2.9.1)
|
||||
nio4r (1.0.1)
|
||||
nokogiri (1.6.3.1)
|
||||
mini_portile (= 0.6.0)
|
||||
nori (1.1.5)
|
||||
rack (1.5.2)
|
||||
rbzip2 (0.2.0)
|
||||
retryable (1.3.6)
|
||||
ridley (1.7.1)
|
||||
addressable
|
||||
buff-config (~> 0.2)
|
||||
buff-extensions (~> 0.3)
|
||||
buff-ignore (~> 1.1)
|
||||
buff-shell_out (~> 0.1)
|
||||
celluloid (~> 0.15)
|
||||
celluloid-io (~> 0.15)
|
||||
erubis
|
||||
faraday (>= 0.8.4)
|
||||
hashie (>= 2.0.2)
|
||||
json (>= 1.7.7)
|
||||
mixlib-authentication (>= 1.3.0)
|
||||
net-http-persistent (>= 2.8)
|
||||
net-ssh
|
||||
retryable
|
||||
solve (>= 0.4.4)
|
||||
varia_model (~> 0.1)
|
||||
winrm (~> 1.1.0)
|
||||
rspec (3.1.0)
|
||||
rspec-core (~> 3.1.0)
|
||||
rspec-expectations (~> 3.1.0)
|
||||
rspec-mocks (~> 3.1.0)
|
||||
rspec-core (3.1.7)
|
||||
rspec-support (~> 3.1.0)
|
||||
rspec-expectations (3.1.2)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.1.0)
|
||||
rspec-its (1.0.1)
|
||||
rspec-core (>= 2.99.0.beta1)
|
||||
rspec-expectations (>= 2.99.0.beta1)
|
||||
rspec-mocks (3.1.3)
|
||||
rspec-support (~> 3.1.0)
|
||||
rspec-support (3.1.2)
|
||||
rubyntlm (0.1.1)
|
||||
safe_yaml (1.0.4)
|
||||
savon (0.9.5)
|
||||
akami (~> 1.0)
|
||||
builder (>= 2.1.2)
|
||||
gyoku (>= 0.4.0)
|
||||
httpi (~> 0.9)
|
||||
nokogiri (>= 1.4.0)
|
||||
nori (~> 1.0)
|
||||
wasabi (~> 1.0)
|
||||
serverspec (2.3.1)
|
||||
multi_json
|
||||
rspec (~> 3.0)
|
||||
rspec-its
|
||||
specinfra (~> 2.3)
|
||||
solve (0.8.2)
|
||||
specinfra (2.3.0)
|
||||
net-scp
|
||||
net-ssh
|
||||
stove (3.2.3)
|
||||
chef-api (~> 0.5)
|
||||
logify (~> 0.2)
|
||||
test-kitchen (1.2.1)
|
||||
mixlib-shellout (~> 1.2)
|
||||
net-scp (~> 1.1)
|
||||
net-ssh (~> 2.7)
|
||||
safe_yaml (~> 1.0)
|
||||
thor (~> 0.18)
|
||||
thor (0.18.1)
|
||||
timers (4.0.1)
|
||||
hitimes
|
||||
uuidtools (2.1.5)
|
||||
varia_model (0.3.2)
|
||||
buff-extensions (~> 0.2)
|
||||
hashie (>= 2.0.2)
|
||||
wasabi (1.0.0)
|
||||
nokogiri (>= 1.4.0)
|
||||
winrm (1.1.3)
|
||||
gssapi (~> 1.0.0)
|
||||
httpclient (~> 2.2, >= 2.2.0.2)
|
||||
logging (~> 1.6, >= 1.6.1)
|
||||
nokogiri (~> 1.5)
|
||||
rubyntlm (~> 0.1.1)
|
||||
savon (= 0.9.5)
|
||||
uuidtools (~> 2.1.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
berkshelf
|
||||
kitchen-vagrant
|
||||
serverspec
|
||||
stove
|
||||
test-kitchen
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.3
|
||||
@@ -77,6 +77,57 @@ php_fpm_pool "www" do
|
||||
end
|
||||
```
|
||||
|
||||
Development
|
||||
===========
|
||||
|
||||
### Requirements
|
||||
|
||||
* [Docker](https://www.docker.com/)
|
||||
|
||||
### Setup
|
||||
|
||||
To get all dependencies:
|
||||
|
||||
```
|
||||
bundle install
|
||||
```
|
||||
|
||||
### Test
|
||||
|
||||
To see available platforms:
|
||||
|
||||
```
|
||||
bundle exec rake -T
|
||||
```
|
||||
|
||||
To test particular platform:
|
||||
|
||||
```
|
||||
bundle exec rake kitchen:default-ubuntu-1604
|
||||
```
|
||||
|
||||
To test all platforms:
|
||||
|
||||
```
|
||||
bundle exec rake kitchen:all
|
||||
```
|
||||
|
||||
### Publishing (maintainers only!)
|
||||
|
||||
Bump version in metadata.rb, commit and push to master!
|
||||
|
||||
```
|
||||
bundle exec rake publish
|
||||
```
|
||||
|
||||
as a result new tag will be created and pushed to github as well as new version
|
||||
will be published on https://supermarket.chef.io
|
||||
|
||||
Contributing
|
||||
===========
|
||||
|
||||
Please do not bump version when proposing a change, no other rules ;)
|
||||
|
||||
License and Author
|
||||
==================
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
begin
|
||||
require 'kitchen/rake_tasks'
|
||||
Kitchen::RakeTasks.new
|
||||
rescue LoadError
|
||||
puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI']
|
||||
end
|
||||
|
||||
begin
|
||||
require 'stove/rake_task'
|
||||
Stove::RakeTask.new
|
||||
rescue LoadErro
|
||||
pust ">>>>> Stove gem not loaded, omitting tasks" unless ENV['CI']
|
||||
end
|
||||
@@ -1,12 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
require 'bundler'
|
||||
require 'bundler/setup'
|
||||
require 'berkshelf/thor'
|
||||
|
||||
begin
|
||||
require 'kitchen/thor_tasks'
|
||||
Kitchen::ThorTasks.new
|
||||
rescue LoadError
|
||||
puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI']
|
||||
end
|
||||
90
cookbooks/php-fpm/Vagrantfile
vendored
90
cookbooks/php-fpm/Vagrantfile
vendored
@@ -1,90 +0,0 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
Vagrant.require_version ">= 1.5.0"
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
# All Vagrant configuration is done here. The most common configuration
|
||||
# options are documented and commented below. For a complete reference,
|
||||
# please see the online documentation at vagrantup.com.
|
||||
|
||||
config.vm.hostname = "php-fpm-berkshelf"
|
||||
|
||||
# Set the version of chef to install using the vagrant-omnibus plugin
|
||||
config.omnibus.chef_version = :latest
|
||||
|
||||
# Every Vagrant virtual environment requires a box to build off of.
|
||||
# If this value is a shorthand to a box in Vagrant Cloud then
|
||||
# config.vm.box_url doesn't need to be specified.
|
||||
# config.vm.box = "chef/ubuntu-14.04"
|
||||
case ENV['VMBOX']
|
||||
when 'centos65'
|
||||
config.vm.box = "opscode-centos-6.5"
|
||||
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box"
|
||||
else
|
||||
config.vm.box = "opscode-ubuntu-12.04"
|
||||
config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box"
|
||||
end
|
||||
|
||||
# The url from where the 'config.vm.box' box will be fetched if it
|
||||
# is not a Vagrant Cloud box and if it doesn't already exist on the
|
||||
# user's system.
|
||||
# config.vm.box_url = "https://vagrantcloud.com/chef/ubuntu-14.04/version/1/provider/virtualbox.box"
|
||||
|
||||
# Assign this VM to a host-only network IP, allowing you to access it
|
||||
# via the IP. Host-only networks can talk to the host machine as well as
|
||||
# any other machines on the same network, but cannot be accessed (through this
|
||||
# network interface) by any external networks.
|
||||
# config.vm.network :private_network, type: "dhcp"
|
||||
config.vm.network :private_network, ip: "33.33.33.10"
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine. In the example below,
|
||||
# accessing "localhost:8080" will access port 80 on the guest machine.
|
||||
|
||||
# Share an additional folder to the guest VM. The first argument is
|
||||
# the path on the host to the actual folder. The second argument is
|
||||
# the path on the guest to mount the folder. And the optional third
|
||||
# argument is a set of non-required options.
|
||||
# config.vm.synced_folder "../data", "/vagrant_data"
|
||||
|
||||
# Provider-specific configuration so you can fine-tune various
|
||||
# backing providers for Vagrant. These expose provider-specific options.
|
||||
# Example for VirtualBox:
|
||||
#
|
||||
# config.vm.provider :virtualbox do |vb|
|
||||
# # Don't boot with headless mode
|
||||
# vb.gui = true
|
||||
#
|
||||
# # Use VBoxManage to customize the VM. For example to change memory:
|
||||
# vb.customize ["modifyvm", :id, "--memory", "1024"]
|
||||
# end
|
||||
#
|
||||
# View the documentation for the provider you're using for more
|
||||
# information on available options.
|
||||
|
||||
# The path to the Berksfile to use with Vagrant Berkshelf
|
||||
# config.berkshelf.berksfile_path = "./Berksfile"
|
||||
|
||||
# Enabling the Berkshelf plugin. To enable this globally, add this configuration
|
||||
# option to your ~/.vagrant.d/Vagrantfile file
|
||||
config.berkshelf.enabled = true
|
||||
|
||||
# An array of symbols representing groups of cookbook described in the Vagrantfile
|
||||
# to exclusively install and copy to Vagrant's shelf.
|
||||
# config.berkshelf.only = []
|
||||
|
||||
# An array of symbols representing groups of cookbook described in the Vagrantfile
|
||||
# to skip installing and copying to Vagrant's shelf.
|
||||
# config.berkshelf.except = []
|
||||
|
||||
config.vm.provision :chef_solo do |chef|
|
||||
chef.run_list = [
|
||||
"recipe[apt]",
|
||||
"recipe[php-fpm::default]"
|
||||
]
|
||||
end
|
||||
end
|
||||
@@ -10,15 +10,22 @@ when "rhel", "fedora"
|
||||
else
|
||||
user = "www-data"
|
||||
group = "www-data"
|
||||
conf_dir = "/etc/php5/fpm/conf.d"
|
||||
pool_conf_dir = "/etc/php5/fpm/pool.d"
|
||||
if node.platform == "ubuntu" and node.platform_version.to_f <= 10.04
|
||||
conf_file = "/etc/php5/fpm/php5-fpm.conf"
|
||||
if platform?('ubuntu') and node.platform_version.to_f >= 16.04
|
||||
php_conf_dir = "/etc/php/7.0"
|
||||
php_fpm_name = "php7.0-fpm"
|
||||
else
|
||||
conf_file = "/etc/php5/fpm/php-fpm.conf"
|
||||
php_conf_dir = "/etc/php5"
|
||||
php_fpm_name = "php5-fpm"
|
||||
end
|
||||
error_log = "/var/log/php5-fpm.log"
|
||||
pid ="/var/run/php5-fpm.pid"
|
||||
conf_dir = "#{php_conf_dir}/fpm/conf.d"
|
||||
pool_conf_dir = "#{php_conf_dir}/fpm/pool.d"
|
||||
if node.platform == "ubuntu" and node.platform_version.to_f <= 10.04
|
||||
conf_file = "#{php_conf_dir}/fpm/php5-fpm.conf"
|
||||
else
|
||||
conf_file = "#{php_conf_dir}/fpm/php-fpm.conf"
|
||||
end
|
||||
error_log = "/var/log/#{php_fpm_name}.log"
|
||||
pid = "/var/run/#{php_fpm_name}.pid"
|
||||
end
|
||||
|
||||
default['php-fpm']['user'] = user
|
||||
@@ -28,11 +35,23 @@ default['php-fpm']['pool_conf_dir'] = pool_conf_dir
|
||||
default['php-fpm']['conf_file'] = conf_file
|
||||
default['php-fpm']['pid'] = pid
|
||||
default['php-fpm']['log_dir'] = '/var/log/php-fpm'
|
||||
default['php-fpm']['error_log'] = error_log
|
||||
default['php-fpm']['error_log'] = error_log
|
||||
default['php-fpm']['log_level'] = "notice"
|
||||
default['php-fpm']['emergency_restart_threshold'] = 0
|
||||
default['php-fpm']['emergency_restart_interval'] = 0
|
||||
default['php-fpm']['process_control_timeout'] = 0
|
||||
default['php-fpm']['process_manager'] = 'ondemand'
|
||||
default['php-fpm']['max_children'] = 50
|
||||
default['php-fpm']['start_servers'] = 5
|
||||
default['php-fpm']['min_spare_servers'] = 5
|
||||
default['php-fpm']['max_spare_servers'] = 35
|
||||
default['php-fpm']['max_requests'] = 0
|
||||
default['php-fpm']['request_terminate_timeout'] = 0
|
||||
default['php-fpm']['catch_workers_output'] = 'no'
|
||||
default['php-fpm']['security_limit_extensions'] = '.php'
|
||||
default['php-fpm']['listen_mode'] = '0660'
|
||||
default['php-fpm']['listen'] = "/var/run/php-fpm-%{pool_name}.sock"
|
||||
|
||||
default['php-fpm']['pools'] = {
|
||||
"www" => {
|
||||
:enable => true
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
# Put files/directories that should be ignored in this file when uploading
|
||||
# or sharing to the community site.
|
||||
# Lines that start with '# ' are comments.
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
Icon?
|
||||
nohup.out
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# SASS #
|
||||
########
|
||||
.sass-cache
|
||||
|
||||
# EDITORS #
|
||||
###########
|
||||
\#*
|
||||
.#*
|
||||
*~
|
||||
*.sw[a-z]
|
||||
*.bak
|
||||
REVISION
|
||||
TAGS*
|
||||
tmtags
|
||||
*_flymake.*
|
||||
*_flymake
|
||||
*.tmproj
|
||||
.project
|
||||
.settings
|
||||
mkmf.log
|
||||
|
||||
## COMPILED ##
|
||||
##############
|
||||
a.out
|
||||
*.o
|
||||
*.pyc
|
||||
*.so
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*/rdoc/
|
||||
|
||||
# Testing #
|
||||
###########
|
||||
.watchr
|
||||
.rspec
|
||||
spec/*
|
||||
spec/fixtures/*
|
||||
test/*
|
||||
features/*
|
||||
Guardfile
|
||||
Procfile
|
||||
|
||||
# SCM #
|
||||
#######
|
||||
.git
|
||||
*/.git
|
||||
.gitignore
|
||||
.gitmodules
|
||||
.gitconfig
|
||||
.gitattributes
|
||||
.svn
|
||||
*/.bzr/*
|
||||
*/.hg/*
|
||||
*/.svn/*
|
||||
|
||||
# Berkshelf #
|
||||
#############
|
||||
Berksfile
|
||||
Berksfile.lock
|
||||
cookbooks/*
|
||||
tmp
|
||||
|
||||
# Cookbooks #
|
||||
#############
|
||||
CONTRIBUTING
|
||||
CHANGELOG*
|
||||
|
||||
# Strainer #
|
||||
############
|
||||
Colanderfile
|
||||
Strainerfile
|
||||
.colander
|
||||
.strainer
|
||||
|
||||
# Vagrant #
|
||||
###########
|
||||
.vagrant
|
||||
Vagrantfile
|
||||
|
||||
# Travis #
|
||||
##########
|
||||
.travis.yml
|
||||
|
||||
# Other #
|
||||
##########
|
||||
.sandbox
|
||||
.bundle
|
||||
@@ -33,24 +33,26 @@ define :php_fpm_pool, :template => "pool.conf.erb", :enable => true do
|
||||
cookbook params[:cookbook] || "php-fpm"
|
||||
variables(
|
||||
:pool_name => pool_name,
|
||||
:listen => params[:listen],
|
||||
:listen => params[:listen] || node['php-fpm']['listen'].gsub(%r[%{pool_name}], pool_name),
|
||||
:listen_owner => params[:listen_owner] || node['php-fpm']['listen_owner'] || node['php-fpm']['user'],
|
||||
:listen_group => params[:listen_group] || node['php-fpm']['listen_group'] || node['php-fpm']['group'],
|
||||
:listen_mode => params[:listen_mode] || node['php-fpm']['listen_mode'],
|
||||
:allowed_clients => params[:allowed_clients],
|
||||
:user => params[:user],
|
||||
:group => params[:group],
|
||||
:process_manager => params[:process_manager],
|
||||
:max_children => params[:max_children],
|
||||
:start_servers => params[:start_servers],
|
||||
:min_spare_servers => params[:min_spare_servers],
|
||||
:max_spare_servers => params[:max_spare_servers],
|
||||
:max_requests => params[:max_requests],
|
||||
:catch_workers_output => params[:catch_workers_output],
|
||||
:user => params[:user] || node['php-fpm']['user'],
|
||||
:group => params[:group] || node['php-fpm']['group'],
|
||||
:process_manager => params[:process_manager] || node['php-fpm']['process_manager'],
|
||||
:max_children => params[:max_children] || node['php-fpm']['max_children'],
|
||||
:start_servers => params[:start_servers] || node['php-fpm']['start_servers'],
|
||||
:min_spare_servers => params[:min_spare_servers] || node['php-fpm']['min_spare_servers'],
|
||||
:max_spare_servers => params[:max_spare_servers] || node['php-fpm']['max_spare_servers'],
|
||||
:max_requests => params[:max_requests] || node['php-fpm']['max_requests'],
|
||||
:catch_workers_output => params[:catch_workers_output] || node['php-fpm']['catch_workers_output'],
|
||||
:security_limit_extensions => params[:security_limit_extensions] || node['php-fpm']['security_limit_extensions'],
|
||||
:access_log => params[:access_log] || false,
|
||||
:slowlog => params[:slowlog] || false,
|
||||
:request_slowlog_timeout => params[:request_slowlog_timeout] || false,
|
||||
:php_options => params[:php_options] || {},
|
||||
:request_terminate_timeout => params[:request_terminate_timeout],
|
||||
:request_terminate_timeout => params[:request_terminate_timeout] || node['php-fpm']['request_terminate_timeout'],
|
||||
:params => params
|
||||
)
|
||||
notifies :restart, "service[php-fpm]"
|
||||
|
||||
37
cookbooks/php-fpm/metadata.json
Normal file
37
cookbooks/php-fpm/metadata.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "php-fpm",
|
||||
"version": "0.7.8",
|
||||
"description": "Installs/Configures php-fpm",
|
||||
"long_description": "Description\n===========\n\nInstalls and configures PHP-FPM (FastCGI Process Manager), an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites. It's like the `unicorn` of the PHP world dawg.\n\nRequirements\n============\n\nPlatform\n--------\n\n* Debian, Ubuntu\n* CentOS, Red Hat, Fedora\n* Amazon Linux\n\nCookbooks\n---------\n\n* apt (leverages apt_repository LWRP)\n* yum (leverages yum_repository LWRP)\n\nThe `apt_repository` and `yum_repository` LWRPs are used from these cookbooks to create the proper repository entries so the php-fpm package downloaded and installed.\n\nDescription\n==========\n\nCreates a PHP-FPM configuration file at the path specified. Meant to be deployed with a service init scheme/supervisor such as runit. Please see the `application::php-fpm` recipe for a complete working example. In depth information about PHP-FPM's configuration values can be [found in the PHP-FPM documentation](http://php.net/manual/en/install.fpm.configuration.php).\n\nUsage\n=====\nSimply include the recipe where you want PHP-FPM installed. Default pool __www__ will be created. To disable pool creation set default['php-fpm']['pools'] to false.\n\nTo customize settings and pools you can override default attributes.\n\n### Usage in roles:\n```ruby\nname \"php-fpm\"\ndescription \"php fpm role\"\nrun_list \"recipe[php-fpm]\"\noverride_attributes \"php-fpm\" => {\n\t\"pools\" => {\n\t\t\"default\" => {\n\t\t\t:enable => true\n\t\t},\n\t\t\"www\" => {\n\t\t\t:enable => \"true\",\n\t\t\t:cookbook => \"another-cookbook\",\n\t\t\t:process_manager => \"dynamic\",\n\t\t\t:max_requests => 5000,\n\t\t\t:php_options => { 'php_admin_flag[log_errors]' => 'on', 'php_admin_value[memory_limit]' => '32M' }\n\t\t}\n\t}\n}\n```\n\nCreating pools in recipes\n=========================\n### Create PHP-FPM pool named 'www' with default settings:\n```ruby\nphp_fpm_pool \"www\"\n```\n\n### Create PHP-FPM pool named 'www' with custom settings:\n```ruby\nphp_fpm_pool \"www\" do\n cookbook \"another-cookbook\" # get template from another cookbook\n process_manager \"dynamic\"\n max_requests 5000\n php_options 'php_admin_flag[log_errors]' => 'on', 'php_admin_value[memory_limit]' => '32M'\nend\n```\n\n### Delete PHP-FPM pool named 'www':\n```ruby\nphp_fpm_pool \"www\" do\n enable false\nend\n```\n\nDevelopment\n===========\n\n### Requirements\n\n* [Docker](https://www.docker.com/)\n\n### Setup\n\nTo get all dependencies:\n\n```\nbundle install\n```\n\n### Test\n\nTo see available platforms:\n\n```\nbundle exec rake -T\n```\n\nTo test particular platform:\n\n```\nbundle exec rake kitchen:default-ubuntu-1604\n```\n\nTo test all platforms:\n\n```\nbundle exec rake kitchen:all\n```\n\n### Publishing (maintainers only!)\n\nBump version in metadata.rb, commit and push to master!\n\n```\nbundle exec rake publish\n```\n\nas a result new tag will be created and pushed to github as well as new version\nwill be published on https://supermarket.chef.io\n\nContributing\n===========\n\nPlease do not bump version when proposing a change, no other rules ;)\n\nLicense and Author\n==================\n\nAuthor:: Seth Chisamore (<schisamo@opscode.com>)\n\nCopyright:: 2011, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
|
||||
"maintainer": "Opscode, Inc.",
|
||||
"maintainer_email": "cookbooks@opscode.com",
|
||||
"license": "Apache 2.0",
|
||||
"platforms": {
|
||||
"debian": ">= 0.0.0",
|
||||
"ubuntu": ">= 0.0.0",
|
||||
"centos": ">= 0.0.0",
|
||||
"redhat": ">= 0.0.0",
|
||||
"fedora": ">= 0.0.0",
|
||||
"amazon": ">= 0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"apt": ">= 0.0.0",
|
||||
"yum": ">= 3.0"
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
name "php-fpm"
|
||||
maintainer "Opscode, Inc."
|
||||
maintainer_email "cookbooks@opscode.com"
|
||||
license "Apache 2.0"
|
||||
description "Installs/Configures php-fpm"
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "0.7.5"
|
||||
|
||||
depends "apt"
|
||||
depends "yum", ">= 3.0"
|
||||
|
||||
%w{ debian ubuntu centos redhat fedora amazon }.each do |os|
|
||||
supports os
|
||||
end
|
||||
@@ -24,6 +24,8 @@ include_recipe 'apt::default' if node['platform_family'] == 'debian'
|
||||
if node['php-fpm']['package_name'].nil?
|
||||
if platform_family?("rhel", "fedora")
|
||||
php_fpm_package_name = "php-fpm"
|
||||
elsif platform?('ubuntu') and node['platform_version'].to_f >= 16.04
|
||||
php_fpm_package_name = "php7.0-fpm"
|
||||
else
|
||||
php_fpm_package_name = "php5-fpm"
|
||||
end
|
||||
@@ -42,9 +44,16 @@ else
|
||||
php_fpm_service_name = node['php-fpm']['service_name']
|
||||
end
|
||||
|
||||
service_provider = nil
|
||||
# this is actually already done in chef, but is kept here for older chef releases
|
||||
if platform?('ubuntu') and node['platform_version'].to_f.between?(13.10, 14.10)
|
||||
service_provider = ::Chef::Provider::Service::Upstart
|
||||
end
|
||||
|
||||
directory node['php-fpm']['log_dir']
|
||||
|
||||
service "php-fpm" do
|
||||
provider service_provider if service_provider
|
||||
service_name php_fpm_service_name
|
||||
supports :start => true, :stop => true, :restart => true, :reload => true
|
||||
action [ :enable, :start ]
|
||||
|
||||
@@ -38,10 +38,18 @@ when 'debian'
|
||||
# Configure Dotdeb repos
|
||||
# TODO: move this to it's own 'dotdeb' cookbook?
|
||||
# http://www.dotdeb.org/instructions/
|
||||
if node.platform_version.to_f >= 7.0
|
||||
if node.platform_version.to_f >= 8.0
|
||||
apt_repository "dotdeb" do
|
||||
uri node['php-fpm']['dotdeb_repository']['uri']
|
||||
distribution "stable"
|
||||
distribution "jessie"
|
||||
components ['all']
|
||||
key node['php-fpm']['dotdeb_repository']['key']
|
||||
action :add
|
||||
end
|
||||
elsif node.platform_version.to_f >= 7.0
|
||||
apt_repository "dotdeb" do
|
||||
uri node['php-fpm']['dotdeb_repository']['uri']
|
||||
distribution "wheezy"
|
||||
components ['all']
|
||||
key node['php-fpm']['dotdeb_repository']['key']
|
||||
action :add
|
||||
|
||||
3
cookbooks/php-fpm/recipes/test.rb
Normal file
3
cookbooks/php-fpm/recipes/test.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
include_recipe 'php-fpm::default'
|
||||
|
||||
package 'net-tools'
|
||||
@@ -19,8 +19,8 @@
|
||||
; Unix user/group of processes
|
||||
; Note: The user is mandatory. If the group is not set, the default user's group
|
||||
; will be used.
|
||||
user = <%= @user || node['php-fpm']['user'] %>
|
||||
group = <%= @group || node['php-fpm']['group'] %>
|
||||
user = <%= @user %>
|
||||
group = <%= @group %>
|
||||
|
||||
; The address on which to accept FastCGI requests.
|
||||
; Valid syntaxes are:
|
||||
@@ -30,7 +30,7 @@ group = <%= @group || node['php-fpm']['group'] %>
|
||||
; specific port;
|
||||
; '/path/to/unix/socket' - to listen on a unix socket.
|
||||
; Note: This value is mandatory.
|
||||
listen = <%= @listen || "/var/run/php-fpm-#{@pool_name}.sock" %>
|
||||
listen = <%= @listen %>
|
||||
|
||||
; Set listen(2) backlog.
|
||||
; Default Value: 128 (-1 on FreeBSD and OpenBSD)
|
||||
@@ -52,7 +52,7 @@ listen.owner = <%= @listen_owner %>
|
||||
listen.group = <%= @listen_group %>
|
||||
<% end %>
|
||||
|
||||
listen.mode = <%= @listen_mode || "0660" %>
|
||||
listen.mode = <%= @listen_mode %>
|
||||
|
||||
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
|
||||
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
|
||||
@@ -94,7 +94,7 @@ listen.allowed_clients = <%= @allowed_clients ? ([@allowed_clients].flatten.join
|
||||
; pm.process_idle_timeout - The number of seconds after which
|
||||
; an idle process will be killed.
|
||||
; Note: This value is mandatory.
|
||||
pm = <%= @process_manager || "ondemand" %>
|
||||
pm = <%= @process_manager %>
|
||||
|
||||
; The number of child processes to be created when pm is set to 'static' and the
|
||||
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
|
||||
@@ -105,7 +105,7 @@ pm = <%= @process_manager || "ondemand" %>
|
||||
; forget to tweak pm.* to fit your needs.
|
||||
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
|
||||
; Note: This value is mandatory.
|
||||
pm.max_children = <%= @max_children || 50 %>
|
||||
pm.max_children = <%= @max_children %>
|
||||
|
||||
<% if @process_manager == "dynamic" %>
|
||||
; The number of child processes created on startup.
|
||||
@@ -118,12 +118,12 @@ pm.start_servers = <%= @start_servers %>
|
||||
; The desired minimum number of idle server processes.
|
||||
; Note: Used only when pm is set to 'dynamic'
|
||||
; Note: Mandatory when pm is set to 'dynamic'
|
||||
pm.min_spare_servers = <%= @min_spare_servers || 5 %>
|
||||
pm.min_spare_servers = <%= @min_spare_servers %>
|
||||
|
||||
; The desired maximum number of idle server processes.
|
||||
; Note: Used only when pm is set to 'dynamic'
|
||||
; Note: Mandatory when pm is set to 'dynamic'
|
||||
pm.max_spare_servers = <%= @max_spare_servers || 35 %>
|
||||
pm.max_spare_servers = <%= @max_spare_servers %>
|
||||
<% end %>
|
||||
|
||||
<% if @process_manager == "ondemand" %>
|
||||
@@ -137,7 +137,7 @@ pm.max_spare_servers = <%= @max_spare_servers || 35 %>
|
||||
; This can be useful to work around memory leaks in 3rd party libraries. For
|
||||
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
|
||||
; Default Value: 0
|
||||
pm.max_requests = <%= @max_requests || 500 %>
|
||||
pm.max_requests = <%= @max_requests %>
|
||||
|
||||
; The URI to view the FPM status page. If this value is not set, no URI will be
|
||||
; recognized as a status page. It shows the following informations:
|
||||
@@ -319,20 +319,28 @@ access.log = <%= node['php-fpm']['log_dir'] %>/$pool.access.log
|
||||
; The log file for slow requests
|
||||
; Default Value: not set
|
||||
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
||||
<% if @slowlog %>
|
||||
slowlog = <%= @slowlog %>
|
||||
<% else %>
|
||||
;slowlog = log/$pool.log.slow
|
||||
<% end %>
|
||||
|
||||
; The timeout for serving a single request after which a PHP backtrace will be
|
||||
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
|
||||
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
||||
; Default Value: 0
|
||||
<% if @request_slowlog_timeout %>
|
||||
request_slowlog_timeout = <%=@request_slowlog_timeout %>
|
||||
<% else %>
|
||||
;request_slowlog_timeout = 0
|
||||
<% end %>
|
||||
|
||||
; The timeout for serving a single request after which the worker process will
|
||||
; be killed. This option should be used when the 'max_execution_time' ini option
|
||||
; does not stop script execution for some reason. A value of '0' means 'off'.
|
||||
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
||||
; Default Value: 0
|
||||
request_terminate_timeout = <%=@request_terminate_timeout || 0 %>
|
||||
request_terminate_timeout = <%=@request_terminate_timeout %>
|
||||
|
||||
; Set open file descriptor rlimit.
|
||||
; Default Value: system defined value
|
||||
@@ -364,7 +372,7 @@ request_terminate_timeout = <%=@request_terminate_timeout || 0 %>
|
||||
; Note: on highloaded environement, this can cause some delay in the page
|
||||
; process time (several ms).
|
||||
; Default Value: no
|
||||
catch_workers_output = <%= @catch_workers_output || "no" %>
|
||||
catch_workers_output = <%= @catch_workers_output %>
|
||||
|
||||
<% if node['platform'] != 'ubuntu' && node['platform_version'] != '10.04' %>
|
||||
; Limits the extensions of the main script FPM will allow to parse. This can
|
||||
@@ -374,7 +382,7 @@ catch_workers_output = <%= @catch_workers_output || "no" %>
|
||||
; Note: set an empty value to allow all extensions.
|
||||
; Default Value: .php
|
||||
;security.limit_extensions = .php .php3 .php4 .php5
|
||||
security.limit_extensions = <%=@security_limit_extensions || ".php" %>
|
||||
security.limit_extensions = <%=@security_limit_extensions %>
|
||||
<% end %>
|
||||
|
||||
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
require 'serverspec'
|
||||
|
||||
set :backend, :exec
|
||||
|
||||
describe port(9081) do
|
||||
it { should be_listening }
|
||||
end
|
||||
Reference in New Issue
Block a user