server_maint 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/.gitmodules +12 -0
  2. data/lib/cookbooks/apt/.gitignore +4 -0
  3. data/lib/cookbooks/apt/CHANGELOG.md +25 -0
  4. data/lib/cookbooks/apt/CONTRIBUTING +29 -0
  5. data/lib/cookbooks/apt/Gemfile +3 -0
  6. data/lib/cookbooks/apt/LICENSE +201 -0
  7. data/lib/cookbooks/apt/README.md +193 -0
  8. data/lib/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
  9. data/lib/cookbooks/apt/metadata.rb +13 -0
  10. data/lib/cookbooks/apt/providers/preference.rb +52 -0
  11. data/lib/cookbooks/apt/providers/repository.rb +128 -0
  12. data/lib/cookbooks/apt/recipes/cacher-client.rb +54 -0
  13. data/lib/cookbooks/apt/recipes/cacher-ng.rb +30 -0
  14. data/lib/cookbooks/apt/recipes/default.rb +68 -0
  15. data/lib/cookbooks/apt/resources/preference.rb +29 -0
  16. data/lib/cookbooks/apt/resources/repository.rb +39 -0
  17. data/lib/cookbooks/apt/test/kitchen/Kitchenfile +3 -0
  18. data/lib/cookbooks/php/.gitignore +4 -0
  19. data/lib/cookbooks/php/CHANGELOG.md +14 -0
  20. data/lib/cookbooks/php/CONTRIBUTING +29 -0
  21. data/lib/cookbooks/php/Gemfile +3 -0
  22. data/lib/cookbooks/php/LICENSE +201 -0
  23. data/lib/cookbooks/php/README.md +253 -0
  24. data/lib/cookbooks/php/attributes/default.rb +86 -0
  25. data/lib/cookbooks/php/metadata.rb +27 -0
  26. data/lib/cookbooks/php/providers/pear.rb +261 -0
  27. data/lib/cookbooks/php/providers/pear_channel.rb +90 -0
  28. data/lib/cookbooks/php/recipes/default.rb +31 -0
  29. data/lib/cookbooks/php/recipes/module_apc.rb +37 -0
  30. data/lib/cookbooks/php/recipes/module_curl.rb +29 -0
  31. data/lib/cookbooks/php/recipes/module_fileinfo.rb +29 -0
  32. data/lib/cookbooks/php/recipes/module_fpdf.rb +35 -0
  33. data/lib/cookbooks/php/recipes/module_gd.rb +32 -0
  34. data/lib/cookbooks/php/recipes/module_ldap.rb +32 -0
  35. data/lib/cookbooks/php/recipes/module_memcache.rb +37 -0
  36. data/lib/cookbooks/php/recipes/module_mysql.rb +32 -0
  37. data/lib/cookbooks/php/recipes/module_pgsql.rb +32 -0
  38. data/lib/cookbooks/php/recipes/module_sqlite3.rb +30 -0
  39. data/lib/cookbooks/php/recipes/package.rb +43 -0
  40. data/lib/cookbooks/php/recipes/source.rb +79 -0
  41. data/lib/cookbooks/php/resources/pear.rb +30 -0
  42. data/lib/cookbooks/php/resources/pear_channel.rb +29 -0
  43. data/lib/cookbooks/php/templates/centos/php.ini.erb +1225 -0
  44. data/lib/cookbooks/php/templates/debian/php.ini.erb +1857 -0
  45. data/lib/cookbooks/php/templates/default/extension.ini.erb +7 -0
  46. data/lib/cookbooks/php/templates/default/php.ini.erb +1900 -0
  47. data/lib/cookbooks/php/templates/redhat/php.ini.erb +1225 -0
  48. data/lib/cookbooks/php/templates/ubuntu/php.ini.erb +1857 -0
  49. data/lib/cookbooks/php/test/kitchen/Kitchenfile +3 -0
  50. data/lib/cookbooks/php-fpm/.gitignore +1 -0
  51. data/lib/cookbooks/php-fpm/README.md +65 -0
  52. data/lib/cookbooks/php-fpm/metadata.rb +14 -0
  53. data/lib/cookbooks/php-fpm/recipes/default.rb +98 -0
  54. data/lib/cookbooks/yum/.gitignore +1 -0
  55. data/lib/cookbooks/yum/CHANGELOG.md +48 -0
  56. data/lib/cookbooks/yum/CONTRIBUTING +29 -0
  57. data/lib/cookbooks/yum/Gemfile +3 -0
  58. data/lib/cookbooks/yum/LICENSE +201 -0
  59. data/lib/cookbooks/yum/README.md +197 -0
  60. data/lib/cookbooks/yum/attributes/default.rb +37 -0
  61. data/lib/cookbooks/yum/metadata.rb +36 -0
  62. data/lib/cookbooks/yum/providers/key.rb +74 -0
  63. data/lib/cookbooks/yum/providers/repository.rb +111 -0
  64. data/lib/cookbooks/yum/recipes/default.rb +18 -0
  65. data/lib/cookbooks/yum/recipes/epel.rb +55 -0
  66. data/lib/cookbooks/yum/recipes/ius.rb +40 -0
  67. data/lib/cookbooks/yum/recipes/repoforge.rb +48 -0
  68. data/lib/cookbooks/yum/recipes/yum.rb +23 -0
  69. data/lib/cookbooks/yum/resources/key.rb +24 -0
  70. data/lib/cookbooks/yum/resources/repository.rb +38 -0
  71. data/lib/cookbooks/yum/templates/default/repo.erb +29 -0
  72. data/lib/cookbooks/yum/templates/default/yum-rhel5.conf.erb +33 -0
  73. data/lib/cookbooks/yum/templates/default/yum-rhel6.conf.erb +36 -0
  74. data/lib/cookbooks/yum/test/kitchen/Kitchenfile +23 -0
  75. data/lib/server_maint/version.rb +1 -1
  76. metadata +77 -4
