Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[COOK-2183] Install nginx package from nginx yum repo Edit #77

Merged
merged 7 commits into from

3 participants

Commits on Feb 18, 2013
  1. @dje
Commits on Feb 20, 2013
  1. added nginx.org's yum repo as an attribute option for RHEL-alike pack…

    Nick Rycar authored Chris Lundquist committed
    …age installs
  2. Helps if I get my attributes right

    Nick Rycar authored Chris Lundquist committed
  3. Also helps if I don't mix up url and mirrorlist.

    Nick Rycar authored Chris Lundquist committed
  4. [COOK-2183] make adding nginx repo more cross platform

    Chris Lundquist authored
  5. Merge remote-tracking branch 'hw/feature/nginx.org-ubuntu-packages' i…

    Chris Lundquist authored
    …nto repoadd
  6. [repo_add] incorporate hw changes where possible

    Chris Lundquist authored
This page is out of date. Refresh to see the latest.
View
8 README.md
@@ -23,6 +23,9 @@ be controlled by an attribute, so it may not be a common "default."
On RHEL family distros, the "yum" cookbook is required for "`recipe[yum::epel]`".
+On Ubuntu, when using Nginx.org's stable package, "`recipe[apt]`"
+is required.
+
Platform
--------
@@ -229,10 +232,13 @@ These attributes are used in the `nginx::http_echo_module` recipe.
Recipes
=======
-This cookbook provides two main recipes for installing Nginx.
+This cookbook provides three main recipes for installing Nginx.
* default.rb: *Use this recipe* if you have a native package for
Nginx.
+* repo.rb: The developer of Nginx also maintain
+ [stable packages](http://nginx.org/en/download.html) for several
+ platforms.
* source.rb: *Use this recipe* if you do not have a native package for
Nginx, or if you want to install a newer version than is available,
or if you have custom module compilation needs.
View
1  attributes/default.rb
@@ -37,6 +37,7 @@
when "redhat","centos","scientific","amazon","oracle","fedora"
default['nginx']['user'] = "nginx"
default['nginx']['init_style'] = "init"
+ default['nginx']['repo_source'] = "epel"
else
default['nginx']['user'] = "www-data"
default['nginx']['init_style'] = "init"
View
30 attributes/repo.rb
@@ -0,0 +1,30 @@
+# Cookbook Name:: nginx
+# Recipe:: repo
+# Author:: Nick Rycar <nrycar@bluebox.net>
+#
+# Copyright 2008-2012, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+case node['platform_family']
+when 'rhel','fedora'
+ case node['platform']
+ when "centos"
+ # See http://wiki.nginx.org/Install
+ default['nginx']['upstream_repository'] = "http://nginx.org/packages/centos/#{node['platform_version'].to_i}/$basearch/"
+ else
+ default['nginx']['upstream_repository'] = "http://nginx.org/packages/rhel/#{node['platform_version'].to_i}/$basearch/"
+ end
+when 'debian'
+ default['nginx']['upstream_repository'] = "http://nginx.org/packages/#{node['platform']}"
+end
View
4 metadata.rb
@@ -12,13 +12,13 @@
supports os
end
-%w{ build-essential }.each do |cb|
+%w{ build-essential yum apt }.each do |cb|
depends cb
end
depends 'ohai', '>= 1.1.4'
-%w{ bluepill yum }.each do |cb|
+%w{ bluepill }.each do |cb|
recommends cb
end
View
6 recipes/default.rb
@@ -26,7 +26,11 @@
when 'package'
case node['platform']
when 'redhat','centos','scientific','amazon','oracle'
- include_recipe 'yum::epel'
+ if node['nginx']['repo_source'] == 'epel'
+ include_recipe 'yum::epel'
+ else
+ include_recipe 'nginx::repo'
+ end
end
package node['nginx']['package_name']
service 'nginx' do
View
39 recipes/repo.rb
@@ -0,0 +1,39 @@
+# Cookbook Name:: nginx
+# Recipe:: repo
+# Author:: Nick Rycar <nrycar@bluebox.net>
+#
+# Copyright 2008-2012, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+case node['platform_family']
+when "rhel","fedora"
+ include_recipe "yum"
+
+ yum_repository "nginx" do
+ description "Nginx.org Repository"
+ url node['nginx']['upstream_repository']
+ key 'http://nginx.org/keys/nginx_signing.key'
+ end
+when "debian"
+ include_recipe "apt"
+
+ apt_repository "nginx" do
+ description "Nginx.org Repository"
+ uri node['nginx']['upstream_repository']
+ distribution node['lsb']['codename']
+ components ["nginx"]
+ deb_src true
+ key 'http://nginx.org/keys/nginx_signing.key'
+ end
+end
Something went wrong with that request. Please try again.