Skip to content
This repository was archived by the owner on Jan 16, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
driver:
require_chef_omnibus: <%= ENV.fetch("CHEF_VERSION", "latest") %>
ssh_key: <%= File.expand_path("./test/support/keys/vagrant") %>
#ssh_key: <%= File.expand_path("./test/support/keys/vagrant") %>
name: vagrant

provisioner:
Expand All @@ -12,6 +12,7 @@ platforms:
- name: ubuntu-14.04
- name: debian-6.0.8
- name: debian-7.4
- name: centos-6.7

suites:
- name: server
Expand Down
15 changes: 5 additions & 10 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
LineLength:
Max: 80
Exclude:
- "**/attributes/*.rb"
- "**/metadata.rb"

StringLiterals:
EnforcedStyle: double_quotes
Max: 200

StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
Style/RegexpLiteral:
Exclude:
- 'Guardfile'

PercentLiteralDelimiters:
PreferredDelimiters:
"%w": "[]" # Arrays use brackets

SingleSpaceBeforeFirstArg:
SpaceBeforeFirstArg:
Enabled: false # too strict about metadata and certain formatting

inherit_from: test/support/rubocop/enabled.yml
Expand Down
2 changes: 1 addition & 1 deletion Berksfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source "https://api.berkshelf.com"
source 'https://api.berkshelf.com'

metadata
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

This file is used to list changes made in each version of nginx.

## 0.7.0 (2016-04-06)

* Support for CentOS, tested against CentOS 6.7
* Verify test coverage on CentOS
* Removed ssh configuration in kitchen, files not included with repo
* Rubocop changes
* Max Line Length = 200
* Change " to ' and replace interpolation and quoting rubocop lines

## 0.6.0 (2015-01-17)

* Add `nginx_site` LWRP
Expand Down
24 changes: 12 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
source "https://rubygems.org"
source 'https://rubygems.org'

chef_version = ENV.fetch("CHEF_VERSION", "11.16")
chef_version = ENV.fetch('CHEF_VERSION', '11.16')

gem "chef", "~> #{chef_version}"
gem "chefspec", "~> 4.2.0" if chef_version =~ /^11/
gem 'chef', "~> #{chef_version}"
gem 'chefspec', '~> 4.2.0' if chef_version =~ /^11/

gem "berkshelf", "~> 3.2.1"
gem "foodcritic", "~> 4.0.0"
gem "rake"
gem "rubocop", "~> 0.28.0"
gem "serverspec", "~> 2.7.1"
gem 'berkshelf', '~> 3.2.1'
gem 'foodcritic', '~> 4.0.0'
gem 'rake'
gem 'rubocop', '~> 0.28.0'
gem 'serverspec', '~> 2.7.1'

group :integration do
gem "busser-serverspec", "~> 0.5.3"
gem "kitchen-vagrant", "~> 0.15.0"
gem "test-kitchen", "~> 1.3.1"
gem 'busser-serverspec', '~> 0.5.3'
gem 'kitchen-vagrant', '~> 0.15.0'
gem 'test-kitchen', '~> 1.3.1'
end
5 changes: 3 additions & 2 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
guard :rspec, cmd: "rspec --color", all_on_start: false do
guard :rspec, cmd: 'rspec --color', all_on_start: false do
# watch(/^spec\/(.+)_spec\.rb$/)
watch(/^spec\/(.+)_spec\.rb$/)
watch(/^recipes\/(.+)\.rb$/) { |m| "spec/#{m[1]}_spec.rb" }
watch("spec/spec_helper.rb") { "spec" }
watch('spec/spec_helper.rb') { 'spec' }
end
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ recipes should run on these platforms without error:

### Cookbooks

