Initial Chef repository

This commit is contained in:
Greg Karékinian
2015-07-21 19:45:23 +02:00
parent 7e5401fc71
commit ee4079fa85
1151 changed files with 185163 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: php
# Recipe:: default
#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
include_recipe "php::#{node['php']['install_method']}"
# update the main channels
php_pear_channel 'pear.php.net' do
action :update
end
php_pear_channel 'pecl.php.net' do
action :update
end
include_recipe "php::ini"

View File

@@ -0,0 +1,30 @@
#
# Author:: Christo De Lange (<opscode@dldinternet.com>)
# Cookbook Name:: php
# Recipe:: ini
#
# Copyright 2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
template "#{node['php']['conf_dir']}/php.ini" do
source node['php']['ini']['template']
cookbook node['php']['ini']['cookbook']
unless platform?('windows')
owner 'root'
group 'root'
mode '0644'
end
variables(:directives => node['php']['directives'])
end

View File

@@ -0,0 +1,37 @@
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: php
# Recipe:: module_apc
#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
case node['platform_family']
when 'rhel', 'fedora'
%w{ httpd-devel pcre pcre-devel }.each do |pkg|
package pkg do
action :install
end
end
php_pear 'APC' do
action :install
directives(:shm_size => '128M', :enable_cli => 0)
end
when 'debian'
package 'php-apc' do
action :install
end
end

View File

@@ -0,0 +1,29 @@
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: php
# Recipe:: module_curl
#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
case node['platform_family']
when 'rhel', 'fedora'
# centos php compiled with curl
when 'debian'
package 'php5-curl' do
action :upgrade
end
end

View File

@@ -0,0 +1,35 @@
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: php
# Recipe:: module_fpdf
#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
case node['platform_family']
when 'rhel', 'fedora'
pearhub_chan = php_pear_channel 'pearhub.org' do
action :discover
end
php_pear 'FPDF' do
channel pearhub_chan.channel_name
action :install
end
when 'debian'
package 'php-fpdf' do
action :install
end
end

View File

@@ -0,0 +1,32 @@
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: php
# Recipe:: module_gd
#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
pkg = value_for_platform(
%w(centos redhat scientific fedora amazon oracle) => {
el5_range => 'php53-gd',
'default' => 'php-gd'
},
'default' => 'php5-gd'
)
package pkg do
action :install
end

View File

@@ -0,0 +1,32 @@
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: php
# Recipe:: module_ldap
#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
pkg = value_for_platform(
%w(centos redhat scientific fedora amazon oracle) => {
el5_range => 'php53-ldap',
'default' => 'php-ldap'
},
'default' => 'php5-ldap'
)
package pkg do
action :install
end

View File

@@ -0,0 +1,37 @@
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: php
# Recipe:: module_memcache
#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
case node['platform_family']
when 'rhel', 'fedora'
%w{ zlib-devel }.each do |pkg|
package pkg do
action :install
end
end
php_pear 'memcache' do
action :install
# directives(:shm_size => "128M", :enable_cli => 0)
end
when 'debian'
package 'php5-memcache' do
action :install
end
end

View File

@@ -0,0 +1,32 @@
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: php
# Recipe:: module_mysql
#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
pkg = value_for_platform(
%w(centos redhat scientific fedora amazon oracle) => {
el5_range => 'php53-mysql',
'default' => 'php-mysql'
},
'default' => 'php5-mysql'
)
package pkg do
action :install
end

View File

@@ -0,0 +1,32 @@
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: php
# Recipe:: module_pgsql
#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
pkg = value_for_platform(
%w(centos redhat scientific fedora amazon oracle) => {
el5_range => 'php53-pgsql',
'default' => 'php-pgsql'
},
'default' => 'php5-pgsql'
)
package pkg do
action :install
end

View File

