elzar 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.chef/knife.rb +3 -0
- data/.gitignore +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +96 -0
- data/README.md +42 -0
- data/Rakefile +1 -0
- data/Vagrantfile +16 -0
- data/cookbooks/.gitkeep +0 -0
- data/cookbooks/apt/README.md +122 -0
- data/cookbooks/apt/files/default/apt-cacher +9 -0
- data/cookbooks/apt/files/default/apt-cacher.conf +144 -0
- data/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
- data/cookbooks/apt/metadata.rb +13 -0
- data/cookbooks/apt/providers/repository.rb +73 -0
- data/cookbooks/apt/recipes/cacher-client.rb +44 -0
- data/cookbooks/apt/recipes/cacher.rb +45 -0
- data/cookbooks/apt/recipes/default.rb +50 -0
- data/cookbooks/apt/resources/repository.rb +30 -0
- data/cookbooks/build-essential/README.md +24 -0
- data/cookbooks/build-essential/metadata.rb +10 -0
- data/cookbooks/build-essential/recipes/default.rb +45 -0
- data/cookbooks/database/README.md +403 -0
- data/cookbooks/database/libraries/provider_database_mysql.rb +97 -0
- data/cookbooks/database/libraries/provider_database_mysql_user.rb +76 -0
- data/cookbooks/database/libraries/provider_database_postgresql.rb +126 -0
- data/cookbooks/database/libraries/provider_database_postgresql_user.rb +78 -0
- data/cookbooks/database/libraries/provider_database_sql_server.rb +109 -0
- data/cookbooks/database/libraries/provider_database_sql_server_user.rb +106 -0
- data/cookbooks/database/libraries/resource_database.rb +111 -0
- data/cookbooks/database/libraries/resource_database_user.rb +90 -0
- data/cookbooks/database/libraries/resource_mysql_database.rb +34 -0
- data/cookbooks/database/libraries/resource_mysql_database_user.rb +34 -0
- data/cookbooks/database/libraries/resource_postgresql_database.rb +35 -0
- data/cookbooks/database/libraries/resource_postgresql_database_user.rb +35 -0
- data/cookbooks/database/libraries/resource_sql_server_database.rb +34 -0
- data/cookbooks/database/libraries/resource_sql_server_database_user.rb +34 -0
- data/cookbooks/database/metadata.rb +21 -0
- data/cookbooks/database/recipes/default.rb +20 -0
- data/cookbooks/database/recipes/ebs_backup.rb +89 -0
- data/cookbooks/database/recipes/ebs_volume.rb +196 -0
- data/cookbooks/database/recipes/master.rb +78 -0
- data/cookbooks/database/recipes/snapshot.rb +62 -0
- data/cookbooks/database/templates/default/app_grants.sql.erb +8 -0
- data/cookbooks/database/templates/default/aws_config.erb +3 -0
- data/cookbooks/database/templates/default/chef-solo-database-snapshot.cron.erb +10 -0
- data/cookbooks/database/templates/default/chef-solo-database-snapshot.json.erb +1 -0
- data/cookbooks/database/templates/default/chef-solo-database-snapshot.rb.erb +6 -0
- data/cookbooks/database/templates/default/ebs-backup-cron.erb +2 -0
- data/cookbooks/database/templates/default/ebs-db-backup.sh.erb +8 -0
- data/cookbooks/database/templates/default/ebs-db-restore.sh.erb +10 -0
- data/cookbooks/database/templates/default/s3cfg.erb +27 -0
- data/cookbooks/mysql/README.md +148 -0
- data/cookbooks/mysql/attributes/server.rb +68 -0
- data/cookbooks/mysql/libraries/database.rb +19 -0
- data/cookbooks/mysql/libraries/helpers.rb +33 -0
- data/cookbooks/mysql/metadata.rb +90 -0
- data/cookbooks/mysql/recipes/client.rb +51 -0
- data/cookbooks/mysql/recipes/default.rb +20 -0
- data/cookbooks/mysql/recipes/server.rb +133 -0
- data/cookbooks/mysql/recipes/server_ec2.rb +49 -0
- data/cookbooks/mysql/templates/default/debian.cnf.erb +12 -0
- data/cookbooks/mysql/templates/default/grants.sql.erb +15 -0
- data/cookbooks/mysql/templates/default/my.cnf.erb +176 -0
- data/cookbooks/mysql/templates/default/mysql-server.seed.erb +10 -0
- data/cookbooks/mysql/templates/default/port_mysql.erb +3 -0
- data/cookbooks/openssl/README.md +37 -0
- data/cookbooks/openssl/libraries/secure_password.rb +37 -0
- data/cookbooks/openssl/metadata.rb +8 -0
- data/cookbooks/openssl/recipes/default.rb +19 -0
- data/cookbooks/passenger_enterprise/README.rdoc +8 -0
- data/cookbooks/passenger_enterprise/attributes/default.rb +28 -0
- data/cookbooks/passenger_enterprise/cc.gemspec +36 -0
- data/cookbooks/passenger_enterprise/metadata.json +44 -0
- data/cookbooks/passenger_enterprise/metadata.rb +16 -0
- data/cookbooks/passenger_enterprise/recipes/apache2.rb +54 -0
- data/cookbooks/passenger_enterprise/recipes/default.rb +30 -0
- data/cookbooks/passenger_enterprise/recipes/nginx.rb +50 -0
- data/cookbooks/passenger_enterprise/templates/default/passenger.conf.erb +2 -0
- data/cookbooks/passenger_enterprise/templates/default/passenger.load.erb +1 -0
- data/cookbooks/passenger_enterprise/templates/default/passenger_nginx.conf.erb +2 -0
- data/cookbooks/ruby_enterprise/README.rdoc +55 -0
- data/cookbooks/ruby_enterprise/attributes/default.rb +33 -0
- data/cookbooks/ruby_enterprise/cc.gemspec +36 -0
- data/cookbooks/ruby_enterprise/definitions/ree_gem.rb +28 -0
- data/cookbooks/ruby_enterprise/metadata.json +45 -0
- data/cookbooks/ruby_enterprise/metadata.rb +13 -0
- data/cookbooks/ruby_enterprise/recipes/default.rb +67 -0
- data/data_bags/deploy/authorized_keys.json +9 -0
- data/dna.json +25 -0
- data/elzar.gemspec +22 -0
- data/lib/elzar.rb +21 -0
- data/lib/elzar/assistant.rb +77 -0
- data/lib/elzar/chef_dna.rb +48 -0
- data/lib/elzar/template.rb +24 -0
- data/lib/elzar/templates/Gemfile +11 -0
- data/lib/elzar/templates/Vagrantfile.erb +16 -0
- data/lib/elzar/templates/dna.json +25 -0
- data/lib/elzar/templates/solo.rb.erb +6 -0
- data/lib/elzar/version.rb +3 -0
- data/roles/enterprise_appstack.rb +4 -0
- data/roles/plumbing.rb +11 -0
- data/roles/postgres_database.rb +4 -0
- data/roles/ruby_appstack.rb +4 -0
- data/script/install_cookbook +6 -0
- data/script/new_cookbook +5 -0
- data/site-cookbooks/.gitkeep +0 -0
- data/site-cookbooks/curl/README.md +17 -0
- data/site-cookbooks/curl/metadata.rb +6 -0
- data/site-cookbooks/curl/recipes/default.rb +11 -0
- data/site-cookbooks/nginx/CHANGELOG.md +11 -0
- data/site-cookbooks/nginx/CONTRIBUTING +29 -0
- data/site-cookbooks/nginx/LICENSE +201 -0
- data/site-cookbooks/nginx/README.md +76 -0
- data/site-cookbooks/nginx/attributes/default.rb +65 -0
- data/site-cookbooks/nginx/definitions/nginx_site.rb +35 -0
- data/site-cookbooks/nginx/files/default/mime.types +73 -0
- data/site-cookbooks/nginx/metadata.rb +89 -0
- data/site-cookbooks/nginx/recipes/default.rb +57 -0
- data/site-cookbooks/nginx/recipes/source.rb +126 -0
- data/site-cookbooks/nginx/templates/default/default-site.erb +11 -0
- data/site-cookbooks/nginx/templates/default/nginx.conf.erb +42 -0
- data/site-cookbooks/nginx/templates/default/nginx.init.erb +91 -0
- data/site-cookbooks/nginx/templates/default/nxdissite.erb +29 -0
- data/site-cookbooks/nginx/templates/default/nxensite.erb +38 -0
- data/site-cookbooks/passenger/README.md +12 -0
- data/site-cookbooks/passenger/attributes/default.rb +3 -0
- data/site-cookbooks/passenger/metadata.rb +6 -0
- data/site-cookbooks/passenger/recipes/default.rb +39 -0
- data/site-cookbooks/passenger/templates/default/passenger_nginx.conf.erb +2 -0
- data/site-cookbooks/postgresql/README.md +150 -0
- data/site-cookbooks/postgresql/attributes/default.rb +72 -0
- data/site-cookbooks/postgresql/metadata.rb +21 -0
- data/site-cookbooks/postgresql/recipes/client.rb +40 -0
- data/site-cookbooks/postgresql/recipes/default.rb +20 -0
- data/site-cookbooks/postgresql/recipes/server.rb +74 -0
- data/site-cookbooks/postgresql/recipes/server_debian.rb +62 -0
- data/site-cookbooks/postgresql/recipes/server_redhat.rb +82 -0
- data/site-cookbooks/postgresql/templates/default/debian.postgresql.conf.erb +499 -0
- data/site-cookbooks/postgresql/templates/default/pg_hba.conf.erb +83 -0
- data/site-cookbooks/postgresql/templates/default/redhat.postgresql.conf.erb +501 -0
- data/site-cookbooks/rails_app/README.md +15 -0
- data/site-cookbooks/rails_app/attributes/default.rb +2 -0
- data/site-cookbooks/rails_app/files/default/sudoers +26 -0
- data/site-cookbooks/rails_app/metadata.rb +6 -0
- data/site-cookbooks/rails_app/recipes/default.rb +143 -0
- data/site-cookbooks/rails_app/recipes/system_libraries.rb +12 -0
- data/site-cookbooks/rails_app/templates/default/pg_hba.conf.erb +84 -0
- data/site-cookbooks/rails_app/templates/default/rails_app_nginx.erb +10 -0
- data/site-cookbooks/ruby/README.md +12 -0
- data/site-cookbooks/ruby/attributes/default.rb +6 -0
- data/site-cookbooks/ruby/metadata.rb +6 -0
- data/site-cookbooks/ruby/recipes/default.rb +54 -0
- data/solo.rb +7 -0
- data/upgrade-chef.sh +8 -0
- metadata +272 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Attributes:: default
|
4
|
+
#
|
5
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
6
|
+
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
7
|
+
#
|
8
|
+
# Copyright 2009-2011, Opscode, Inc.
|
9
|
+
#
|
10
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
# you may not use this file except in compliance with the License.
|
12
|
+
# You may obtain a copy of the License at
|
13
|
+
#
|
14
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
#
|
16
|
+
# Unless required by applicable law or agreed to in writing, software
|
17
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
# See the License for the specific language governing permissions and
|
20
|
+
# limitations under the License.
|
21
|
+
#
|
22
|
+
|
23
|
+
default[:nginx][:version] = "0.8.54"
|
24
|
+
|
25
|
+
case platform
|
26
|
+
when "debian","ubuntu"
|
27
|
+
default[:nginx][:dir] = "/etc/nginx"
|
28
|
+
default[:nginx][:log_dir] = "/var/log/nginx"
|
29
|
+
default[:nginx][:user] = "www-data"
|
30
|
+
default[:nginx][:binary] = "/usr/sbin/nginx"
|
31
|
+
default[:nginx][:init_style] = "runit"
|
32
|
+
else
|
33
|
+
default[:nginx][:dir] = "/etc/nginx"
|
34
|
+
default[:nginx][:log_dir] = "/var/log/nginx"
|
35
|
+
default[:nginx][:user] = "www-data"
|
36
|
+
default[:nginx][:binary] = "/usr/sbin/nginx"
|
37
|
+
default[:nginx][:init_style] = "init"
|
38
|
+
end
|
39
|
+
|
40
|
+
default[:nginx][:pid] = "/var/run/nginx.pid"
|
41
|
+
|
42
|
+
default[:nginx][:gzip] = "on"
|
43
|
+
default[:nginx][:gzip_http_version] = "1.0"
|
44
|
+
default[:nginx][:gzip_comp_level] = "2"
|
45
|
+
default[:nginx][:gzip_proxied] = "any"
|
46
|
+
default[:nginx][:gzip_types] = [
|
47
|
+
"text/plain",
|
48
|
+
"text/html",
|
49
|
+
"text/css",
|
50
|
+
"application/x-javascript",
|
51
|
+
"text/xml",
|
52
|
+
"application/xml",
|
53
|
+
"application/xml+rss",
|
54
|
+
"text/javascript",
|
55
|
+
"application/javascript",
|
56
|
+
"application/json"
|
57
|
+
]
|
58
|
+
|
59
|
+
default[:nginx][:keepalive] = "on"
|
60
|
+
default[:nginx][:keepalive_timeout] = 65
|
61
|
+
default[:nginx][:worker_processes] = cpu[:total]
|
62
|
+
default[:nginx][:worker_connections] = 2048
|
63
|
+
default[:nginx][:server_names_hash_bucket_size] = 64
|
64
|
+
|
65
|
+
default[:nginx][:disable_access_log] = false
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Definition:: nginx_site
|
4
|
+
# Author:: AJ Christensen <aj@junglist.gen.nz>
|
5
|
+
#
|
6
|
+
# Copyright 2008-2009, 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
|
+
define :nginx_site, :enable => true do
|
22
|
+
if params[:enable]
|
23
|
+
execute "nxensite #{params[:name]}" do
|
24
|
+
command "/usr/sbin/nxensite #{params[:name]}"
|
25
|
+
notifies :reload, resources(:service => "nginx")
|
26
|
+
not_if do ::File.symlink?("#{node[:nginx][:dir]}/sites-enabled/#{params[:name]}") end
|
27
|
+
end
|
28
|
+
else
|
29
|
+
execute "nxdissite #{params[:name]}" do
|
30
|
+
command "/usr/sbin/nxdissite #{params[:name]}"
|
31
|
+
notifies :reload, resources(:service => "nginx")
|
32
|
+
only_if do ::File.symlink?("#{node[:nginx][:dir]}/sites-enabled/#{params[:name]}") end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
types {
|
2
|
+
text/html html htm shtml;
|
3
|
+
text/css css;
|
4
|
+
text/xml xml;
|
5
|
+
image/gif gif;
|
6
|
+
image/jpeg jpeg jpg;
|
7
|
+
application/x-javascript js;
|
8
|
+
application/json json;
|
9
|
+
application/atom+xml atom;
|
10
|
+
application/rss+xml rss;
|
11
|
+
|
12
|
+
text/mathml mml;
|
13
|
+
text/plain txt;
|
14
|
+
text/vnd.sun.j2me.app-descriptor jad;
|
15
|
+
text/vnd.wap.wml wml;
|
16
|
+
text/x-component htc;
|
17
|
+
|
18
|
+
image/png png;
|
19
|
+
image/tiff tif tiff;
|
20
|
+
image/vnd.wap.wbmp wbmp;
|
21
|
+
image/x-icon ico;
|
22
|
+
image/x-jng jng;
|
23
|
+
image/x-ms-bmp bmp;
|
24
|
+
image/svg+xml svg;
|
25
|
+
|
26
|
+
application/java-archive jar war ear;
|
27
|
+
application/mac-binhex40 hqx;
|
28
|
+
application/msword doc;
|
29
|
+
application/pdf pdf;
|
30
|
+
application/postscript ps eps ai;
|
31
|
+
application/rtf rtf;
|
32
|
+
application/vnd.ms-excel xls;
|
33
|
+
application/vnd.ms-powerpoint ppt;
|
34
|
+
application/vnd.wap.wmlc wmlc;
|
35
|
+
application/vnd.wap.xhtml+xml xhtml;
|
36
|
+
application/vnd.google-earth.kml+xml kml;
|
37
|
+
application/vnd.google-earth.kmz kmz;
|
38
|
+
application/x-cocoa cco;
|
39
|
+
application/x-java-archive-diff jardiff;
|
40
|
+
application/x-java-jnlp-file jnlp;
|
41
|
+
application/x-makeself run;
|
42
|
+
application/x-perl pl pm;
|
43
|
+
application/x-pilot prc pdb;
|
44
|
+
application/x-rar-compressed rar;
|
45
|
+
application/x-redhat-package-manager rpm;
|
46
|
+
application/x-sea sea;
|
47
|
+
application/x-shockwave-flash swf;
|
48
|
+
application/x-stuffit sit;
|
49
|
+
application/x-tcl tcl tk;
|
50
|
+
application/x-x509-ca-cert der pem crt;
|
51
|
+
application/x-xpinstall xpi;
|
52
|
+
application/zip zip;
|
53
|
+
|
54
|
+
application/octet-stream bin exe dll;
|
55
|
+
application/octet-stream deb;
|
56
|
+
application/octet-stream dmg;
|
57
|
+
application/octet-stream eot;
|
58
|
+
application/octet-stream iso img;
|
59
|
+
application/octet-stream msi msp msm;
|
60
|
+
|
61
|
+
audio/midi mid midi kar;
|
62
|
+
audio/mpeg mp3;
|
63
|
+
audio/x-realaudio ra;
|
64
|
+
|
65
|
+
video/3gpp 3gpp 3gp;
|
66
|
+
video/mpeg mpeg mpg;
|
67
|
+
video/quicktime mov;
|
68
|
+
video/x-flv flv;
|
69
|
+
video/x-mng mng;
|
70
|
+
video/x-ms-asf asx asf;
|
71
|
+
video/x-ms-wmv wmv;
|
72
|
+
video/x-msvideo avi;
|
73
|
+
}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
maintainer "Opscode, Inc."
|
2
|
+
maintainer_email "cookbooks@opscode.com"
|
3
|
+
license "Apache 2.0"
|
4
|
+
description "Installs and configures nginx"
|
5
|
+
version "0.100.0"
|
6
|
+
|
7
|
+
recipe "nginx", "Installs nginx package and sets up configuration with Debian apache style with sites-enabled/sites-available"
|
8
|
+
recipe "nginx::source", "Installs nginx from source and sets up configuration with Debian apache style with sites-enabled/sites-available"
|
9
|
+
|
10
|
+
%w{ ubuntu debian centos redhat fedora }.each do |os|
|
11
|
+
supports os
|
12
|
+
end
|
13
|
+
|
14
|
+
%w{ build-essential runit bluepill }.each do |cb|
|
15
|
+
depends cb
|
16
|
+
end
|
17
|
+
|
18
|
+
attribute "nginx/dir",
|
19
|
+
:display_name => "Nginx Directory",
|
20
|
+
:description => "Location of nginx configuration files",
|
21
|
+
:default => "/etc/nginx"
|
22
|
+
|
23
|
+
attribute "nginx/log_dir",
|
24
|
+
:display_name => "Nginx Log Directory",
|
25
|
+
:description => "Location for nginx logs",
|
26
|
+
:default => "/var/log/nginx"
|
27
|
+
|
28
|
+
attribute "nginx/user",
|
29
|
+
:display_name => "Nginx User",
|
30
|
+
:description => "User nginx will run as",
|
31
|
+
:default => "www-data"
|
32
|
+
|
33
|
+
attribute "nginx/binary",
|
34
|
+
:display_name => "Nginx Binary",
|
35
|
+
:description => "Location of the nginx server binary",
|
36
|
+
:default => "/usr/sbin/nginx"
|
37
|
+
|
38
|
+
attribute "nginx/gzip",
|
39
|
+
:display_name => "Nginx Gzip",
|
40
|
+
:description => "Whether gzip is enabled",
|
41
|
+
:default => "on"
|
42
|
+
|
43
|
+
attribute "nginx/gzip_http_version",
|
44
|
+
:display_name => "Nginx Gzip HTTP Version",
|
45
|
+
:description => "Version of HTTP Gzip",
|
46
|
+
:default => "1.0"
|
47
|
+
|
48
|
+
attribute "nginx/gzip_comp_level",
|
49
|
+
:display_name => "Nginx Gzip Compression Level",
|
50
|
+
:description => "Amount of compression to use",
|
51
|
+
:default => "2"
|
52
|
+
|
53
|
+
attribute "nginx/gzip_proxied",
|
54
|
+
:display_name => "Nginx Gzip Proxied",
|
55
|
+
:description => "Whether gzip is proxied",
|
56
|
+
:default => "any"
|
57
|
+
|
58
|
+
attribute "nginx/gzip_types",
|
59
|
+
:display_name => "Nginx Gzip Types",
|
60
|
+
:description => "Supported MIME-types for gzip",
|
61
|
+
:type => "array",
|
62
|
+
:default => [ "text/plain", "text/html", "text/css", "application/x-javascript", "text/xml", "application/xml", "application/xml+rss", "text/javascript" ]
|
63
|
+
|
64
|
+
attribute "nginx/keepalive",
|
65
|
+
:display_name => "Nginx Keepalive",
|
66
|
+
:description => "Whether to enable keepalive",
|
67
|
+
:default => "on"
|
68
|
+
|
69
|
+
attribute "nginx/keepalive_timeout",
|
70
|
+
:display_name => "Nginx Keepalive Timeout",
|
71
|
+
:default => "65"
|
72
|
+
|
73
|
+
attribute "nginx/worker_processes",
|
74
|
+
:display_name => "Nginx Worker Processes",
|
75
|
+
:description => "Number of worker processes",
|
76
|
+
:default => "1"
|
77
|
+
|
78
|
+
attribute "nginx/worker_connections",
|
79
|
+
:display_name => "Nginx Worker Connections",
|
80
|
+
:description => "Number of connections per worker",
|
81
|
+
:default => "1024"
|
82
|
+
|
83
|
+
attribute "nginx/server_names_hash_bucket_size",
|
84
|
+
:display_name => "Nginx Server Names Hash Bucket Size",
|
85
|
+
:default => "64"
|
86
|
+
|
87
|
+
attribute "nginx/disable_access_log",
|
88
|
+
:display_name => "Disable Access Log",
|
89
|
+
:default => "false"
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Recipe:: default
|
4
|
+
# Author:: AJ Christensen <aj@junglist.gen.nz>
|
5
|
+
#
|
6
|
+
# Copyright 2008-2009, 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
|
+
package "nginx"
|
22
|
+
|
23
|
+
directory node[:nginx][:log_dir] do
|
24
|
+
mode 0755
|
25
|
+
owner node[:nginx][:user]
|
26
|
+
action :create
|
27
|
+
end
|
28
|
+
|
29
|
+
%w{nxensite nxdissite}.each do |nxscript|
|
30
|
+
template "/usr/sbin/#{nxscript}" do
|
31
|
+
source "#{nxscript}.erb"
|
32
|
+
mode 0755
|
33
|
+
owner "root"
|
34
|
+
group "root"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
template "nginx.conf" do
|
39
|
+
path "#{node[:nginx][:dir]}/nginx.conf"
|
40
|
+
source "nginx.conf.erb"
|
41
|
+
owner "root"
|
42
|
+
group "root"
|
43
|
+
mode 0644
|
44
|
+
notifies :reload, "service[nginx]"
|
45
|
+
end
|
46
|
+
|
47
|
+
template "#{node[:nginx][:dir]}/sites-available/default" do
|
48
|
+
source "default-site.erb"
|
49
|
+
owner "root"
|
50
|
+
group "root"
|
51
|
+
mode 0644
|
52
|
+
end
|
53
|
+
|
54
|
+
service "nginx" do
|
55
|
+
supports :status => true, :restart => true, :reload => true
|
56
|
+
action [ :enable, :start ]
|
57
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: nginx
|
3
|
+
# Recipe:: source
|
4
|
+
#
|
5
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
6
|
+
# Author:: Joshua Timberman (<joshua@opscode.com>)
|
7
|
+
# Author:: Alex Redington (<lovemachine@thinkrelevance.com>)
|
8
|
+
#
|
9
|
+
# Copyright 2009-2011, Opscode, 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
|
+
include_recipe "build-essential"
|
25
|
+
|
26
|
+
packages = value_for_platform(
|
27
|
+
["centos","redhat","fedora"] => {'default' => ['pcre-devel', 'openssl-devel']},
|
28
|
+
"default" => ['libpcre3', 'libpcre3-dev', 'libssl-dev']
|
29
|
+
)
|
30
|
+
|
31
|
+
packages.each do |devpkg|
|
32
|
+
package devpkg
|
33
|
+
end
|
34
|
+
|
35
|
+
nginx_version = node[:nginx][:version]
|
36
|
+
|
37
|
+
node.set[:nginx][:install_path] = "/opt/nginx-#{nginx_version}"
|
38
|
+
node.set[:nginx][:src_binary] = "#{node[:nginx][:install_path]}/sbin/nginx"
|
39
|
+
node.set[:nginx][:daemon_disable] = false
|
40
|
+
node.set[:nginx][:configure_flags] = [
|
41
|
+
"--prefix=#{node[:nginx][:install_path]}",
|
42
|
+
"--conf-path=#{node[:nginx][:dir]}/nginx.conf",
|
43
|
+
"--with-http_ssl_module",
|
44
|
+
"--with-http_gzip_static_module"
|
45
|
+
]
|
46
|
+
|
47
|
+
configure_flags = node[:nginx][:configure_flags].join(" ")
|
48
|
+
|
49
|
+
remote_file "#{Chef::Config[:file_cache_path]}/nginx-#{nginx_version}.tar.gz" do
|
50
|
+
source "http://nginx.org/download/nginx-#{nginx_version}.tar.gz"
|
51
|
+
action :create_if_missing
|
52
|
+
end
|
53
|
+
|
54
|
+
bash "compile_nginx_source" do
|
55
|
+
cwd Chef::Config[:file_cache_path]
|
56
|
+
code <<-EOH
|
57
|
+
tar zxf nginx-#{nginx_version}.tar.gz
|
58
|
+
cd nginx-#{nginx_version} && ./configure #{configure_flags}
|
59
|
+
make && make install
|
60
|
+
EOH
|
61
|
+
creates node[:nginx][:src_binary]
|
62
|
+
end
|
63
|
+
|
64
|
+
user node[:nginx][:user] do
|
65
|
+
system true
|
66
|
+
shell "/bin/false"
|
67
|
+
home "/var/www"
|
68
|
+
end
|
69
|
+
|
70
|
+
directory node[:nginx][:log_dir] do
|
71
|
+
mode 0755
|
72
|
+
owner node[:nginx][:user]
|
73
|
+
action :create
|
74
|
+
end
|
75
|
+
|
76
|
+
directory node[:nginx][:dir] do
|
77
|
+
owner "root"
|
78
|
+
group "root"
|
79
|
+
mode "0755"
|
80
|
+
end
|
81
|
+
|
82
|
+
template "/etc/init.d/nginx" do
|
83
|
+
source "nginx.init.erb"
|
84
|
+
owner "root"
|
85
|
+
group "root"
|
86
|
+
mode "0755"
|
87
|
+
end
|
88
|
+
|
89
|
+
#register service
|
90
|
+
service "nginx" do
|
91
|
+
supports :status => true, :restart => true, :reload => true
|
92
|
+
action :enable
|
93
|
+
end
|
94
|
+
|
95
|
+
%w{ sites-available sites-enabled conf.d }.each do |dir|
|
96
|
+
directory "#{node[:nginx][:dir]}/#{dir}" do
|
97
|
+
owner "root"
|
98
|
+
group "root"
|
99
|
+
mode "0755"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
%w{nxensite nxdissite}.each do |nxscript|
|
104
|
+
template "/usr/sbin/#{nxscript}" do
|
105
|
+
source "#{nxscript}.erb"
|
106
|
+
mode "0755"
|
107
|
+
owner "root"
|
108
|
+
group "root"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
template "nginx.conf" do
|
113
|
+
path "#{node[:nginx][:dir]}/nginx.conf"
|
114
|
+
source "nginx.conf.erb"
|
115
|
+
owner "root"
|
116
|
+
group "root"
|
117
|
+
mode "0644"
|
118
|
+
end
|
119
|
+
|
120
|
+
cookbook_file "#{node[:nginx][:dir]}/mime.types" do
|
121
|
+
source "mime.types"
|
122
|
+
owner "root"
|
123
|
+
group "root"
|
124
|
+
mode "0644"
|
125
|
+
notifies :start, resources(:service => "nginx"), :immediately
|
126
|
+
end
|