* [apt](http://community.opscode.com/cookbooks/apt) Opscode LWRP Cookbook
* [apt](http://supermarket.chef.io/cookbooks/apt) - apt Cookbook
* [yum](http://supermarket.chef.io/cookbooks/yum) - yum Cookbook
* [yum-nginx](http://supermarket.chef.io/cookbooks/yum-nginx) - yum-nginx Cookbook

### Chef

Expand Down Expand Up @@ -286,6 +288,8 @@ Many thanks go to the following [contributors](https://github.com/phlipper/chef-
* Script for enabling and disabling sites, added and renamed by [@arvidbjorkstrom](https://github.com/arvidbjorkstrom)
* **[@morr](https://github.com/morr)**
* update `mime.types` to support web fonts correctly
* **[@mengesb](https://github.com/mengesb)**
* add CentOS support


## License
Expand Down
22 changes: 11 additions & 11 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
task default: "test"
task default: 'test'

desc "Run all tests except `kitchen`"
desc 'Run all tests except `kitchen`'
task test: [:rubocop, :foodcritic, :chefspec]

desc "Run all tests"
task all_tests: [:rubocop, :foodcritic, :chefspec, "kitchen:all"]
desc 'Run all tests'
task all_tests: [:rubocop, :foodcritic, :chefspec, 'kitchen:all']

# rubocop style checker
require "rubocop/rake_task"
require 'rubocop/rake_task'
RuboCop::RakeTask.new

# foodcritic chef lint
require "foodcritic"
require 'foodcritic'
FoodCritic::Rake::LintTask.new do |t|
t.options = { fail_tags: ["any"] }
t.options = { fail_tags: ['any'] }
end

# chefspec unit tests
require "rspec/core/rake_task"
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:chefspec) do |t|
t.rspec_opts = "--color --format progress"
t.rspec_opts = '--color --format progress'
end

# test-kitchen integration tests
begin
require "kitchen/rake_tasks"
require 'kitchen/rake_tasks'
Kitchen::RakeTasks.new
rescue LoadError
task("kitchen:all") { puts "Unable to run `test-kitchen`" }
task('kitchen:all') { puts 'Unable to run `test-kitchen`' }
end
182 changes: 97 additions & 85 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,117 +7,129 @@
# Copyright 2013, Phil Cohen
#

default["nginx"]["dir"] = "/etc/nginx"
default["nginx"]["log_dir"] = "/var/log/nginx"
default["nginx"]["user"] = "www-data"
default["nginx"]["bin_dir"] = "/usr/sbin"
default["nginx"]["binary"] = "/usr/sbin/nginx"
default["nginx"]["pid_file"] = "/var/run/nginx.pid"
default["nginx"]["version"] = nil
default["nginx"]["package_name"] = "nginx" # nginx[-light|full|extras]

default["nginx"]["log_format"] = <<-FORMAT
case node['platform_family']
when 'debian'
default['nginx']['user'] = 'www-data'
default['nginx']['group'] = 'www-data'
when 'rhel'
default['nginx']['user'] = 'nginx'
default['nginx']['group'] = 'nginx'
else
default['nginx']['user'] = 'www-data'
default['nginx']['group'] = 'www-data'
end

default['nginx']['dir'] = '/etc/nginx'
default['nginx']['log_dir'] = '/var/log/nginx'
# default["nginx"]["user"] = "www-data"
default['nginx']['bin_dir'] = '/usr/sbin'
default['nginx']['binary'] = '/usr/sbin/nginx'
default['nginx']['pid_file'] = '/var/run/nginx.pid'
default['nginx']['version'] = nil
default['nginx']['package_name'] = 'nginx' # nginx[-light|full|extras]

default['nginx']['log_format'] = <<-FORMAT
'$remote_addr $host $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" "$http_user_agent" "$gzip_ratio"'
FORMAT

default["nginx"]["daemon_disable"] = false
default['nginx']['daemon_disable'] = false

default["nginx"]["use_poll"] = true
default['nginx']['use_poll'] = true

default["nginx"]["gzip"] = "on"
default["nginx"]["gzip_http_version"] = "1.0"
default["nginx"]["gzip_buffers"] = "16 8k"
default["nginx"]["gzip_comp_level"] = "2"
default["nginx"]["gzip_proxied"] = "any"
default["nginx"]["gzip_vary"] = "on"
default["nginx"]["gzip_min_length"] = "0"
default["nginx"]["gzip_disable"] = %|"MSIE [1-6].(?!.*SV1)"|
default["nginx"]["gzip_types"] = %w[
default['nginx']['gzip'] = 'on'
default['nginx']['gzip_http_version'] = '1.0'
default['nginx']['gzip_buffers'] = '16 8k'
default['nginx']['gzip_comp_level'] = '2'
default['nginx']['gzip_proxied'] = 'any'
default['nginx']['gzip_vary'] = 'on'
default['nginx']['gzip_min_length'] = '0'
default['nginx']['gzip_disable'] = %|"MSIE [1-6].(?!.*SV1)"|
default['nginx']['gzip_types'] = %w[
text/css text/javascript text/xml text/plain text/x-component
application/x-javascript application/javascript application/json
application/xml application/rss+xml image/svg+xml
font/truetype font/opentype application/vnd.ms-fontobject
]

default["nginx"]["ignore_invalid_headers"] = "on"
default["nginx"]["recursive_error_pages"] = "on"
default["nginx"]["sendfile"] = "on"
default["nginx"]["server_name_in_redirect"] = "off"
default["nginx"]["server_tokens"] = "off"

default["nginx"]["buffers_enable"] = false
default["nginx"]["client_body_temp_path"] = "/var/spool/nginx-client-body 1 2"
default["nginx"]["client_body_buffer_size"] = "8k"
default["nginx"]["client_header_buffer_size"] = "1k"
default["nginx"]["client_max_body_size"] = "1m"
default["nginx"]["large_client_header_buffers"] = "4 8k"

default["nginx"]["tcp_nopush"] = "on"
default["nginx"]["tcp_nodelay"] = "off"

default["nginx"]["proxy_set_headers"] = [
"X-Real-IP $remote_addr",
"X-Forwarded-For $proxy_add_x_forwarded_for",
"Host $http_host"
default['nginx']['ignore_invalid_headers'] = 'on'
default['nginx']['recursive_error_pages'] = 'on'
default['nginx']['sendfile'] = 'on'
default['nginx']['server_name_in_redirect'] = 'off'
default['nginx']['server_tokens'] = 'off'

default['nginx']['buffers_enable'] = false
default['nginx']['client_body_temp_path'] = '/var/spool/nginx-client-body 1 2'
default['nginx']['client_body_buffer_size'] = '8k'
default['nginx']['client_header_buffer_size'] = '1k'
default['nginx']['client_max_body_size'] = '1m'
default['nginx']['large_client_header_buffers'] = '4 8k'

default['nginx']['tcp_nopush'] = 'on'
default['nginx']['tcp_nodelay'] = 'off'

default['nginx']['proxy_set_headers'] = [
'X-Real-IP $remote_addr',
'X-Forwarded-For $proxy_add_x_forwarded_for',
'Host $http_host'
]
default["nginx"]["proxy_redirect"] = "off"
default["nginx"]["proxy_max_temp_file_size"] = nil
default["nginx"]["proxy_read_timeout"] = nil
default['nginx']['proxy_redirect'] = 'off'
default['nginx']['proxy_max_temp_file_size'] = nil
default['nginx']['proxy_read_timeout'] = nil

default["nginx"]["keepalive"] = "on"
default["nginx"]["keepalive_timeout"] = 65
default["nginx"]["send_timeout"] = 5
default["nginx"]["client_header_timeout"] = 5
default["nginx"]["client_body_timeout"] = 5
default['nginx']['keepalive'] = 'on'
default['nginx']['keepalive_timeout'] = 65
default['nginx']['send_timeout'] = 5
default['nginx']['client_header_timeout'] = 5
default['nginx']['client_body_timeout'] = 5

default["nginx"]["worker_processes"] = node["cpu"]["total"]
default["nginx"]["worker_connections"] = node["cpu"]["total"].to_i * 1024
default["nginx"]["server_names_hash_bucket_size"] = 64
default['nginx']['worker_processes'] = node['cpu']['total']
default['nginx']['worker_connections'] = node['cpu']['total'].to_i * 1024
default['nginx']['server_names_hash_bucket_size'] = 64

default["nginx"]["conf_files"] = %w[
default['nginx']['conf_files'] = %w[
buffers general gzip logs performance proxy ssl_session timeouts
]

default["nginx"]["ssl_session_cache_enable"] = true
default["nginx"]["ssl_session_cache"] = "shared:SSL:10m"
default["nginx"]["ssl_session_timeout"] = "10m"
default['nginx']['ssl_session_cache_enable'] = true
default['nginx']['ssl_session_cache'] = 'shared:SSL:10m'
default['nginx']['ssl_session_timeout'] = '10m'

default["nginx"]["passenger_enable"] = false
default["nginx"]["passenger_max_pool_size"] = 6
default["nginx"]["passenger_pool_idle_time"] = 300
default['nginx']['passenger_enable'] = false
default['nginx']['passenger_max_pool_size'] = 6
default['nginx']['passenger_pool_idle_time'] = 300

default["nginx"]["enable_stub_status"] = true
default["nginx"]["status_port"] = 80
default['nginx']['enable_stub_status'] = true
default['nginx']['status_port'] = 80

default["nginx"]["skip_default_site"] = false
default['nginx']['skip_default_site'] = false

default["nginx"]["repository"] = "official"
default["nginx"]["repository_sources"] = {
"official" => {
"uri" => "http://nginx.org/packages/#{node["platform"]}",
"distribution" => node["lsb"]["codename"],
"components" => ["nginx"],
"keyserver" => nil,
"key" => "http://nginx.org/keys/nginx_signing.key",
"deb_src" => false
default['nginx']['repository'] = 'official'
default['nginx']['repository_sources'] = {
'official' => {
'uri' => "http://nginx.org/packages/#{node['platform']}",
'distribution' => node['lsb']['codename'],
'components' => ['nginx'],
'keyserver' => nil,
'key' => 'http://nginx.org/keys/nginx_signing.key',
'deb_src' => false
},

"ppa" => {
"uri" => "http://ppa.launchpad.net/nginx/stable/ubuntu",
"distribution" => node["lsb"]["codename"],
"components" => ["main"],
"keyserver" => "keyserver.ubuntu.com",
"key" => "C300EE8C",
"deb_src" => true
'ppa' => {
'uri' => 'http://ppa.launchpad.net/nginx/stable/ubuntu',
'distribution' => node['lsb']['codename'],
'components' => ['main'],
'keyserver' => 'keyserver.ubuntu.com',
'key' => 'C300EE8C',
'deb_src' => true
},

"phusion" => {
"uri" => "https://oss-binaries.phusionpassenger.com/apt/passenger",
"distribution" => node["lsb"]["codename"],
"components" => ["main"],
"keyserver" => "keyserver.ubuntu.com",
"key" => "561F9B9CAC40B2F7",
"deb_src" => true
'phusion' => {
'uri' => 'https://oss-binaries.phusionpassenger.com/apt/passenger',
'distribution' => node['lsb']['codename'],
'components' => ['main'],
'keyserver' => 'keyserver.ubuntu.com',
'key' => '561F9B9CAC40B2F7',
'deb_src' => true
}
}
Loading