Browse files

COOK-441, COOK-442, COOK-443 fixes

* COOK-441, directory name (install_path) matches version better
* COOK-442, move derived attributes to source recipe
* COOK-443, use 0.8.54 for version (latest stable)
  • Loading branch information...
1 parent 11b9d1d commit ea3c899548c214753920ff077ab326c4ed3e3745 @jtimberman jtimberman committed Jan 17, 2011
View
49 nginx/README.rdoc → nginx/README.md
@@ -1,35 +1,47 @@
-= DESCRIPTION:
+DESCRIPTION
+====
Installs nginx from package OR source code and sets up configuration handling similar to Debian's Apache2 scripts.
-= REQUIREMENTS:
+REQUIREMENTS
+====
-== Cookbooks:
+Cookbooks
+----
* build-essential (for nginx::source)
+* runit (for nginx::source)
-== Platform:
+Platform
+----
Debian or Ubuntu though may work where 'build-essential' works, but other platforms are untested.
-= ATTRIBUTES:
+ATTRIBUTES
+====
+
+All node attributes are set under the `nginx` namespace.
* version - sets the version to install.
-* install_path - for nginx::source, sets the --prefix installation.
-* src_binary - for nginx::source, sets the binary location.
* dir - configuration dir.
-* log_dir - where logs go.
+* `log_dir` - where logs go.
* user - user to run as.
* binary - path to nginx binary.
-* configure_flags - for nginx::source, the flags to use for compilation.
-* gzip* - configure the gzip module.
+* gzip - all attributes under the `gzip` namespace configure the gzip module.
* keepalive - whether to use keepalive.
-* keepalive_timeout
-* worker_processes - number of workers to spawn.
-* worker_connections - number of connections per worker.
-* server_names_hash_bucket_size
+* `keepalive_timeout` - set the keepalive timeout.
+* `worker_processes` - number of workers to spawn.
+* `worker_connections` - number of connections per worker.
+* `server_names_hash_bucket_size`
+
+The following attributes are set at the 'normal' node level via the `nginx::source` recipe.
-= USAGE:
+* `install_path` - for nginx::source, sets the --prefix installation.
+* `src_binary` - for nginx::source, sets the binary location.
+* `configure_flags` - for nginx::source, an array of flags to use for compilation.
+
+USAGE
+====
Provides two ways to install and configure nginx.
@@ -40,13 +52,16 @@ Both recipes implement configuration handling similar to the Debian Apache2 site
There's some redundancy in that the config handling hasn't been separated from the installation method (yet), so use only one of the recipes.
-= LICENSE and AUTHOR:
+Some of the attributes mentioned above are only set in the `nginx::source` recipe. They can be overridden by setting them via a role in `override_attributes`.
+
+LICENSE and AUTHOR
+====
Author:: Joshua Timberman (<joshua@opscode.com>)
Author:: Adam Jacob (<adam@opscode.com>)
Author:: AJ Christensen (<aj@opscode.com>)
-Copyright:: 2008-2010, Opscode, Inc
+Copyright:: 2008-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.
View
11 nginx/attributes/default.rb
@@ -1,6 +1,4 @@
-default[:nginx][:version] = "0.7.67"
-default[:nginx][:install_path] = "/opt/nginx-#{nginx[:version]}"
-default[:nginx][:src_binary] = "#{nginx[:install_path]}/sbin/nginx"
+default[:nginx][:version] = "0.8.54"
case platform
when "debian","ubuntu"
@@ -15,13 +13,6 @@
set[:nginx][:binary] = "/usr/sbin/nginx"
end
-default[:nginx][:configure_flags] = [
- "--prefix=#{nginx[:install_path]}",
- "--conf-path=#{nginx[:dir]}/nginx.conf",
- "--with-http_ssl_module",
- "--with-http_gzip_static_module"
-]
-
default[:nginx][:gzip] = "on"
default[:nginx][:gzip_http_version] = "1.0"
default[:nginx][:gzip_comp_level] = "2"
View
460 nginx/metadata.json
@@ -1,255 +1,255 @@
{
- "providing": {
+ "name": "nginx",
+ "description": "Installs and configures nginx",
+ "long_description": "",
+ "maintainer": "Opscode, Inc.",
+ "maintainer_email": "cookbooks@opscode.com",
+ "license": "Apache 2.0",
+ "platforms": {
+ "ubuntu": [
+
+ ],
+ "debian": [
+
+ ],
+ "centos": [
+
+ ],
+ "redhat": [
+
+ ],
+ "fedora": [
+
+ ]
+ },
+ "dependencies": {
+ "build-essential": [
+
+ ],
+ "runit": [
+
+ ]
+ },
+ "recommendations": {
+ },
+ "suggestions": {
+ },
+ "conflicting": {
+ },
+ "providing": {
+ },
+ "replacing": {
+ },
+ "attributes": {
+ "nginx/dir": {
+ "display_name": "Nginx Directory",
+ "description": "Location of nginx configuration files",
+ "default": "/etc/nginx",
+ "choice": [
+
+ ],
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
+
+ ]
},
- "platforms": {
- "debian": [
+ "nginx/log_dir": {
+ "display_name": "Nginx Log Directory",
+ "description": "Location for nginx logs",
+ "default": "/var/log/nginx",
+ "choice": [
],
- "fedora": [
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
+
+ ]
+ },
+ "nginx/user": {
+ "display_name": "Nginx User",
+ "description": "User nginx will run as",
+ "default": "www-data",
+ "choice": [
],
- "centos": [
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
+
+ ]
+ },
+ "nginx/binary": {
+ "display_name": "Nginx Binary",
+ "description": "Location of the nginx server binary",
+ "default": "/usr/sbin/nginx",
+ "choice": [
],
- "ubuntu": [
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
+
+ ]
+ },
+ "nginx/gzip": {
+ "display_name": "Nginx Gzip",
+ "description": "Whether gzip is enabled",
+ "default": "on",
+ "choice": [
],
- "redhat": [
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
]
},
- "description": "Installs and configures nginx",
- "attributes": {
- "nginx/worker_connections": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "1024",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx Worker Connections",
- "description": "Number of connections per worker"
- },
- "nginx/gzip_types": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": [
- "text/plain",
- "text/html",
- "text/css",
- "application/x-javascript",
- "text/xml",
- "application/xml",
- "application/xml+rss",
- "text/javascript"
- ],
- "type": "array",
- "recipes": [
-
- ],
- "display_name": "Nginx Gzip Types",
- "description": "Supported MIME-types for gzip"
- },
- "nginx/binary": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "/usr/sbin/nginx",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx Binary",
- "description": "Location of the nginx server binary"
- },
- "nginx/user": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "www-data",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx User",
- "description": "User nginx will run as"
- },
- "nginx/keepalive_timeout": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "65",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx Keepalive Timeout"
- },
- "nginx/gzip_proxied": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "any",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx Gzip Proxied",
- "description": "Whether gzip is proxied"
- },
- "nginx/gzip_comp_level": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "2",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx Gzip Compression Level",
- "description": "Amount of compression to use"
- },
- "nginx/dir": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "/etc/nginx",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx Directory",
- "description": "Location of nginx configuration files"
- },
- "nginx/server_names_hash_bucket_size": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "64",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx Server Names Hash Bucket Size"
- },
- "nginx/worker_processes": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "1",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx Worker Processes",
- "description": "Number of worker processes"
- },
- "nginx/gzip_http_version": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "1.0",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx Gzip HTTP Version",
- "description": "Version of HTTP Gzip"
- },
- "nginx/log_dir": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "/var/log/nginx",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx Log Directory",
- "description": "Location for nginx logs"
- },
- "nginx/gzip": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "on",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx Gzip",
- "description": "Whether gzip is enabled"
- },
- "nginx/keepalive": {
- "required": "optional",
- "calculated": false,
- "choice": [
-
- ],
- "default": "on",
- "type": "string",
- "recipes": [
-
- ],
- "display_name": "Nginx Keepalive",
- "description": "Whether to enable keepalive"
- }
+ "nginx/gzip_http_version": {
+ "display_name": "Nginx Gzip HTTP Version",
+ "description": "Version of HTTP Gzip",
+ "default": "1.0",
+ "choice": [
+
+ ],
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
+
+ ]
},
- "replacing": {
+ "nginx/gzip_comp_level": {
+ "display_name": "Nginx Gzip Compression Level",
+ "description": "Amount of compression to use",
+ "default": "2",
+ "choice": [
+
+ ],
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
+
+ ]
},
- "dependencies": {
- "runit": [
+ "nginx/gzip_proxied": {
+ "display_name": "Nginx Gzip Proxied",
+ "description": "Whether gzip is proxied",
+ "default": "any",
+ "choice": [
],
- "build-essential": [
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
]
},
- "version": "0.14.4",
- "groupings": {
+ "nginx/gzip_types": {
+ "display_name": "Nginx Gzip Types",
+ "description": "Supported MIME-types for gzip",
+ "type": "array",
+ "default": [
+ "text/plain",
+ "text/html",
+ "text/css",
+ "application/x-javascript",
+ "text/xml",
+ "application/xml",
+ "application/xml+rss",
+ "text/javascript"
+ ],
+ "choice": [
+
+ ],
+ "calculated": false,
+ "required": "optional",
+ "recipes": [
+
+ ]
},
- "long_description": "",
- "recommendations": {
+ "nginx/keepalive": {
+ "display_name": "Nginx Keepalive",
+ "description": "Whether to enable keepalive",
+ "default": "on",
+ "choice": [
+
+ ],
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
+
+ ]
},
- "maintainer": "Opscode, Inc.",
- "suggestions": {
+ "nginx/keepalive_timeout": {
+ "display_name": "Nginx Keepalive Timeout",
+ "default": "65",
+ "choice": [
+
+ ],
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
+
+ ]
},
- "license": "Apache 2.0",
- "name": "nginx",
- "maintainer_email": "cookbooks@opscode.com",
- "recipes": {
- "nginx::source": "Installs nginx from source and sets up configuration with Debian apache style with sites-enabled/sites-available",
- "nginx": "Installs nginx package and sets up configuration with Debian apache style with sites-enabled/sites-available"
+ "nginx/worker_processes": {
+ "display_name": "Nginx Worker Processes",
+ "description": "Number of worker processes",
+ "default": "1",
+ "choice": [
+
+ ],
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
+
+ ]
},
- "conflicting": {
+ "nginx/worker_connections": {
+ "display_name": "Nginx Worker Connections",
+ "description": "Number of connections per worker",
+ "default": "1024",
+ "choice": [
+
+ ],
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
+
+ ]
+ },
+ "nginx/server_names_hash_bucket_size": {
+ "display_name": "Nginx Server Names Hash Bucket Size",
+ "default": "64",
+ "choice": [
+
+ ],
+ "calculated": false,
+ "type": "string",
+ "required": "optional",
+ "recipes": [
+
+ ]
}
- }
+ },
+ "groupings": {
+ },
+ "recipes": {
+ "nginx": "Installs nginx package and sets up configuration with Debian apache style with sites-enabled/sites-available",
+ "nginx::source": "Installs nginx from source and sets up configuration with Debian apache style with sites-enabled/sites-available"
+ },
+ "version": "0.99.0"
+}
View
2 nginx/metadata.rb
@@ -2,7 +2,7 @@
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Installs and configures nginx"
-version "0.14.4"
+version "0.99.0"
recipe "nginx", "Installs nginx package and sets up configuration with Debian apache style with sites-enabled/sites-available"
recipe "nginx::source", "Installs nginx from source and sets up configuration with Debian apache style with sites-enabled/sites-available"
View
18 nginx/recipes/source.rb
@@ -5,7 +5,7 @@
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Joshua Timberman (<joshua@opscode.com>)
#
-# Copyright 2009, Opscode, Inc.
+# 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.
@@ -36,16 +36,26 @@
end
nginx_version = node[:nginx][:version]
+
+node.set[:nginx][:install_path] = "/opt/nginx-#{nginx_version}"
+node.set[:nginx][:src_binary] = "#{node[:nginx][:install_path]}/sbin/nginx"
+node.set[:nginx][:daemon_disable] = true
+node.set[:nginx][:configure_flags] = [
+ "--prefix=#{node[:nginx][:install_path]}",
+ "--conf-path=#{node[:nginx][:dir]}/nginx.conf",
+ "--with-http_ssl_module",
+ "--with-http_gzip_static_module"
+]
+
configure_flags = node[:nginx][:configure_flags].join(" ")
-node.set[:nginx][:daemon_disable] = true
-remote_file "/tmp/nginx-#{nginx_version}.tar.gz" do
+remote_file "#{Chef::Config[:file_cache_path]}/nginx-#{nginx_version}.tar.gz" do
source "http://sysoev.ru/nginx/nginx-#{nginx_version}.tar.gz"
action :create_if_missing
end
bash "compile_nginx_source" do
- cwd "/tmp"
+ cwd Chef::Config[:file_cache_path]
code <<-EOH
tar zxf nginx-#{nginx_version}.tar.gz
cd nginx-#{nginx_version} && ./configure #{configure_flags}
View
2 nginx/templates/default/sv-nginx-run.erb
@@ -1,3 +1,3 @@
#!/bin/sh
exec 2>&1
-exec <%= node[:nginx][:install_path] %>/sbin/nginx -c <%= node[:nginx][:dir] %>/nginx.conf
+exec <%= node[:nginx][:src_binary] %> -c <%= node[:nginx][:dir] %>/nginx.conf

0 comments on commit ea3c899

Please sign in to comment.