@@ -0,0 +1,29 @@
#
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: php
# Recipe:: module_sqlite3
#
# Copyright 2009-2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
case node['platform_family']
when 'rhel', 'fedora'
# already there in centos, --with-pdo-sqlite=shared
when 'debian'
package 'php5-sqlite' do
action :install
end
end

View File

@@ -0,0 +1,66 @@
#
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Author:: Lucas Hansen (<lucash@opscode.com>)
# Cookbook Name:: php
# Recipe:: package
#
# Copyright 2013, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
if platform?('windows')
include_recipe 'iis::mod_cgi'
install_dir = File.expand_path(node['php']['conf_dir']).gsub('/', '\\')
windows_package node['php']['windows']['msi_name'] do
source node['php']['windows']['msi_source']
installer_type :msi
options %W[
/quiet
INSTALLDIR="#{install_dir}"
ADDLOCAL=#{node['php']['packages'].join(',')}
].join(' ')
end
# WARNING: This is not the out-of-the-box go-pear.phar. It's been modified to patch this bug:
# http://pear.php.net/bugs/bug.php?id=16644
cookbook_file "#{node['php']['conf_dir']}/PEAR/go-pear.phar" do
source 'go-pear.phar'
end
template "#{node['php']['conf_dir']}/pear-options" do
source 'pear-options.erb'
end
execute 'install-pear' do
cwd node['php']['conf_dir']
command 'go-pear.bat < pear-options'
creates "#{node['php']['conf_dir']}/pear.bat"
end
ENV['PATH'] += ";#{install_dir}"
windows_path install_dir
else
node['php']['packages'].each do |pkg|
package pkg do
action :install
options node['php']['package_options']
end
end
end
include_recipe "php::ini"

View File

@@ -0,0 +1,85 @@
#
# Author:: Seth Chisamore (<schisamo@opscode.com>)
# Cookbook Name:: php
# Recipe:: package
#
# Copyright 2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
configure_options = node['php']['configure_options'].join(' ')
include_recipe 'build-essential'
include_recipe 'xml'
include_recipe 'mysql::client' if configure_options =~ /mysql/
include_recipe 'yum-epel' if node['platform_family'] == 'rhel'
pkgs = value_for_platform_family(
%w{ rhel fedora } => %w{ bzip2-devel libc-client-devel curl-devel freetype-devel gmp-devel libjpeg-devel krb5-devel libmcrypt-devel libpng-devel openssl-devel t1lib-devel mhash-devel },
%w{ debian ubuntu } => %w{ libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev },
'default' => %w{ libbz2-dev libc-client2007e-dev libcurl4-gnutls-dev libfreetype6-dev libgmp3-dev libjpeg62-dev libkrb5-dev libmcrypt-dev libpng12-dev libssl-dev libt1-dev }
)
pkgs.each do |pkg|
package pkg do
action :install
end
end
version = node['php']['version']
remote_file "#{Chef::Config[:file_cache_path]}/php-#{version}.tar.gz" do
source "#{node['php']['url']}/php-#{version}.tar.gz/from/this/mirror"
checksum node['php']['checksum']
mode '0644'
not_if "which #{node['php']['bin']}"
end
if node['php']['ext_dir']
directory node['php']['ext_dir'] do
owner 'root'
group 'root'
mode '0755'
recursive true
end
ext_dir_prefix = "EXTENSION_DIR=#{node['php']['ext_dir']}"
else
ext_dir_prefix = ''
end
bash 'build php' do
cwd Chef::Config[:file_cache_path]
code <<-EOF
tar -zxf php-#{version}.tar.gz
(cd php-#{version} && #{ext_dir_prefix} ./configure #{configure_options})
(cd php-#{version} && make && make install)
EOF
not_if "which #{node['php']['bin']}"
end
directory node['php']['conf_dir'] do
owner 'root'
group 'root'
mode '0755'
recursive true
end
directory node['php']['ext_conf_dir'] do
owner 'root'
group 'root'
mode '0755'
recursive true
end
include_recipe "php::ini"