@@ -0,0 +1,90 @@
1
+ #
2
+ # Author:: Seth Chisamore <schisamo@opscode.com>
3
+ # Cookbook Name:: php
4
+ # Provider:: pear_channel
5
+ #
6
+ # Copyright:: 2011, Opscode, Inc <legal@opscode.com>
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ # http://pear.php.net/manual/en/guide.users.commandline.channels.php
22
+
23
+ require 'chef/mixin/shell_out'
24
+ require 'chef/mixin/language'
25
+ include Chef::Mixin::ShellOut
26
+
27
+ action :discover do
28
+ unless exists?
29
+ Chef::Log.info("Discovering pear channel #{@new_resource}")
30
+ execute "pear channel-discover #{@new_resource.channel_name}" do
31
+ action :run
32
+ end
33
+ new_resource.updated_by_last_action(true)
34
+ end
35
+ end
36
+
37
+ action :add do
38
+ unless exists?
39
+ Chef::Log.info("Adding pear channel #{@new_resource} from #{@new_resource.channel_xml}")
40
+ execute "pear channel-add #{@new_resource.channel_xml}" do
41
+ action :run
42
+ end
43
+ new_resource.updated_by_last_action(true)
44
+ end
45
+ end
46
+
47
+ action :update do
48
+ if exists?
49
+ update_needed = false
50
+ begin
51
+ updated_needed = true if shell_out("pear search -c #{@new_resource.channel_name} NNNNNN").stdout =~ /channel-update/
52
+ rescue Chef::Exceptions::CommandTimeout
53
+ # CentOS can hang on 'pear search' if a channel needs updating
54
+ Chef::Log.info("Timed out checking if channel-update needed...forcing update of pear channel #{@new_resource}")
55
+ update_needed = true
56
+ end
57
+ if update_needed
58
+ Chef::Log.info("Updating pear channel #{@new_resource}")
59
+ shell_out!("pear channel-update #{@new_resource.channel_name}")
60
+ new_resource.updated_by_last_action(true)
61
+ end
62
+ end
63
+ end
64
+
65
+ action :remove do
66
+ if exists?
67
+ Chef::Log.info("Deleting pear channel #{@new_resource}")
68
+ execute "pear channel-delete #{@new_resource.channel_name}" do
69
+ action :run
70
+ end
71
+ new_resource.updated_by_last_action(true)
72
+ end
73
+ end
74
+
75
+ def load_current_resource
76
+ @current_resource = Chef::Resource::PhpPearChannel.new(@new_resource.name)
77
+ @current_resource.channel_name(@new_resource.channel_name)
78
+ @current_resource
79
+ end
80
+
81
+ private
82
+ def exists?
83
+ begin
84
+ shell_out!("pear channel-info #{@current_resource.channel_name}")
85
+ true
86
+ rescue Chef::Exceptions::ShellCommandFailed
87
+ rescue Mixlib::ShellOut::ShellCommandFailed
88
+ false
89
+ end
90
+ end
@@ -0,0 +1,31 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Cookbook Name:: php
5
+ # Recipe:: default
6
+ #
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ include_recipe "php::#{node['php']['install_method']}"
23
+
24
+ # update the main channels
25
+ php_pear_channel 'pear.php.net' do
26
+ action :update
27
+ end
28
+
29
+ php_pear_channel 'pecl.php.net' do
30
+ action :update
31
+ end
@@ -0,0 +1,37 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Cookbook Name:: php
5
+ # Recipe:: module_apc
6
+ #
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ case node['platform_family']
23
+ when "rhel", "fedora"
24
+ %w{ httpd-devel pcre pcre-devel }.each do |pkg|
25
+ package pkg do
26
+ action :install
27
+ end
28
+ end
29
+ php_pear "apc" do
30
+ action :install
31
+ directives(:shm_size => "128M", :enable_cli => 0)
32
+ end
33
+ when "debian"
34
+ package "php-apc" do
35
+ action :install
36
+ end
37
+ end
@@ -0,0 +1,29 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Cookbook Name:: php
5
+ # Recipe:: module_curl
6
+ #
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ case node['platform_family']
23
+ when "rhel", "fedora"
24
+ # centos php compiled with curl
25
+ when "debian"
26
+ package "php5-curl" do
27
+ action :upgrade
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Cookbook Name:: php
5
+ # Recipe:: module_fileinfo
6
+ #
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ case node['platform_family']
23
+ when "rhel", "fedora"
24
+ # enabled by default in php53
25
+ when "debian"
26
+ package "php5-fileinfo" do
27
+ action :upgrade
28
+ end
29
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Cookbook Name:: php
5
+ # Recipe:: module_fpdf
6
+ #
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ case node['platform_family']
23
+ when "rhel", "fedora"
24
+ pearhub_chan = php_pear_channel "pearhub.org" do
25
+ action :discover
26
+ end
27
+ php_pear "FPDF" do
28
+ channel pearhub_chan.channel_name
29
+ action :install
30
+ end
31
+ when "debian"
32
+ package "php-fpdf" do
33
+ action :install
34
+ end
35
+ end
@@ -0,0 +1,32 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Cookbook Name:: php
5
+ # Recipe:: module_gd
6
+ #
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ pkg = value_for_platform(
23
+ %w(centos redhat scientific fedora) => {
24
+ %w(5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8) => "php53-gd",
25
+ "default" => "php-gd"
26
+ },
27
+ "default" => "php5-gd"
28
+ )
29
+
30
+ package pkg do
31
+ action :install
32
+ end
@@ -0,0 +1,32 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Cookbook Name:: php
5
+ # Recipe:: module_ldap
6
+ #
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ pkg = value_for_platform(
23
+ %w(centos redhat scientific fedora) => {
24
+ %w(5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8) => "php53-ldap",
25
+ "default" => "php-ldap"
26
+ },
27
+ "default" => "php5-ldap"
28
+ )
29
+
30
+ package pkg do
31
+ action :install
32
+ end
@@ -0,0 +1,37 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Cookbook Name:: php
5
+ # Recipe:: module_memcache
6
+ #
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ case node['platform_family']
23
+ when "rhel", "fedora"
24
+ %w{ zlib-devel }.each do |pkg|
25
+ package pkg do
26
+ action :install
27
+ end
28
+ end
29
+ php_pear "memcache" do
30
+ action :install
31
+ #directives(:shm_size => "128M", :enable_cli => 0)
32
+ end
33
+ when "debian"
34
+ package "php5-memcache" do
35
+ action :install
36
+ end
37
+ end
@@ -0,0 +1,32 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Cookbook Name:: php
5
+ # Recipe:: module_mysql
6
+ #
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ pkg = value_for_platform(
23
+ %w(centos redhat scientific fedora) => {
24
+ %w(5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8) => "php53-mysql",
25
+ "default" => "php-mysql"
26
+ },
27
+ "default" => "php5-mysql"
28
+ )
29
+
30
+ package pkg do
31
+ action :install
32
+ end
@@ -0,0 +1,32 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Cookbook Name:: php
5
+ # Recipe:: module_pgsql
6
+ #
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ pkg = value_for_platform(
23
+ %w(centos redhat scientific fedora) => {
24
+ %w(5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8) => "php53-pgsql",
25
+ "default" => "php-pgsql"
26
+ },
27
+ "default" => "php5-pgsql"
28
+ )
29
+
30
+ package pkg do
31
+ action :install
32
+ end
@@ -0,0 +1,30 @@
1
+ #
2
+ # Author:: Joshua Timberman (<joshua@opscode.com>)
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Cookbook Name:: php
5
+ # Recipe:: module_sqlite3
6
+ #
7
+ # Copyright 2009-2011, Opscode, Inc.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ case node['platform_family']
23
+ when "rhel", "fedora"
24
+ #already there in centos, --with-pdo-sqlite=shared
25
+ when "debian"
26
+ package "php5-sqlite" do
27
+ action :install
28
+ end
29
+ end
30
+
@@ -0,0 +1,43 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Cookbook Name:: php
4
+ # Recipe:: package
5
+ #
6
+ # Copyright 2011, Opscode, Inc.
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ pkgs = value_for_platform(
22
+ %w(centos redhat scientific fedora) => {
23
+ %w(5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8) => %w(php53 php53-devel php53-cli php-pear),
24
+ 'default' => %w(php php-devel php-cli php-pear)
25
+ },
26
+ [ "debian", "ubuntu" ] => {
27
+ "default" => %w{ php5-cgi php5 php5-dev php5-cli php-pear }
28
+ },
29
+ "default" => %w{ php5-cgi php5 php5-dev php5-cli php-pear }
30
+ )
31
+
32
+ pkgs.each do |pkg|
33
+ package pkg do
34
+ action :install
35
+ end
36
+ end
37
+
38
+ template "#{node['php']['conf_dir']}/php.ini" do
39
+ source "php.ini.erb"
40
+ owner "root"
41
+ group "root"
42
+ mode "0644"
43
+ end
@@ -0,0 +1,79 @@
1
+ #
2
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
3
+ # Cookbook Name:: php
4
+ # Recipe:: package
5
+ #
6
+ # Copyright 2011, Opscode, Inc.
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ configure_options = node['php']['configure_options'].join(" ")
22
+
23
+ include_recipe "build-essential"
24
+ include_recipe "xml"
25
+ include_recipe "mysql::client" if configure_options =~ /mysql/
26
+
27
+ pkgs = value_for_platform(
28
+ ["centos","redhat","fedora", "scientific"] =>
29
+ {"default" => %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 }},
30
+ [ "debian", "ubuntu" ] =>
31
+ {"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 }},
32
+ "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 }
33
+ )
34
+
35
+ pkgs.each do |pkg|
36
+ package pkg do
37
+ action :install
38
+ end
39
+ end
40
+
41
+ version = node['php']['version']
42
+
43
+ remote_file "#{Chef::Config[:file_cache_path]}/php-#{version}.tar.gz" do
44
+ source "#{node['php']['url']}/php-#{version}.tar.gz"
45
+ checksum node['php']['checksum']
46
+ mode "0644"
47
+ not_if "which php"
48
+ end
49
+
50
+ bash "build php" do
51
+ cwd Chef::Config[:file_cache_path]
52
+ code <<-EOF
53
+ tar -zxvf php-#{version}.tar.gz
54
+ (cd php-#{version} && ./configure #{configure_options})
55
+ (cd php-#{version} && make && make install)
56
+ EOF
57
+ not_if "which php"
58
+ end
59
+
60
+ directory node['php']['conf_dir'] do
61
+ owner "root"
62
+ group "root"
63
+ mode "0755"
64
+ recursive true
65
+ end
66
+
67
+ directory node['php']['ext_conf_dir'] do
68
+ owner "root"
69
+ group "root"
70
+ mode "0755"
71
+ recursive true
72
+ end
73
+
74
+ template "#{node['php']['conf_dir']}/php.ini" do
75
+ source "php.ini.erb"
76
+ owner "root"
77
+ group "root"
78
+ mode "0644"
79
+ end
@@ -0,0 +1,30 @@
1
+ #
2
+ # Author:: Seth Chisamore <schisamo@opscode.com>
3
+ # Cookbook Name:: php
4
+ # Resource:: pear_package
5
+ #
6
+ # Copyright:: 2011, Opscode, Inc <legal@opscode.com>
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ default_action :install
22
+ actions :install, :upgrade, :remove, :purge
23
+
24
+ attribute :package_name, :kind_of => String, :name_attribute => true
25
+ attribute :version, :default => nil
26
+ attribute :channel, :kind_of => String
27
+ attribute :options, :kind_of => String
28
+ attribute :directives, :kind_of => Hash, :default => {}
29
+ attribute :zend_extensions, :kind_of => Array, :default => Array.new
30
+ attribute :preferred_state, :default => 'stable'
@@ -0,0 +1,29 @@
1
+ #
2
+ # Author:: Seth Chisamore <schisamo@opscode.com>
3
+ # Cookbook Name:: php
4
+ # Resource:: pear_channel
5
+ #
6
+ # Copyright:: 2011, Opscode, Inc <legal@opscode.com>
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ default_action :discover
22
+ actions :discover, :add, :update, :remove
23
+
24
+ attribute :channel_name, :kind_of => String, :name_attribute => true
25
+ attribute :channel_xml, :kind_of => String
26
+
27
+ # TODO add authenticated channel support!
28
+ # attribute :username, :kind_of => String
29
+ # attribute :password, :kind_of => String