from-scratch 0.3.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Berksfile +2 -1
- data/Berksfile.lock +20 -1
- data/cookbooks/bluepill/CHANGELOG.md +93 -0
- data/cookbooks/bluepill/README.md +91 -0
- data/cookbooks/bluepill/attributes/default.rb +44 -0
- data/cookbooks/bluepill/metadata.json +1 -0
- data/cookbooks/bluepill/providers/service.rb +172 -0
- data/cookbooks/bluepill/recipes/default.rb +48 -0
- data/cookbooks/bluepill/recipes/rsyslog.rb +28 -0
- data/cookbooks/bluepill/resources/service.rb +27 -0
- data/cookbooks/bluepill/templates/default/bluepill_init.fedora.erb +34 -0
- data/cookbooks/bluepill/templates/default/bluepill_init.freebsd.erb +32 -0
- data/cookbooks/bluepill/templates/default/bluepill_init.lsb.erb +37 -0
- data/cookbooks/bluepill/templates/default/bluepill_init.rhel.erb +34 -0
- data/cookbooks/bluepill/templates/default/bluepill_rsyslog.conf.erb +1 -0
- data/cookbooks/nginx/CHANGELOG.md +435 -0
- data/cookbooks/nginx/README.md +521 -0
- data/cookbooks/nginx/attributes/auth_request.rb +23 -0
- data/cookbooks/nginx/attributes/default.rb +131 -0
- data/cookbooks/nginx/attributes/devel.rb +24 -0
- data/cookbooks/nginx/attributes/echo.rb +24 -0
- data/cookbooks/nginx/attributes/geoip.rb +31 -0
- data/cookbooks/nginx/attributes/headers_more.rb +24 -0
- data/cookbooks/nginx/attributes/lua.rb +28 -0
- data/cookbooks/nginx/attributes/naxsi.rb +24 -0
- data/cookbooks/nginx/attributes/openssl_source.rb +23 -0
- data/cookbooks/nginx/attributes/pagespeed.rb +9 -0
- data/cookbooks/nginx/attributes/passenger.rb +58 -0
- data/cookbooks/nginx/attributes/rate_limiting.rb +23 -0
- data/cookbooks/nginx/attributes/repo.rb +35 -0
- data/cookbooks/nginx/attributes/set_misc.rb +8 -0
- data/cookbooks/nginx/attributes/socketproxy.rb +13 -0
- data/cookbooks/nginx/attributes/source.rb +42 -0
- data/cookbooks/nginx/attributes/status.rb +22 -0
- data/cookbooks/nginx/attributes/syslog.rb +24 -0
- data/cookbooks/nginx/attributes/upload_progress.rb +26 -0
- data/cookbooks/nginx/definitions/nginx_site.rb +50 -0
- data/cookbooks/nginx/files/default/mime.types +78 -0
- data/cookbooks/nginx/files/default/naxsi_core.rules +82 -0
- data/cookbooks/nginx/libraries/matchers.rb +20 -0
- data/cookbooks/nginx/metadata.json +351 -0
- data/cookbooks/nginx/recipes/authorized_ips.rb +32 -0
- data/cookbooks/nginx/recipes/commons.rb +24 -0
- data/cookbooks/nginx/recipes/commons_conf.rb +42 -0
- data/cookbooks/nginx/recipes/commons_dir.rb +57 -0
- data/cookbooks/nginx/recipes/commons_script.rb +29 -0
- data/cookbooks/nginx/recipes/default.rb +31 -0
- data/cookbooks/nginx/recipes/headers_more_module.rb +50 -0
- data/cookbooks/nginx/recipes/http_auth_request_module.rb +52 -0
- data/cookbooks/nginx/recipes/http_echo_module.rb +46 -0
- data/cookbooks/nginx/recipes/http_geoip_module.rb +113 -0
- data/cookbooks/nginx/recipes/http_gzip_static_module.rb +30 -0
- data/cookbooks/nginx/recipes/http_mp4_module.rb +2 -0
- data/cookbooks/nginx/recipes/http_perl_module.rb +23 -0
- data/cookbooks/nginx/recipes/http_realip_module.rb +38 -0
- data/cookbooks/nginx/recipes/http_spdy_module.rb +23 -0
- data/cookbooks/nginx/recipes/http_ssl_module.rb +23 -0
- data/cookbooks/nginx/recipes/http_stub_status_module.rb +36 -0
- data/cookbooks/nginx/recipes/ipv6.rb +23 -0
- data/cookbooks/nginx/recipes/lua.rb +47 -0
- data/cookbooks/nginx/recipes/naxsi_module.rb +52 -0
- data/cookbooks/nginx/recipes/ngx_devel_module.rb +44 -0
- data/cookbooks/nginx/recipes/ngx_lua_module.rb +47 -0
- data/cookbooks/nginx/recipes/ohai_plugin.rb +35 -0
- data/cookbooks/nginx/recipes/openssl_source.rb +45 -0
- data/cookbooks/nginx/recipes/package.rb +52 -0
- data/cookbooks/nginx/recipes/pagespeed_module.rb +62 -0
- data/cookbooks/nginx/recipes/passenger.rb +56 -0
- data/cookbooks/nginx/recipes/repo.rb +41 -0
- data/cookbooks/nginx/recipes/repo_passenger.rb +39 -0
- data/cookbooks/nginx/recipes/set_misc.rb +30 -0
- data/cookbooks/nginx/recipes/socketproxy.rb +26 -0
- data/cookbooks/nginx/recipes/source.rb +205 -0
- data/cookbooks/nginx/recipes/syslog_module.rb +69 -0
- data/cookbooks/nginx/recipes/upload_progress_module.rb +53 -0
- data/cookbooks/nginx/templates/debian/nginx.init.erb +97 -0
- data/cookbooks/nginx/templates/default/default-site.erb +11 -0
- data/cookbooks/nginx/templates/default/modules/authorized_ip.erb +6 -0
- data/cookbooks/nginx/templates/default/modules/http_geoip.conf.erb +4 -0
- data/cookbooks/nginx/templates/default/modules/http_gzip_static.conf.erb +1 -0
- data/cookbooks/nginx/templates/default/modules/http_realip.conf.erb +7 -0
- data/cookbooks/nginx/templates/default/modules/nginx_status.erb +14 -0
- data/cookbooks/nginx/templates/default/modules/passenger.conf.erb +13 -0
- data/cookbooks/nginx/templates/default/modules/socketproxy.conf.erb +89 -0
- data/cookbooks/nginx/templates/default/modules/upload_progress.erb +4 -0
- data/cookbooks/nginx/templates/default/nginx-upstart.conf.erb +39 -0
- data/cookbooks/nginx/templates/default/nginx.conf.erb +103 -0
- data/cookbooks/nginx/templates/default/nginx.init.erb +111 -0
- data/cookbooks/nginx/templates/default/nginx.pill.erb +15 -0
- data/cookbooks/nginx/templates/default/nginx.sysconfig.erb +1 -0
- data/cookbooks/nginx/templates/default/nxdissite.erb +29 -0
- data/cookbooks/nginx/templates/default/nxensite.erb +38 -0
- data/cookbooks/nginx/templates/default/plugins/nginx.rb.erb +66 -0
- data/cookbooks/nginx/templates/default/sv-nginx-log-run.erb +2 -0
- data/cookbooks/nginx/templates/default/sv-nginx-run.erb +4 -0
- data/cookbooks/nginx/templates/gentoo/nginx.init.erb +87 -0
- data/cookbooks/nginx/templates/suse/nginx.init.erb +115 -0
- data/cookbooks/nginx/templates/ubuntu/nginx.init.erb +97 -0
- data/cookbooks/ohai/CHANGELOG.md +69 -0
- data/cookbooks/ohai/README.md +89 -0
- data/cookbooks/ohai/attributes/default.rb +31 -0
- data/cookbooks/ohai/files/default/plugins/README +1 -0
- data/cookbooks/ohai/libraries/matchers.rb +14 -0
- data/cookbooks/ohai/metadata.json +1 -0
- data/cookbooks/ohai/providers/hint.rb +38 -0
- data/cookbooks/ohai/recipes/default.rb +52 -0
- data/cookbooks/ohai/resources/hint.rb +5 -0
- data/cookbooks/packagecloud/CHANGELOG.md +12 -0
- data/cookbooks/packagecloud/README.md +80 -0
- data/cookbooks/packagecloud/attributes/default.rb +8 -0
- data/cookbooks/packagecloud/libraries/helper.rb +43 -0
- data/cookbooks/packagecloud/libraries/matcher.rb +7 -0
- data/cookbooks/packagecloud/metadata.json +1 -0
- data/cookbooks/packagecloud/providers/repo.rb +212 -0
- data/cookbooks/packagecloud/resources/repo.rb +10 -0
- data/cookbooks/packagecloud/templates/.kitchen/logs/kitchen.log +29 -0
- data/cookbooks/packagecloud/templates/default/apt.erb +2 -0
- data/cookbooks/packagecloud/templates/default/yum.erb +15 -0
- data/cookbooks/rsyslog/CHANGELOG.md +193 -0
- data/cookbooks/rsyslog/README.md +276 -0
- data/cookbooks/rsyslog/attributes/default.rb +131 -0
- data/cookbooks/rsyslog/libraries/helpers.rb +25 -0
- data/cookbooks/rsyslog/metadata.json +1 -0
- data/cookbooks/rsyslog/providers/file_input.rb +44 -0
- data/cookbooks/rsyslog/recipes/client.rb +87 -0
- data/cookbooks/rsyslog/recipes/default.rb +89 -0
- data/cookbooks/rsyslog/recipes/server.rb +44 -0
- data/cookbooks/rsyslog/resources/file_input.rb +28 -0
- data/cookbooks/rsyslog/templates/default/35-server-per-host.conf.erb +62 -0
- data/cookbooks/rsyslog/templates/default/49-relp.conf.erb +10 -0
- data/cookbooks/rsyslog/templates/default/49-remote.conf.erb +30 -0
- data/cookbooks/rsyslog/templates/default/50-default.conf.erb +6 -0
- data/cookbooks/rsyslog/templates/default/file-input.conf.erb +15 -0
- data/cookbooks/rsyslog/templates/default/omnios-manifest.xml.erb +30 -0
- data/cookbooks/rsyslog/templates/default/rsyslog.conf.erb +117 -0
- data/cookbooks/rsyslog/templates/smartos/50-default.conf.erb +18 -0
- data/cookbooks/runit/.kitchen.cloud.yml +103 -0
- data/cookbooks/runit/.kitchen.yml +38 -0
- data/cookbooks/runit/.rspec +3 -0
- data/cookbooks/runit/.rubocop.yml +45 -0
- data/cookbooks/runit/Berksfile.disabled +11 -0
- data/cookbooks/runit/CHANGELOG.md +226 -0
- data/cookbooks/runit/CONTRIBUTING.md +266 -0
- data/cookbooks/runit/Cheffile +11 -0
- data/cookbooks/runit/Gemfile +17 -0
- data/cookbooks/runit/LICENSE +201 -0
- data/cookbooks/runit/README.md +435 -0
- data/cookbooks/runit/Rakefile +23 -0
- data/cookbooks/runit/TESTING.md +26 -0
- data/cookbooks/runit/attributes/default.rb +62 -0
- data/cookbooks/runit/files/default/runit.seed +1 -0
- data/cookbooks/runit/files/default/runsvdir +0 -0
- data/cookbooks/runit/files/ubuntu-6.10/runsvdir +6 -0
- data/cookbooks/runit/files/ubuntu-7.04/runsvdir +7 -0
- data/cookbooks/runit/files/ubuntu-7.10/runsvdir +7 -0
- data/cookbooks/runit/files/ubuntu-8.04/runsvdir +7 -0
- data/cookbooks/runit/libraries/default.rb +0 -0
- data/cookbooks/runit/libraries/helpers.rb +190 -0
- data/cookbooks/runit/libraries/matchers.rb +69 -0
- data/cookbooks/runit/libraries/provider_runit_service.rb +326 -0
- data/cookbooks/runit/libraries/resource_runit_service.rb +267 -0
- data/cookbooks/runit/metadata.json +50 -0
- data/cookbooks/runit/recipes/default.rb +91 -0
- data/cookbooks/runit/templates/debian/init.d.erb +66 -0
- data/cookbooks/runit/templates/default/log-config.erb +24 -0
- data/cookbooks/runit/templates/gentoo/runit-start.sh.erb +32 -0
- data/cookbooks/scratchify/Berksfile +2 -1
- data/cookbooks/scratchify/Berksfile.lock +20 -1
- data/cookbooks/scratchify/lib/from-scratch.rb +1 -4
- data/cookbooks/scratchify/lib/from-scratch/version.rb +1 -1
- data/cookbooks/scratchify/metadata.json +5 -2
- data/cookbooks/scratchify/recipes/default.rb +15 -1
- data/cookbooks/scratchify/recipes/nginx_site.rb +4 -0
- data/cookbooks/scratchify/recipes/pre_rvm.rb +5 -0
- data/cookbooks/scratchify/templates/nginx.erb +31 -0
- data/cookbooks/scratchify/templates/node.json.erb +21 -6
- data/cookbooks/yum-epel/CHANGELOG.md +84 -0
- data/cookbooks/yum-epel/README.md +172 -0
- data/cookbooks/yum-epel/attributes/default.rb +1 -0
- data/cookbooks/yum-epel/attributes/epel-debuginfo.rb +28 -0
- data/cookbooks/yum-epel/attributes/epel-source.rb +28 -0
- data/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb +28 -0
- data/cookbooks/yum-epel/attributes/epel-testing-source.rb +28 -0
- data/cookbooks/yum-epel/attributes/epel-testing.rb +28 -0
- data/cookbooks/yum-epel/attributes/epel.rb +28 -0
- data/cookbooks/yum-epel/metadata.json +1 -0
- data/cookbooks/yum-epel/recipes/default.rb +61 -0
- data/cookbooks/yum/CHANGELOG.md +294 -0
- data/cookbooks/yum/README.md +285 -0
- data/cookbooks/yum/attributes/main.rb +100 -0
- data/cookbooks/yum/libraries/matchers.rb +27 -0
- data/cookbooks/yum/metadata.json +1 -0
- data/cookbooks/yum/providers/globalconfig.rb +41 -0
- data/cookbooks/yum/providers/repository.rb +106 -0
- data/cookbooks/yum/recipes/default.rb +26 -0
- data/cookbooks/yum/resources/globalconfig.rb +109 -0
- data/cookbooks/yum/resources/repository.rb +69 -0
- data/cookbooks/yum/templates/default/main.erb +276 -0
- data/cookbooks/yum/templates/default/repo.erb +125 -0
- data/lib/from-scratch.rb +1 -0
- data/lib/from-scratch/version.rb +1 -1
- data/metadata.rb +5 -1
- data/recipes/default.rb +15 -1
- data/recipes/nginx_site.rb +4 -0
- data/recipes/pre_rvm.rb +5 -0
- data/templates/nginx.erb +31 -0
- data/templates/node.json.erb +21 -6
- metadata +194 -1
@@ -0,0 +1,52 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Recipe:: package
|
4
|
+
# Author:: AJ Christensen <aj@junglist.gen.nz>
|
5
|
+
#
|
6
|
+
# Copyright 2008-2013, Chef Software, 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
|
+
include_recipe 'nginx::ohai_plugin'
|
22
|
+
|
23
|
+
if platform_family?('rhel')
|
24
|
+
if node['nginx']['repo_source'] == 'epel'
|
25
|
+
include_recipe 'yum-epel'
|
26
|
+
elsif node['nginx']['repo_source'] == 'nginx'
|
27
|
+
include_recipe 'nginx::repo'
|
28
|
+
package_install_opts = '--disablerepo=* --enablerepo=nginx'
|
29
|
+
elsif node['nginx']['repo_source'].to_s.empty?
|
30
|
+
log "node['nginx']['repo_source'] was not set, no additional yum repositories will be installed." do
|
31
|
+
level :debug
|
32
|
+
end
|
33
|
+
else
|
34
|
+
fail ArgumentError, "Unknown value '#{node['nginx']['repo_source']}' was passed to the nginx cookbook."
|
35
|
+
end
|
36
|
+
elsif platform_family?('debian')
|
37
|
+
include_recipe 'nginx::repo_passenger' if node['nginx']['repo_source'] == 'passenger'
|
38
|
+
include_recipe 'nginx::repo' if node['nginx']['repo_source'] == 'nginx'
|
39
|
+
end
|
40
|
+
|
41
|
+
package node['nginx']['package_name'] do
|
42
|
+
options package_install_opts
|
43
|
+
notifies :reload, 'ohai[reload_nginx]', :immediately
|
44
|
+
not_if 'which nginx'
|
45
|
+
end
|
46
|
+
|
47
|
+
service 'nginx' do
|
48
|
+
supports :status => true, :restart => true, :reload => true
|
49
|
+
action :enable
|
50
|
+
end
|
51
|
+
|
52
|
+
include_recipe 'nginx::commons'
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Recipe:: pagespeed_module
|
4
|
+
#
|
5
|
+
|
6
|
+
src_filename = ::File.basename(node['nginx']['pagespeed']['url'])
|
7
|
+
src_filepath = "#{Chef::Config['file_cache_path']}/#{src_filename}"
|
8
|
+
extract_path = "#{Chef::Config['file_cache_path']}/nginx_pagespeed-#{node['nginx']['pagespeed']['version']}"
|
9
|
+
|
10
|
+
remote_file src_filepath do
|
11
|
+
source node['nginx']['pagespeed']['url']
|
12
|
+
owner 'root'
|
13
|
+
group node['root_group']
|
14
|
+
mode '0644'
|
15
|
+
not_if { ::File.exist?(src_filepath) }
|
16
|
+
end
|
17
|
+
|
18
|
+
psol_src_filename = "psol-#{::File.basename(node['nginx']['psol']['url'])}"
|
19
|
+
psol_src_filepath = "#{Chef::Config['file_cache_path']}/#{psol_src_filename}"
|
20
|
+
psol_extract_path = "#{Chef::Config['file_cache_path']}/nginx_pagespeed-#{node['nginx']['pagespeed']['version']}/psol"
|
21
|
+
|
22
|
+
remote_file psol_src_filepath do
|
23
|
+
source node['nginx']['psol']['url']
|
24
|
+
owner 'root'
|
25
|
+
group node['root_group']
|
26
|
+
mode '0644'
|
27
|
+
not_if { ::File.exist?(psol_src_filepath) }
|
28
|
+
end
|
29
|
+
|
30
|
+
packages = value_for_platform_family(
|
31
|
+
%w(rhel) => node['nginx']['pagespeed']['packages']['rhel'],
|
32
|
+
%w(debian) => node['nginx']['pagespeed']['packages']['debian']
|
33
|
+
)
|
34
|
+
|
35
|
+
unless packages.empty?
|
36
|
+
packages.each do |name|
|
37
|
+
package name
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
bash 'extract_pagespeed' do
|
42
|
+
cwd ::File.dirname(src_filepath)
|
43
|
+
code <<-EOH
|
44
|
+
mkdir -p #{extract_path}
|
45
|
+
tar xzf #{src_filename} -C #{extract_path}
|
46
|
+
mv #{extract_path}/*/* #{extract_path}/
|
47
|
+
EOH
|
48
|
+
not_if { ::File.exist?(extract_path) }
|
49
|
+
end
|
50
|
+
|
51
|
+
bash 'extract_psol' do
|
52
|
+
cwd ::File.dirname(psol_src_filepath)
|
53
|
+
code <<-EOH
|
54
|
+
mkdir -p #{psol_extract_path}
|
55
|
+
tar xzf #{psol_src_filename} -C #{psol_extract_path}
|
56
|
+
mv #{psol_extract_path}/*/* #{psol_extract_path}/
|
57
|
+
EOH
|
58
|
+
not_if { ::File.exist?(psol_extract_path) }
|
59
|
+
end
|
60
|
+
|
61
|
+
node.run_state['nginx_configure_flags'] =
|
62
|
+
node.run_state['nginx_configure_flags'] | ["--add-module=#{extract_path}"]
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Recipe:: Passenger
|
4
|
+
#
|
5
|
+
# Copyright 2013, Chef Software, Inc.
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
packages = value_for_platform_family(
|
21
|
+
%w(rhel) => node['nginx']['passenger']['packages']['rhel'],
|
22
|
+
%w(fedora) => node['nginx']['passenger']['packages']['fedora'],
|
23
|
+
%w(debian) => node['nginx']['passenger']['packages']['debian']
|
24
|
+
)
|
25
|
+
|
26
|
+
unless packages.empty?
|
27
|
+
packages.each do |name|
|
28
|
+
package name
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
gem_package 'rake' if node['nginx']['passenger']['install_rake']
|
33
|
+
|
34
|
+
if node['nginx']['passenger']['install_method'] == 'package'
|
35
|
+
package node['nginx']['package_name']
|
36
|
+
package 'passenger'
|
37
|
+
elsif node['nginx']['passenger']['install_method'] == 'source'
|
38
|
+
|
39
|
+
gem_package 'passenger' do
|
40
|
+
action :install
|
41
|
+
version node['nginx']['passenger']['version']
|
42
|
+
gem_binary node['nginx']['passenger']['gem_binary'] if node['nginx']['passenger']['gem_binary']
|
43
|
+
end
|
44
|
+
|
45
|
+
node.run_state['nginx_configure_flags'] =
|
46
|
+
node.run_state['nginx_configure_flags'] | ["--add-module=#{node['nginx']['passenger']['root']}/ext/nginx"]
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
template "#{node['nginx']['dir']}/conf.d/passenger.conf" do
|
51
|
+
source 'modules/passenger.conf.erb'
|
52
|
+
owner 'root'
|
53
|
+
group node['root_group']
|
54
|
+
mode '0644'
|
55
|
+
notifies :reload, 'service[nginx]', :delayed
|
56
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Recipe:: repo
|
4
|
+
# Author:: Nick Rycar <nrycar@bluebox.net>
|
5
|
+
#
|
6
|
+
# Copyright 2008-2013, Chef Software, 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
|
+
case node['platform_family']
|
22
|
+
when 'rhel', 'fedora'
|
23
|
+
|
24
|
+
yum_repository 'nginx' do
|
25
|
+
description 'Nginx.org Repository'
|
26
|
+
baseurl node['nginx']['upstream_repository']
|
27
|
+
gpgkey 'http://nginx.org/keys/nginx_signing.key'
|
28
|
+
action :create
|
29
|
+
end
|
30
|
+
|
31
|
+
when 'debian'
|
32
|
+
include_recipe 'apt::default'
|
33
|
+
|
34
|
+
apt_repository 'nginx' do
|
35
|
+
uri node['nginx']['upstream_repository']
|
36
|
+
distribution node['lsb']['codename']
|
37
|
+
components %w(nginx)
|
38
|
+
deb_src true
|
39
|
+
key 'http://nginx.org/keys/nginx_signing.key'
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Cookbook Name:: nginx
|
2
|
+
# Recipe:: repo_passenger
|
3
|
+
# Author:: Jose Alberto Suarez Lopez <ja@josealberto.org>
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
case node['platform_family']
|
19
|
+
when 'rhel', 'fedora'
|
20
|
+
|
21
|
+
log 'There is not official phusion passenger repo for redhat based systems.' do
|
22
|
+
level :info
|
23
|
+
end
|
24
|
+
|
25
|
+
when 'debian'
|
26
|
+
include_recipe 'apt::default'
|
27
|
+
package 'apt-transport-https'
|
28
|
+
|
29
|
+
apt_repository 'phusionpassenger' do
|
30
|
+
uri 'https://oss-binaries.phusionpassenger.com/apt/passenger'
|
31
|
+
distribution node['lsb']['codename']
|
32
|
+
components %w(main)
|
33
|
+
deb_src true
|
34
|
+
keyserver 'keyserver.ubuntu.com'
|
35
|
+
key '561F9B9CAC40B2F7'
|
36
|
+
end
|
37
|
+
|
38
|
+
include_recipe 'nginx::passenger'
|
39
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Recipes:: set_misc
|
4
|
+
#
|
5
|
+
|
6
|
+
set_misc_src_filename = ::File.basename(node['nginx']['set_misc']['url'])
|
7
|
+
set_misc_src_filepath = "#{Chef::Config['file_cache_path']}/#{set_misc_src_filename}"
|
8
|
+
set_misc_extract_path = "#{Chef::Config['file_cache_path']}/nginx-set_misc-#{node['nginx']['set_misc']['version']}"
|
9
|
+
|
10
|
+
remote_file set_misc_src_filepath do
|
11
|
+
source node['nginx']['set_misc']['url']
|
12
|
+
checksum node['nginx']['set_misc']['checksum']
|
13
|
+
owner 'root'
|
14
|
+
group 'root'
|
15
|
+
mode '0644'
|
16
|
+
end
|
17
|
+
|
18
|
+
bash 'extract_set_misc_module' do
|
19
|
+
cwd ::File.dirname(set_misc_src_filepath)
|
20
|
+
code <<-EOH
|
21
|
+
mkdir -p #{set_misc_extract_path}
|
22
|
+
tar xzf #{set_misc_src_filename} -C #{set_misc_extract_path}
|
23
|
+
EOH
|
24
|
+
not_if { ::File.exist?(set_misc_extract_path) }
|
25
|
+
end
|
26
|
+
|
27
|
+
node.run_state['nginx_configure_flags'] =
|
28
|
+
node.run_state['nginx_configure_flags'] | ["--add-module=#{set_misc_extract_path}/set-misc-nginx-module-#{node['nginx']['set_misc']['version']}"]
|
29
|
+
|
30
|
+
include_recipe 'nginx::ngx_devel_module'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
include_recipe 'nginx::commons_dir'
|
2
|
+
|
3
|
+
directory node['nginx']['socketproxy']['root'] do
|
4
|
+
owner node['nginx']['socketproxy']['app_owner']
|
5
|
+
group node['nginx']['socketproxy']['app_owner']
|
6
|
+
mode 00755
|
7
|
+
action :create
|
8
|
+
end
|
9
|
+
|
10
|
+
context_names = node['nginx']['socketproxy']['apps'].map do |_app, app_conf|
|
11
|
+
app_conf['context_name']
|
12
|
+
end
|
13
|
+
|
14
|
+
fail 'More than one app has the same context_name configured.' if context_names.uniq.length != context_names.length
|
15
|
+
|
16
|
+
template node['nginx']['dir'] + '/sites-available/socketproxy.conf' do
|
17
|
+
source 'modules/socketproxy.conf.erb'
|
18
|
+
owner 'root'
|
19
|
+
group 'root'
|
20
|
+
mode 00644
|
21
|
+
notifies :reload, 'service[nginx]', :delayed
|
22
|
+
end
|
23
|
+
|
24
|
+
link node['nginx']['dir'] + '/sites-enabled/socketproxy.conf' do
|
25
|
+
to node['nginx']['dir'] + '/sites-available/socketproxy.conf'
|
26
|
+
end
|
@@ -0,0 +1,205 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Recipe:: source
|
4
|
+
#
|
5
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
6
|
+
# Author:: Joshua Timberman (<joshua@chef.io>)
|
7
|
+
# Author:: Jamie Winsor (<jamie@vialstudios.com>)
|
8
|
+
#
|
9
|
+
# Copyright 2009-2013, Chef Software, Inc.
|
10
|
+
#
|
11
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
12
|
+
# you may not use this file except in compliance with the License.
|
13
|
+
# You may obtain a copy of the License at
|
14
|
+
#
|
15
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
#
|
17
|
+
# Unless required by applicable law or agreed to in writing, software
|
18
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
19
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20
|
+
# See the License for the specific language governing permissions and
|
21
|
+
# limitations under the License.
|
22
|
+
#
|
23
|
+
|
24
|
+
# This is for Chef 10 and earlier where attributes aren't loaded
|
25
|
+
# deterministically (resolved in Chef 11).
|
26
|
+
node.load_attribute_by_short_filename('source', 'nginx') if node.respond_to?(:load_attribute_by_short_filename)
|
27
|
+
|
28
|
+
nginx_url = node['nginx']['source']['url'] ||
|
29
|
+
"http://nginx.org/download/nginx-#{node['nginx']['source']['version']}.tar.gz"
|
30
|
+
|
31
|
+
node.set['nginx']['binary'] = node['nginx']['source']['sbin_path']
|
32
|
+
node.set['nginx']['daemon_disable'] = true
|
33
|
+
|
34
|
+
unless node['nginx']['source']['use_existing_user']
|
35
|
+
user node['nginx']['user'] do
|
36
|
+
system true
|
37
|
+
shell '/bin/false'
|
38
|
+
home '/var/www'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
include_recipe 'nginx::ohai_plugin'
|
43
|
+
include_recipe 'nginx::commons_dir'
|
44
|
+
include_recipe 'nginx::commons_script'
|
45
|
+
include_recipe 'build-essential::default'
|
46
|
+
|
47
|
+
src_filepath = "#{Chef::Config['file_cache_path'] || '/tmp'}/nginx-#{node['nginx']['source']['version']}.tar.gz"
|
48
|
+
packages = value_for_platform_family(
|
49
|
+
%w(rhel fedora suse) => %w(pcre-devel openssl-devel),
|
50
|
+
%w(gentoo) => [],
|
51
|
+
%w(default) => %w(libpcre3 libpcre3-dev libssl-dev)
|
52
|
+
)
|
53
|
+
|
54
|
+
packages.each do |name|
|
55
|
+
package name
|
56
|
+
end
|
57
|
+
|
58
|
+
remote_file nginx_url do
|
59
|
+
source nginx_url
|
60
|
+
checksum node['nginx']['source']['checksum']
|
61
|
+
path src_filepath
|
62
|
+
backup false
|
63
|
+
end
|
64
|
+
|
65
|
+
node.run_state['nginx_force_recompile'] = false
|
66
|
+
node.run_state['nginx_configure_flags'] =
|
67
|
+
node['nginx']['source']['default_configure_flags'] | node['nginx']['configure_flags']
|
68
|
+
|
69
|
+
include_recipe 'nginx::commons_conf'
|
70
|
+
|
71
|
+
cookbook_file "#{node['nginx']['dir']}/mime.types" do
|
72
|
+
source 'mime.types'
|
73
|
+
owner 'root'
|
74
|
+
group node['root_group']
|
75
|
+
mode '0644'
|
76
|
+
notifies :reload, 'service[nginx]', :delayed
|
77
|
+
end
|
78
|
+
|
79
|
+
# source install depends on the existence of the `tar` package
|
80
|
+
package 'tar'
|
81
|
+
|
82
|
+
# Unpack downloaded source so we could apply nginx patches
|
83
|
+
# in custom modules - example http://yaoweibin.github.io/nginx_tcp_proxy_module/
|
84
|
+
# patch -p1 < /path/to/nginx_tcp_proxy_module/tcp.patch
|
85
|
+
bash 'unarchive_source' do
|
86
|
+
cwd ::File.dirname(src_filepath)
|
87
|
+
code <<-EOH
|
88
|
+
tar zxf #{::File.basename(src_filepath)} -C #{::File.dirname(src_filepath)}
|
89
|
+
EOH
|
90
|
+
not_if { ::File.directory?("#{Chef::Config['file_cache_path'] || '/tmp'}/nginx-#{node['nginx']['source']['version']}") }
|
91
|
+
end
|
92
|
+
|
93
|
+
node['nginx']['source']['modules'].each do |ngx_module|
|
94
|
+
include_recipe ngx_module
|
95
|
+
end
|
96
|
+
|
97
|
+
configure_flags = node.run_state['nginx_configure_flags']
|
98
|
+
nginx_force_recompile = node.run_state['nginx_force_recompile']
|
99
|
+
|
100
|
+
bash 'compile_nginx_source' do
|
101
|
+
cwd ::File.dirname(src_filepath)
|
102
|
+
code <<-EOH
|
103
|
+
cd nginx-#{node['nginx']['source']['version']} &&
|
104
|
+
./configure #{node.run_state['nginx_configure_flags'].join(' ')} &&
|
105
|
+
make && make install
|
106
|
+
EOH
|
107
|
+
|
108
|
+
not_if do
|
109
|
+
nginx_force_recompile == false &&
|
110
|
+
node.automatic_attrs['nginx'] &&
|
111
|
+
node.automatic_attrs['nginx']['version'] == node['nginx']['source']['version'] &&
|
112
|
+
node.automatic_attrs['nginx']['configure_arguments'].sort == configure_flags.sort
|
113
|
+
end
|
114
|
+
|
115
|
+
notifies :restart, 'service[nginx]'
|
116
|
+
notifies :reload, 'ohai[reload_nginx]', :immediately
|
117
|
+
end
|
118
|
+
|
119
|
+
case node['nginx']['init_style']
|
120
|
+
when 'runit'
|
121
|
+
node.set['nginx']['src_binary'] = node['nginx']['binary']
|
122
|
+
include_recipe 'runit::default'
|
123
|
+
|
124
|
+
runit_service 'nginx'
|
125
|
+
|
126
|
+
service 'nginx' do
|
127
|
+
supports :status => true, :restart => true, :reload => true
|
128
|
+
reload_command "#{node['runit']['sv_bin']} hup #{node['runit']['service_dir']}/nginx"
|
129
|
+
end
|
130
|
+
when 'bluepill'
|
131
|
+
include_recipe 'bluepill::default'
|
132
|
+
|
133
|
+
template "#{node['bluepill']['conf_dir']}/nginx.pill" do
|
134
|
+
source 'nginx.pill.erb'
|
135
|
+
mode '0644'
|
136
|
+
end
|
137
|
+
|
138
|
+
bluepill_service 'nginx' do
|
139
|
+
action [:enable, :load]
|
140
|
+
end
|
141
|
+
|
142
|
+
service 'nginx' do
|
143
|
+
supports :status => true, :restart => true, :reload => true
|
144
|
+
reload_command "[[ -f #{node['nginx']['pid']} ]] && kill -HUP `cat #{node['nginx']['pid']}` || true"
|
145
|
+
action :nothing
|
146
|
+
end
|
147
|
+
when 'upstart'
|
148
|
+
# we rely on this to set up nginx.conf with daemon disable instead of doing
|
149
|
+
# it in the upstart init script.
|
150
|
+
node.set['nginx']['daemon_disable'] = node['nginx']['upstart']['foreground']
|
151
|
+
|
152
|
+
template '/etc/init/nginx.conf' do
|
153
|
+
source 'nginx-upstart.conf.erb'
|
154
|
+
owner 'root'
|
155
|
+
group node['root_group']
|
156
|
+
mode '0644'
|
157
|
+
end
|
158
|
+
|
159
|
+
service 'nginx' do
|
160
|
+
provider Chef::Provider::Service::Upstart
|
161
|
+
supports :status => true, :restart => true, :reload => true
|
162
|
+
action :nothing
|
163
|
+
end
|
164
|
+
else
|
165
|
+
node.set['nginx']['daemon_disable'] = false
|
166
|
+
|
167
|
+
generate_init = true
|
168
|
+
|
169
|
+
case node['platform']
|
170
|
+
when 'gentoo'
|
171
|
+
generate_template = false
|
172
|
+
when 'debian', 'ubuntu'
|
173
|
+
generate_template = true
|
174
|
+
defaults_path = '/etc/default/nginx'
|
175
|
+
when 'freebsd'
|
176
|
+
generate_init = false
|
177
|
+
else
|
178
|
+
generate_template = true
|
179
|
+
defaults_path = '/etc/sysconfig/nginx'
|
180
|
+
end
|
181
|
+
|
182
|
+
template '/etc/init.d/nginx' do
|
183
|
+
source 'nginx.init.erb'
|
184
|
+
owner 'root'
|
185
|
+
group node['root_group']
|
186
|
+
mode '0755'
|
187
|
+
end if generate_init
|
188
|
+
|
189
|
+
if generate_template
|
190
|
+
template defaults_path do
|
191
|
+
source 'nginx.sysconfig.erb'
|
192
|
+
owner 'root'
|
193
|
+
group node['root_group']
|
194
|
+
mode '0644'
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
service 'nginx' do
|
199
|
+
supports :status => true, :restart => true, :reload => true
|
200
|
+
action :enable
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
node.run_state.delete('nginx_configure_flags')
|
205
|
+
node.run_state.delete('nginx_force_recompile')
|