From ea9eb60f0595ff0c982ad4b41a63ee11699ecb02 Mon Sep 17 00:00:00 2001 From: hannesvdvreken Date: Sat, 19 Oct 2013 21:53:09 +0200 Subject: [PATCH 01/37] Choose default root folder. --- attributes/default.rb | 1 + templates/default/default-site.erb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index f73422692..a7c48f9ba 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -29,6 +29,7 @@ default['nginx']['script_dir'] = '/usr/sbin' default['nginx']['log_dir'] = '/var/log/nginx' default['nginx']['binary'] = '/usr/sbin/nginx' +default['nginx']['default_root'] = '/var/www/nginx-default' case node['platform_family'] when 'debian' diff --git a/templates/default/default-site.erb b/templates/default/default-site.erb index 155a322f8..8ee06d03b 100644 --- a/templates/default/default-site.erb +++ b/templates/default/default-site.erb @@ -5,7 +5,7 @@ server { access_log <%= node['nginx']['log_dir'] %>/localhost.access.log; location / { - root /var/www/nginx-default; + root <%= node['nginx']['default_root'] %>; index index.html index.htm; } } From aa68b47717b2b7d55d4ea7d39b1acb7f649d53e3 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Thu, 23 Jan 2014 12:33:54 -0500 Subject: [PATCH 02/37] [COOK-3672] - Add gzip_static option --- attributes/default.rb | 1 + recipes/http_gzip_static_module.rb | 7 +++++++ templates/default/modules/http_gzip_static.conf.erb | 1 + 3 files changed, 9 insertions(+) create mode 100644 templates/default/modules/http_gzip_static.conf.erb diff --git a/attributes/default.rb b/attributes/default.rb index f73422692..7c02108ff 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -55,6 +55,7 @@ default['nginx']['pid'] = '/var/run/nginx.pid' default['nginx']['gzip'] = 'on' +default['nginx']['gzip_static'] = 'off' default['nginx']['gzip_http_version'] = '1.0' default['nginx']['gzip_comp_level'] = '2' default['nginx']['gzip_proxied'] = 'any' diff --git a/recipes/http_gzip_static_module.rb b/recipes/http_gzip_static_module.rb index 83e91e344..680787832 100644 --- a/recipes/http_gzip_static_module.rb +++ b/recipes/http_gzip_static_module.rb @@ -19,5 +19,12 @@ # limitations under the License. # +template "#{node['nginx']['dir']}/conf.d/http_gzip_static.conf" do + source 'modules/http_gzip_static.conf.erb' + owner 'root' + group 'root' + mode '0644' +end + node.run_state['nginx_configure_flags'] = node.run_state['nginx_configure_flags'] | ['--with-http_gzip_static_module'] diff --git a/templates/default/modules/http_gzip_static.conf.erb b/templates/default/modules/http_gzip_static.conf.erb new file mode 100644 index 000000000..360d46ed1 --- /dev/null +++ b/templates/default/modules/http_gzip_static.conf.erb @@ -0,0 +1 @@ +gzip_static <%= node['nginx']['gzip_static'] %>; From 7b60248fc25541af6063fc48eac1c34518c649a2 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 23 Jan 2014 12:35:18 -0500 Subject: [PATCH 03/37] Version bump to 2.2.2 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 379f099b3..a5f8d2300 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@opscode.com' license 'Apache 2.0' description 'Installs and configures nginx' -version '2.2.0' +version '2.2.2' 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' From 4a0ad6333cdb203f207ab617b0dbaf3681c1b834 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 23 Jan 2014 12:35:22 -0500 Subject: [PATCH 04/37] Publish 2.2.2 Changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b56ad59c5..121fdf0b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ nginx Cookbook CHANGELOG This file is used to list changes made in each version of the nginx cookbook. +v2.2.2 (2014-01-23) +------------------- +[COOK-3672] - Add gzip_static option + + v2.2.0 ------ No changes. Version bump for toolchain From 1b90039a21ee0144c362ce61fc5c9a7d8af92485 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 23 Jan 2014 12:38:38 -0500 Subject: [PATCH 05/37] bumping to 2.2.3 for devodd --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index a5f8d2300..a87a32c03 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@opscode.com' license 'Apache 2.0' description 'Installs and configures nginx' -version '2.2.2' +version '2.2.3' 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' From c683503312e652c6044d410759f10ae0ecc1a5d7 Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 31 Jan 2014 20:27:37 -0800 Subject: [PATCH 06/37] Minor rubocop fix --- recipes/source.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/source.rb b/recipes/source.rb index 6324681a7..a45724161 100644 --- a/recipes/source.rb +++ b/recipes/source.rb @@ -98,7 +98,7 @@ cwd ::File.dirname(src_filepath) code <<-EOH cd nginx-#{node['nginx']['source']['version']} && - ./configure #{node.run_state['nginx_configure_flags'].join(" ")} && + ./configure #{node.run_state['nginx_configure_flags'].join(' ')} && make && make install EOH From afdb61c3d786e84c454d0c39adb0b6be93a59b1a Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 31 Jan 2014 20:31:15 -0800 Subject: [PATCH 07/37] Bump test gem versions and fix a single rubocop warning --- Gemfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index f465c7829..1e7890272 100644 --- a/Gemfile +++ b/Gemfile @@ -1,13 +1,13 @@ source 'https://rubygems.org' gem 'berkshelf', '~> 2.0' -gem 'chefspec', '~> 3.0' +gem 'chefspec', '~> 3.2' gem 'foodcritic', '~> 3.0' -gem 'rubocop' +gem 'rubocop', '0.18' group :integration do - gem 'test-kitchen', '~> 1.0' - gem 'kitchen-vagrant', '~> 0.11' + gem 'test-kitchen', '~> 1.1' + gem 'kitchen-vagrant', '~> 0.14' gem 'kitchen-digitalocean' gem 'kitchen-ec2' end From 3ab179749e0ffee016a23e91b6cc72ca1c85657d Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 10 Feb 2014 16:35:29 -0500 Subject: [PATCH 08/37] Remove cloud drivers --- Gemfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 1e7890272..efe14938b 100644 --- a/Gemfile +++ b/Gemfile @@ -3,11 +3,9 @@ source 'https://rubygems.org' gem 'berkshelf', '~> 2.0' gem 'chefspec', '~> 3.2' gem 'foodcritic', '~> 3.0' -gem 'rubocop', '0.18' +gem 'rubocop', '~> 0.18' group :integration do - gem 'test-kitchen', '~> 1.1' + gem 'test-kitchen', '~> 1.1' gem 'kitchen-vagrant', '~> 0.14' - gem 'kitchen-digitalocean' - gem 'kitchen-ec2' end From 1c14dcc93ad8ca791cb9f3f1a892ab2e7a3d2832 Mon Sep 17 00:00:00 2001 From: Raul Rodriguez Date: Tue, 25 Feb 2014 11:45:52 -0500 Subject: [PATCH 09/37] [COOK-4237] - Nginx version incorrectly parsed on Ubuntu 13 Signed-off-by: Sean OMeara --- templates/default/plugins/nginx.rb.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/plugins/nginx.rb.erb b/templates/default/plugins/nginx.rb.erb index ea6ffcdda..4e2d4f727 100644 --- a/templates/default/plugins/nginx.rb.erb +++ b/templates/default/plugins/nginx.rb.erb @@ -59,7 +59,7 @@ if status == 0 nginx[:prefix] = prefix nginx[:conf_path] = conf_path - when /^nginx version: nginx\/(.+)/ + when /^nginx version: nginx\/(\d+\.\d+\.\d+)/ nginx[:version] = $1 end end From c304c2ec475d8515ef290ecda200fd116a0fb46d Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Tue, 25 Feb 2014 13:28:37 -0500 Subject: [PATCH 10/37] [COOK-4358] - clean up .kitchen.yml --- .gitignore | 22 ++--- .kitchen.cloud.yml | 106 ++++++++++++++++++++ .kitchen.yml | 74 +++----------- .rubocop.yml | 6 +- .travis.yml | 106 +++++++++++++++++++- Gemfile | 42 ++++++-- Guardfile | 35 +++++++ Rakefile | 63 ++++++++++++ TESTING.md | 236 ++++++++++++++++++++++++++++++++++---------- spec/spec_helper.rb | 2 + 10 files changed, 548 insertions(+), 144 deletions(-) create mode 100644 .kitchen.cloud.yml create mode 100644 Guardfile create mode 100644 Rakefile diff --git a/.gitignore b/.gitignore index a90cbbb6b..7a0d26fb1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,15 @@ +.vagrant +Berksfile.lock +Gemfile.lock *~ *# .#* \#*# .*.sw[a-z] *.un~ -*.tmp -*.bk -*.bkup +.bundle +.cache +.kitchen +bin .kitchen.local.yml -Berksfile.lock -Gemfile.lock - -.bundle/ -.cache/ -.kitchen/ -.vagrant/ -.vagrant.d/ -bin/ -tmp/ -vendor/ +.coverage \ No newline at end of file diff --git a/.kitchen.cloud.yml b/.kitchen.cloud.yml new file mode 100644 index 000000000..a03246151 --- /dev/null +++ b/.kitchen.cloud.yml @@ -0,0 +1,106 @@ +--- +driver_config: + digitalocean_client_id: <%= ENV['DIGITAL_OCEAN_CLIENT_ID'] %> + digitalocean_api_key: <%= ENV['DIGITAL_OCEAN_API_KEY'] %> + aws_access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %> + aws_secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %> + aws_ssh_key_id: <%= ENV['AWS_KEYPAIR_NAME'] %> + +provisioner: + name: chef_zero + require_chef_omnibus: latest + +platforms: +- name: centos-5.8 + driver_plugin: digitalocean + driver_config: + image_id: 1601 + flavor_id: 63 + region_id: 4 + ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> + ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %> + +- name: centos-6.4 + driver_plugin: digitalocean + driver_config: + image_id: 562354 + flavor_id: 63 + region_id: 4 + ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> + ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %> + +- name: amazon-2013.09 + driver_plugin: ec2 + driver_config: + image_id: ami-3be4bc52 + username: ec2-user + ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %> + +- name: fedora-19 + driver_plugin: digitalocean + driver_config: + image_id: 696598 + flavor_id: 63 + region_id: 4 + ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> + ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %> + +- name: ubuntu-1004 + driver_plugin: digitalocean + driver_config: + image_id: 14097 + flavor_id: 63 + region_id: 4 + ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> + ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %> + run_list: + - recipe[apt] + +- name: ubuntu-1204 + driver_plugin: digitalocean + driver_config: + image_id: 1505447 + flavor_id: 63 + region_id: 4 + ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> + ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %> + run_list: + - recipe[apt] + +suites: + - name: default + run_list: + - recipe[nginx::default] + - name: source + run_list: + - recipe[nginx::default] + attributes: + nginx: + install_method: source + - name: upstream_repo + run_list: + - recipe[nginx::repo] + - recipe[nginx::default] + attributes: + nginx: + repo_source: nginx + - name: modules + run_list: + - recipe[nginx::source] + attributes: + nginx: + modules: + - nginx::headers_more_module + - nginx::http_auth_request_module + - nginx::http_echo_module + - nginx::http_geoip_module + - nginx::http_gzip_static_module + - nginx::http_realip_module + - nginx::http_spdy_module + - nginx::http_ssl_module + - nginx::http_stub_status_module + - nginx::naxsi_module + - nginx::ngx_devel_module + - nginx::ngx_lua_module + - nginx::openssl_source + - nginx::upload_progress_module diff --git a/.kitchen.yml b/.kitchen.yml index 1489816f6..c654a9336 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,67 +1,15 @@ ---- -driver_plugin: vagrant -driver_plugin: digitalocean -driver_config: - digitalocean_client_id: <%= ENV['DIGITAL_OCEAN_CLIENT_ID'] %> - digitalocean_api_key: <%= ENV['DIGITAL_OCEAN_API_KEY'] %> - aws_access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %> - aws_secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %> - aws_ssh_key_id: <%= ENV['AWS_KEYPAIR_NAME'] %> - ssh_key: <%= ENV['AWS_PRIVATE_KEY_PATH'] %> - rackspace_username: <%= ENV['RACKSPACE_USERNAME'] %> - rackspace_api_key: <%= ENV['RACKSPACE_API_KEY'] %> - require_chef_omnibus: latest +driver: + name: vagrant -platforms: -- name: centos-5.8 - driver_plugin: digitalocean - driver_config: - image_id: 1601 - flavor_id: 63 - region_id: 1 - ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> - -- name: centos-6.4 - driver_plugin: digitalocean - driver_config: - image_id: 562354 - flavor_id: 63 - region_id: 1 - ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> - -- name: amazon-2013.09 - driver_plugin: ec2 - driver_config: - image_id: ami-3be4bc52 - username: ec2-user +provisioner: + name: chef_zero -- name: fedora-19 - driver_plugin: digitalocean - driver_config: - image_id: 696598 - flavor_id: 63 - region_id: 1 - ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> - -- name: ubuntu-1004 - driver_plugin: digitalocean - driver_config: - image_id: 14097 - flavor_id: 63 - region_id: 1 - ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> - run_list: - - recipe[apt] - -- name: ubuntu-1204 - driver_plugin: digitalocean - driver_config: - image_id: 1505447 - flavor_id: 63 - region_id: 1 - ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %> - run_list: - - recipe[apt] +platforms: + - name: centos-5.10 + - name: centos-6.5 + - name: fedora-19 + - name: ubuntu-1004 + - name: ubuntu-1204 suites: - name: default @@ -99,4 +47,4 @@ suites: - nginx::ngx_devel_module - nginx::ngx_lua_module - nginx::openssl_source - - nginx::upload_progress_module \ No newline at end of file + - nginx::upload_progress_module diff --git a/.rubocop.yml b/.rubocop.yml index 2974c4273..5f5d138a9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,11 +1,11 @@ -Encoding: +AlignParameters: Enabled: false -AlignParameters: +Encoding: Enabled: false LineLength: Max: 200 HashSyntax: - EnforcedStyle: hash_rockets \ No newline at end of file + EnforcedStyle: hash_rockets diff --git a/.travis.yml b/.travis.yml index 9cd6a2240..cf621d648 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,103 @@ +language: ruby +bundler_args: --without kitchen_vagrant rvm: - - 1.9.3 - - 2.0.0 +- 2.1.0 +before_install: +- echo -n $DO_KEY_CHUNK_{0..30} >> ~/.ssh/id_do.base64 +- cat ~/.ssh/id_do.base64 | tr -d ' ' | base64 --decode > ~/.ssh/id_do.pem +- echo -n $EC2_KEY_CHUNK_{0..30} >> ~/.ssh/id_ec2.base64 +- cat ~/.ssh/id_ec2.base64 | tr -d ' ' | base64 --decode > ~/.ssh/id_ec2.pem script: - - bundle exec foodcritic -f any . --tags ~FC015 --tags ~FC023 - - bundle exec rspec --color --format progress - - bundle exec rubocop +- bundle exec rake style +- bundle exec rake spec +- bundle exec kitchen test $KITCHEN_INSTANCE +after_script: +- bundle exec kitchen destroy +env: + global: + - secure: bBlNE2khrqiOD6XvtShc3yFOx07zV4a4bnO2f7n6AA6UTL862ha9JPs7R+kiQfUUe18mcOwKYIwdOAPk8bFdQTq+J8dE5zrxmqYxAFKhFvX+9K88jTDNn2rlflsVh+cNxgYaFoYpXSnG0XmFLj2wlGIi/mOvuUPzcpHcU1qWpQ4= + - secure: UhxzaGwzCrEannQwelLJ46Yvni0VJ0YtJTJKbX4uzd919zwOAIq7fml2wkETt9lmQtUYS1GSXR3U2SI0RjBRyRAt7csUn1FQ/W2YGDm0UGh1tZT3IHOhBdzS15ZS5b78ShEaLogCFWAGZT483mHv6FtmWpArItTIioYI7pmdUUc= + - secure: Yn8xf+Rww5n5Y06Xkh9//x95VgIrOdKmbekWNV+LyeGmtAv3MTQXd6KMjnk8UWc7jrHJMx+uoV2b9oHAnynKFJ5D7Rrs1pz1BLSCKFKYb54qy7USkcOcFip49uiVOFiCp8h22nYYYidvS7Dai4ZAw+kKYQM32BZ0XgxFEOSPF70= + - secure: kd8Vm15e9/JutjV/8vozd3UNNlZuO5/K5faOiowZY5o1q2gEP7zQGe2xmSnY4cOo4qyU+kpjMFaPWoXGOIlBCtKbwYYyyjXIFGTls3GNJ1E+O4shyAs2nlCK4UJ9ByEWtYFpCrSbkjLlVUbpy0lsHNEf+FtTor7JfodWnGTchug= + - secure: QKfA42OxzHMA8q3GXqdga+A5Ll818Gt/24mi4/rV5MvWuKJub4v4biICLzhXBFhs1P0AXWrL5Wnm47X/8hdIzcSi0S/MmRSowL/ehCHlVjPxujxtIYGd5ZEjK9JtnBX2ok3DFQIbrqGEdefP8DC1kMg58E5Jr6qSIZv5PfoJeYw= + - secure: K4OIAm0noLnGivt/Zb3LDBE+KPjuj9x9LRLVmhX+Sl3k9N2nCiDX3Bn+loAiYYR1c6oAluV6pEOcOAvTEYjgeEaM11mbg4AGlznElIjA1fYd+Jdfin/sL+g0aoTwz3t69Hj+bMOYi4f54OEhyDt7feeBo+7uDh++30bTIZm1wZ8= + - secure: cW+s6YbY7e3ZOUF6fmGHgqM5dLQOkILb0DWFDLgKCq7FLWvK/IckU+RyaSVt8uzoGgM4E6S8mkc6nK6DEfR9Cgbig6PLYxw4updMa7TfKRktyCVbX9rQq0RptL0D3EgcLC6QcpnWT2g0tr3LGkc9VW/hZv8CZWXZrByPjvKP0Aw= + - secure: Jyx9O75YBdvNx7QRod8p+FSerQVPCaOZAU1IYTZK7bUa1L7EM3KVkGoTmOkDvjk5+zlBd8q6n2B1rPaIn/K90fya59lzkKkzpcdZ5t/07qVYGvCZmUFG11u6CqJPH10148ua2e0MQJnONSKHnYvpGYtmOBY/5GbPREb8A9Cz2rQ= + - secure: D5pTe9oOXoPj6C/6R7A/gYCXmzyytKgtaoG23Nvf0q2L9LT3MD/RiGeJvHwsrk3QttebxFD/D9YVPQcuDUNyrdUeQwk+kBjuQYNufMe6iCKn28ILgWWo5swOYE/kyZuQ0vJGOyjsRk/Tk8ropypZIgeB4RlyxjUG3k6LpcKrDXg= + - secure: PCSiZmll4JS7ykEkpRI6exjcKteuqPYrCzjGuj6grhu91zMRcTiQtJLkLfMSW3XRFKBcxAJ2UG5Ln21pNtytSu6sHQCUn/BvdVd37jgCaEvWrQvPyMcp888h4IST01XnOc6VypbnDXGO0vn/ZvaWYlwxeyfcKkERHzBcoZTY8bA= + - secure: galaaDqQ/f3Ruh2+enHimP2xsThwnyTo2erlyLV4vbwPLOhIcIr1CmMtRfbjhT/YayPenFac8LzeQ8+OzwmInVsjA4o9ETQSut2PuVmYYvOSsCKepgHzDRjRn+g+SHW54GPXjedU1hpEWBN7/32BLBhhdSOvSn6DP+UyL38b/A8= + - secure: DIsufSiJl2Id0tSu7A/JiZL6CVGp5mhEuhyqk0JIHlIsPxj4tLdvKsfzXZoEoP84dmJ916A+a/kukuyvCKhL+ymMoLVKEqMdHfNO1QEAADQicSCtqlTk9FObVQNMOTTEStlVz7CxlBOi6MBk706MEilIOa6IOk6LpPMcziBPwNE= + - secure: KUxhs5oxywNydmhQNbXZngZJDuMiLL+KcTuwpxn7irGr9ldPzLahTauyriGABU4DrUB+bP88zCOncODGBlvTuE3WwwdvSRv83xMrOLmuxDPYX7Os5HWYZGx6cFIfUbudSbtPvubo+F1VNNePsK4wR9feoYbFKlKHIvXH36ZqJfQ= + - secure: Quv4B1FlKfvbWKhw2O9rB7uxIK0BAvs0NkOJWSo3ftvThoalOfMLQnZaMPmp56DovUSLUcadNuLsUVRHukelEU2SaKRqrFHJAWzLvO1VTFXjOUxoKMTaU8kPsMMa+gaf4kUdu7jtPw+Aj2PlsdD/rmD3gDEuUJn1tEAOC57GU/c= + - secure: Y1fVD3WimcqY0etlGSP9Fci8tvAm99I4YwqNFHmSSbRgiz4An7VFKyFcpQYXGUQ0hjyX8oJDq6ksEzNalA0qepMTlH21XpElgoMLm+hNDMwL5cn979QLoY5qx6oLu2w2aRV2+qT1HkAqF7xect38w3diikHmrVW4DHK6MUOSyuI= + - secure: l412uzsN41q87xbt2tMPdhoqjq0/+ojMTeHhrLMqrbNVM2KEuiKgXlkogGrC/Kbg3gq8D1EXvgXxU2/hAeb9V5OBBm4x4+y9Qay6zelgmWs0i0JouFBc7/rgX9OcshpKSdyQLKU8bWdfvUflmpHiXbdhSU/1mQx1fqmVvhVSG2M= + - secure: AofCx6s7xGO+pQK8gBlZkSZwHGBoqk+sLXtyQS9zYinPoP/dMXn6sDmnSKGP4yXvpspKLVCA0UgbUYuEcjtBuvjDac89E7NNPaF/WBwNeH8upX8+nQr+Ed7tZ2+2hFBwuMHmn2ZsxImXUDegvZyi1FD+sCuhH/7cLWP+5iL7JVc= + - secure: AvhumFG2D3UVjdx4pOivn1RpNDPfG58an5LxPXUWjb2qtE4244/DMn2+Ct6DEGpWTOyYB61UGg/lsGB4Ei4+KFWDN1Dsbi+x7vBQehrdRQ8UfNdnAin5mWByr/fElVXL2gxS3+yigL26kjqKohaCQMRulgacpRElqxiZ0I2UBn4= + - secure: K0OFCucLqUibSRQ0XlhoY4UTYsEE/yWvAwTUJw+tNLcwHjKsPsS3zwrv7PjfDup1PNSvofd0LNAaBiITNEyKlO+h/9RJ1JbOOep/dmw9uewHN2lqvPRExSBQm5Vr1TqqxVYq2Ie468n5+5fz3BaDFtTGroZZiAC2K3axqnRtr4A= + - secure: aLR0dFU3btM2LGDNH54d5XgL3+ZQ7jruTD4MYwk7aKQEy5AGix5c80bXko62hX34hOTPeoTMObejOl0TEyXWJjafgAcPs8SUJzouDnQdCGCEsh1T4pK8bP7kVsPs9K7p3U/qvg4LetjnggMmHfsgBLY1yKs6Pq2iIsuPIPPfm5k= + - secure: RV3BW6+KmfsHHmSgffF/lCgFRxtuAY0zH2lkAAD3fwCSaVV8al85x67R65hJnkfM52X2WwiRLRy3Ey1zwdJI+qheOSKhRgYTd33BbC/itkv7SWfXuqlTQci7CX/Wl/LJk4FWtqOURPlqF4PkCa5deHeWWUNW84tmX8JlKgbrLco= + - secure: UGRkVCfODAi6XpO+wP2JyBvFQVRrKBLGs4Y66/ea5PqVrmHAs/qISlWO3s1HvX6U/e8uZAJcllLrufUf2IwIEjsGWXLovIGd6wEQcHI1zZZwKZVjDid0QVajpmdLPQR3H0zka7CboxfDy2YD4DQof2KzQ2W0e3fLh2aF1gw7YGk= + - secure: NY76tKoA290BJQBoe6hjvzXmD8/xO9cx0kd2ayTKvhKhx4DuPKw4eYS8fumcvjv6uHdGLhwIkQfvmRL4LtERN3vkjXtHHe28Mu5PTfv+PjxioiL517G/QaMtwLRGHcYeVSuMAbE0hB4429h3YIHAW3uk8h+a8DLPlf9eIZ/Qv2o= + - secure: i6o0zLA8vI//n7W9PtChRqDY+qJcFa1w73bn89/SQR0kQSkJEgSLq/sKoFeK9rzovReatFXQHDNxUnxMmKS6sqRVDQkfuAvxfF5DXh6APAcQVqediJWw6oaYld3+B3CQX7b8G7B5OFHQk1U/m0WBnKSygNyxuZOgpos2O2TPoqI= + - secure: iJYwbSKIXfO3YnbmmLRqFjRA/4ZytnKMG3b1BUmixuQFCU7wjPOH0zfga8fh/y7fe//hn8GYoFTB3Vm2bhFm27TG5zhD9gM3l2tByuzwepBjp4YNYT9nCAuJtH36L8t2b4Yrm6uyZPFgkiYfPqHMIp773c7TuOQF/VtvBPMEp2s= + - secure: apBNBLga1HUAa1r/l0wzRn6UAlfo5/L3DM7PM2sFL+bJSxT0KeJb/HWCK329HiVVFypo2xSahSo6m3L8A28uNrZhzpzWJraCDJ7qnYa2+0HY8UHpfcg43JZMFTueV8E2ck55Wrc/wy+nAYA0+3m5fvueWMp707wGhsrEmwveJZo= + - secure: jmqWCF8E40uH173HxMTjRALqKKi/8opo56I4j2y51sP2iJysGZQsCY+FVlchNXfUAuEVP7u3GTGpc5iSPxURQttMblEP5XuXLM9wVWPSN8BbGb7dBFVmH2V/7H+1/TaQlGn2cgIuSe21qqM46Nuf4sklQHIlC0r1y/Hp2pjIh1M= + - secure: R7JSmtwVW0WehQSx/f5QW9bfT8y73HcAmzCv9mJ6P1Gt0/cjr2FQxLYxA8oP56OxLfxQsnbfVj7VITrKiAnvnwxuquEI67A8XzL8ikBSyYxYp8jiu33SnGtGEDTsCjB+Qx22xHpDW3HZE+PGmt2SMaTdrL9N3Kb6BL+J00lc2Og= + - secure: DSDzGAc2epWpHnrD+zz7016fIroIzcSuibOq6dU3qyWHwhihw3UPJyrmcWruQY61C6A6ykhKrqkP1bCw6NjaMy6LIa6jp6HZIvX0gPT6DEvfjNOhnmng5IV98e8iH1m0er9wJn5GRgVKGXBoAip7Y19WMJnFSpmGwic3Wtiarvk= + - secure: WkJwp0Efh+6k1GrM/9wSvhQ2unlVx8c2PluJWvb0vDxhzJNa4ROrAPG6y6KTtvGXjuAfg66l2+hpDCNB0NEJV2H2i0z1Gyz45wXHMc2fDadbs0S3xLc/FfZnEi6qY4PC8Qz4LKKfj1tMoPdHD8BitReVTZG0SuhSVtlUrT5kvf0= + - secure: bpgdN21YAa5tJ2N8fZe5+HjdUUhIqROm0uDsWsFwRlv/9mhXIiY7vAr2igEUbwsxdBn77IMPqYK4OUYsJb+aN081rfHUCsrTiSjJ6oCgqNhw1mEBVVFpINC5EZjH/poDjouMqWRtwGZ2RCsYHhx0I7G7lA0nawdj5cCfDRHe62w= + - secure: AvAs76wxH2xC/PdfU8p6mA9A/7uurGbB3x94vVMHrQEvrpEY4WwV+6VUFwtoAnw6vpQlFq/NEEi9aDovoIezGCMIKCSVb6NDgJsa3diNY6yyFGbpVo+F+b87MnZa3+1OSfk2Vh77N8j5mVUPzcqVn+1STrXyOBDqCBqn49grq5k= + - secure: hkcPW1sy3l4zvn1ftziUTHqqCajh3OQh5KNDcD+8FHQBpA6DBMYPJwXU04TbVJjF4dFd6bsYZyg8btwLSx1eysAELbFIvdB3xJhOWlxgfbR08gzAuybVmv851dfwpu1lz/PJ3ayzzEGph5SxOnHoKf6o8+mdxZFYg3hsbaZjMI4= + - secure: Lm2Pt44W0jgQTfX9NNEdPSVxpNk8dGpidBMFcNPRLA9Y4VyIz4GMmcNgFLN3laBRLK4LJ2CaLCwdh06hs2yqjepPmpGic4JYDDX8dAg55rg+UgfEnUG4OoSp1cQoCFmrlmHIFd4DGTLSUwwqXtvRuDDbvNU2NR5PE6vd8M9n/fA= + - secure: kWrZsVh85J/JaPQC4mdr5533/jsAq7Kfyr31U7JeNgaLCOcm1kErqxvvt0rRKgWg0W0lS5e5WcFbH/IWsz2BaGhNeE25i4f9oV+ekr0+qM8JJLes8J3wCIgcVx7H6q4yucf3lYfXrtE/+KZmb8uKdsI4iZxKiEhr2BSy12srXrs= + - secure: eJ4hBMGMomp9vMyuy0la+ZPOOpcTLCmdjQo44jHLtxhYW0EJvLxq/0Oxznellf8QfcNSHkJR6UwtNhb+7nExaRDS3010zy4ZXS1+bKnGWW6g04mXlFUYEWKRWA41W+oSQwag/9f8hnPTdIlBh0l2bPUL6MmkjJ10M8on3s8WEzw= + - secure: ai31c6hu8O/RvogxI2njrf4Y301sqaqj+6/R+AL4rz649OGeKpETuFMA6h5p0WgoeKhYUL/ybdAyi7EfIo8HAZSv3oFpp3MENTlRq4GMebs5ExO2uXlJ2OkzVB68aVNoN3wc2ad1SHq4E7eD1SBmNrFjZfjViAQvXHXmpt8iBOs= + - secure: dodyujGWZciT8jELXq1yw1Dx8+CEBpFjDcrqu3imP3cWNPnTc2WGj6LH1TMbwd6uyyIHRlhX+ZPTZcvVWCiCW+whq2plhPNjft2XeRU4mqa8Y+akI+jocakn9sUrENz48uaUxVudLcn0ZCc6DLlotcxqjQil2zsVAD4c2U1998g= + - secure: cEJe6ILo6Z2xtJFvFrM5n5d19sw16gkwkHvuCTpct0olxCtaqKmoC0d3aIJ+LuK8ILil+9qV/UG4MdXzX3dAvesewaABVucP1ugE/JNj6kGv8m0xM1co5TPotxpMPAujkTb+xqvfx5AGdwcBLYX9M1gWyj+TgljuM7rBaZfSoXM= + - secure: eK2ppJJ86emaTP9MtvUIBKHcpAq2edfe9XpqdVwkYQ6a2NzYvG49ZG2NAvAJvzAO+iSWXYw1gzoMdx/mzmjjxSzYriLh1r45J1uvWIwQhmqzVWNsda7SH9hc6RfrKxoKyyjS68nvK1yLAY4RX6fC2MyO47try2M264SPeRQbfxo= + - secure: g8XoXTKGTzOqzlC0VT2LWpZuglcfY+QkAcxE5jWuWJmM216655hVOLj3CAn28JT35BR22EswtWl3qFdH8RifpPeoUEmhBswVFBF3ypY5t11p+Gh8xG072Yc2mCxVugaYDB7pkg9ASGgeJ4loLhHD33jB6coXdsOB4ToA/QgMVKg= + - secure: T6OWfi8Ouqg2SRlHFnKidAEsWosFD5KC2j3sydOGHNn26RiKSDLPgGz9UQCkA5dNsU3j5998A3ibjUVUJFh2pBJTtuUIm9EE6oLnom1HXcDa4R53Xs28Xk8nSuIsOjy4TAyWObk7kTtb05UQqq0gZBXFyRO4d6e9w1/7A+lr6DY= + - secure: KROX/NNgySGvoS3vzoGrP/GAS0TO1m7qHp9LiydaDq56Pz0U1Ns6c5OJNtH+FylZcVNYxnbCj01c0BC87ppwX99wXC0llKsWO0ya1X8v9LkDmgJTP4vavA/Vp0YV4Y7b17I2whp7DS9JmBFIebbJoBhCqmTv0bWOfDQdYEkvhzE= + - secure: DLstVco3iRMEKBL8N+zO4Wy1bQt1TElJLj5NUHTz94vYgUfl6S8dkDJjZw3O/cwMfFQiH5MwhxRu2zFd+9PyywYy7T7BgoNurCy91B+HsG7JaOMqSZTUQwOPsvd1463qsZ9I/QcgLjMgeIWxcVbexeQ0ZsHULsT27ZStQLROB8w= + - secure: CW5ySUdQ9T7n4br9cjZ9CEtbh5zwx5TGuZl5qVYeKK9rAHtbqa7EMv9Qaeiz6opZwnTBP57ZzdS6n3Ukudi/DGQGhKPDEeyQQqbEeDQ6ahX3B8aNJjhzav/eGOpvtxVEVWsgOV+Ss2ylXgeHxHx1iDATBj7VbB6teW3M9w2Ty2A= + - secure: IXUJBiY4/8Dx3hlUiJiPnM6knoP5qDcclB3mnHWa0V5epCwx6ZQrXZkF7TuMHQGHuwSNvTcp0CZd3ooswvrjEtnXaNfNebqWqVSIdS3oUqPN+CiqNbjg6r+764dBMZzOr3KMCjLNS1NYvr+173TC/7LIbSvsbIQyVyfvQHlymu0= + - secure: eC2LNNacxdgHP73y5x+cH6YIM7UFX0fJ5CVf6su3Ml+VdoYHSvcNLpcRmBVk7TXJC9sGWkYzR7Nee6BPTTcMoFlxN6QoEXRbxgseLRW3cScn7E9ir8yT8gyBgAbnV2+Kyq7ElWdLQdJlTVFQwV9dLcYkm1BIa6Wnzt014eW3tvk= + - secure: gvI6p/eWj3kcOiTRVRHTR+8cp2TES/lltjQF05lS4EbU6DuxoCi2HqJh4vrVFFRKzkOH9ZIt9mF11WmgVI2pjNErkKSKNn+SNsaWtS8SlwVilwpYfWboHiyKVl/OmVRWvjwdvX6pN2H0/cfAwvUuDjxD/CGk5DIvd4paAbZYcwA= + - secure: WvWJh1nfx7ufZIwuYV4uKIylzB7WWvZH1WGqlGb3zXR2f8/ZqPL4yM+aEVQeCh8Hq86Et302zoYdZ8RWpMUf218R+oIdgGx64hn0sdJ9JNusSup8s5V3014PtW6D8bv2k6pPkhbjcQxYlJkodPDMPHc5zJ7Xta5gD3m6NMma0+8= + - secure: Zll/IH5rU2i0EeIP6YgqkBTDzKtmKO2JyagIQ1sCdeEkwqTHFWgr4OMigbSeUYPoh+MUFv0oJfpS5t2etW8JyFHc6Zzax1fDqiinGrPmZdBTzZ0m3NbnAX1WtMv99ea9lq8vVKrzLazg3qDxhjD8bCdo9Jx5z24gZmtOgAlrI3c= + - secure: BTlxP6hd5fj7b8DC8aSGAIh5/e1YzsnBzNIIklJQPGkGI50nVEzhzVQIcRrXI8tChZnPsC+3JgNuwWiPAb/Adqa9fBw4Goz0yyDHTx0eeKHif4yfI0q4FO0QKHphfrnQIoONjvekRj2k+524jXbzecm+0JF1+/MNEXVUAmE7Sg4= + - secure: fhCu8XjJcncIFW5ymH/HiVmbtAXk2vcPR6Ne5/lGFZLnay0kfxxbu1LpLH0f9zP5bvflqwQjKkp0qR2gKzJ/JT5uz9cdMFnbV8FN0DQDFEd6MoCsXkVCJpS5trCvbmsOwFxFSNC5wJWSXuuQZLW0BcAWiGLvcMjtpNiSzgYMfCc= + - secure: FVNnKpSBJDDh91wfaPEUTRELWajB1BF9Swhu/x0GNGioRZkUBvzs1uKMAwgsjnHbTPuK+1Rv2frydeFrwJ2VQOYx5xKIiqbuBR4NJ1Vz87ZNXJPkP5ZSW3ahlV0At44CGH54S8hfxlZ+1QO+obwKOWUWDbbPUckorfqq3wWpQzo= + - secure: D37OqXvpr85SDqX8YElieQfRo/p6UQoKdDrlbHOFmlTEiXVCMVbEQZ7LbJK7CQ4lcd7Tgcx+4CdNbOgj9BOndsfqM6Fi1rpbxensafptRRxE/1WvojCM61CFQ6xZcLiY74gIottLtUKRSN1bc234m74bV1m0tbse8caETKKJ1BE= + - secure: Z7+JIzgy50RvP9CILm+9Wk3b/hahoZnQVRpntTaWwwHwWZjUc2HjcE2iUMiecR8I3Y5TZuJxRbFmtIZUmZ/t8WVpE4CdyUbxaS8z/gnmwXR2Z5bK5OtQ8vSj3by6I4nwi0GLGtOfnfGcE+hsxrF4RKcTHMNtB4uaMUXJUUuH8+8= + - secure: hVHwMWrP8+svI68yWLA5Gi3LLTBgTWF33e4NEiHWy5SyYtgzS7Yc85ldCaaFGYKFqyzc0VxYrS1FUZ5Diuxh9wDC4J5tQmzvn1HYQeq9855DEwXcH0eVhPSVnHW1VQ0fVYOJK3OjKUqf2dCM3q7zDQIEVM4xn7mv97WLALoAGgA= + - secure: B13+vKYK6G/0cV7lHigriW0RAErnsFVlvgrigU9V61xt4O/W/ftPL7FqAe6bbISW7v68B9d6Dz/+DvCk0j2Y3DfPhbeuqRkMpi/S+iiCvDTKd1YSSX+b5qMh4Xth3ds2zVBcKZwDf/edtf+JPbmC/RmkBupHNGpPWVsXgL5bXHg= + - secure: in55d6LHMRpGJYDcFqbnm3c258pHpJlT2LJXrsQ6HQy1Gep+03q6WOeGickkirKv8UqpW7qZ7meLxbwjoRjskcDRyk4RxItGb42Uhrt7CM5Q70N5soG3LDVMwhrn53Qp99lL2WZ4GQTBQnPj3s2s6Q39ubPeOent1WCAA8kgssg= + - secure: E2NgPTBseKWBtS6SMipGxSHmS5CeWzPWwSxWTEvgW2u16FDHk/IgOKnG9cqDXIJTssXsMwZe+3RyLGX4iw3eM5UHaqH8cc7UuOrw/TYpfXGuk/mqV+FJ+D0uoiGYScndXrsB7veuhUxF7J0pliGjUivc6tj2UqRwr5ZLg8Wt4NA= + - secure: d394PNayvQxU08tWMCQFtHcFsHBuT9/mWQoiZ+n/CxRRpi7cqt5r8DzdLscWYETEEJabi254A+G5FcopP2tB+7/IjvxoTUXLXiQS+accJCj5u7r63m3AsDwa1spjbhpWdbBU6C34j10x7UkgrILmxZzNshBq53Jh0p2fSHg5sKM= + matrix: + - KITCHEN_INSTANCE='default-centos-58' + - KITCHEN_INSTANCE='default-centos-58' + - KITCHEN_INSTANCE='default-centos-64' + - KITCHEN_INSTANCE='default-amazon-201309' + - KITCHEN_INSTANCE='default-fedora-19' + - KITCHEN_INSTANCE='default-ubuntu-1004' + - KITCHEN_INSTANCE='default-ubuntu-1204' + - KITCHEN_INSTANCE='source-centos-58' + - KITCHEN_INSTANCE='source-centos-64' + - KITCHEN_INSTANCE='source-amazon-201309' + - KITCHEN_INSTANCE='source-fedora-19' + - KITCHEN_INSTANCE='source-ubuntu-1004' + - KITCHEN_INSTANCE='source-ubuntu-1204' + - KITCHEN_INSTANCE='upstream-repo-centos-58' + - KITCHEN_INSTANCE='upstream-repo-centos-64' + - KITCHEN_INSTANCE='upstream-repo-amazon-201309' + - KITCHEN_INSTANCE='upstream-repo-fedora-19' + - KITCHEN_INSTANCE='upstream-repo-ubuntu-1004' + - KITCHEN_INSTANCE='upstream-repo-ubuntu-1204' + - KITCHEN_INSTANCE='modules-centos-58' + - KITCHEN_INSTANCE='modules-centos-64' + - KITCHEN_INSTANCE='modules-amazon-201309' + - KITCHEN_INSTANCE='modules-fedora-19' + - KITCHEN_INSTANCE='modules-ubuntu-1004' + - KITCHEN_INSTANCE='modules-ubuntu-1204' diff --git a/Gemfile b/Gemfile index efe14938b..7207cc127 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,37 @@ source 'https://rubygems.org' -gem 'berkshelf', '~> 2.0' -gem 'chefspec', '~> 3.2' -gem 'foodcritic', '~> 3.0' -gem 'rubocop', '~> 0.18' - -group :integration do - gem 'test-kitchen', '~> 1.1' - gem 'kitchen-vagrant', '~> 0.14' +group :lint do + gem 'foodcritic', '~> 3.0' + gem 'rubocop', '~> 0.18' + gem 'rainbow', '< 2.0' +end + +group :unit do + gem 'berkshelf', '~> 3.0.0.beta6' + gem 'chefspec', '~> 3.1' +end + +group :kitchen_common do + gem 'test-kitchen', '~> 1.2' +end + +group :kitchen_vagrant do + gem 'kitchen-vagrant', '~> 0.11' +end + +group :kitchen_cloud do + gem 'kitchen-digitalocean' + gem 'kitchen-ec2' +end + +group :development do + gem 'ruby_gntp' + gem 'growl' + gem 'rb-fsevent' + gem 'guard', '~> 2.4' + gem 'guard-kitchen' + gem 'guard-foodcritic' + gem 'guard-rspec' + gem 'guard-rubocop' + gem 'rake' end diff --git a/Guardfile b/Guardfile new file mode 100644 index 000000000..11dc1dee8 --- /dev/null +++ b/Guardfile @@ -0,0 +1,35 @@ +# A sample Guardfile +# More info at https://github.com/guard/guard#readme + +# guard 'kitchen' do +# watch(%r{test/.+}) +# watch(%r{^recipes/(.+)\.rb$}) +# watch(%r{^attributes/(.+)\.rb$}) +# watch(%r{^files/(.+)}) +# watch(%r{^templates/(.+)}) +# watch(%r{^providers/(.+)\.rb}) +# watch(%r{^resources/(.+)\.rb}) +# end + +guard 'foodcritic', cookbook_paths: '.', all_on_start: false do + watch(%r{attributes/.+\.rb$}) + watch(%r{providers/.+\.rb$}) + watch(%r{recipes/.+\.rb$}) + watch(%r{resources/.+\.rb$}) + watch('metadata.rb') +end + +guard 'rubocop', all_on_start: false do + watch(%r{attributes/.+\.rb$}) + watch(%r{providers/.+\.rb$}) + watch(%r{recipes/.+\.rb$}) + watch(%r{resources/.+\.rb$}) + watch('metadata.rb') +end + +guard :rspec, cmd: 'bundle exec rspec', all_on_start: false, notification: false do + watch(%r{^libraries/(.+)\.rb$}) + watch(%r{^spec/(.+)_spec\.rb$}) + watch(%r{^(recipes)/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch('spec/spec_helper.rb') { 'spec' } +end diff --git a/Rakefile b/Rakefile new file mode 100644 index 000000000..9ef337ca1 --- /dev/null +++ b/Rakefile @@ -0,0 +1,63 @@ +require 'rspec/core/rake_task' +require 'rubocop/rake_task' +require 'foodcritic' +require 'kitchen' + +# Style tests. Rubocop and Foodcritic +namespace :style do + desc 'Run Ruby style checks' + Rubocop::RakeTask.new(:ruby) + + desc 'Run Chef style checks' + FoodCritic::Rake::LintTask.new(:chef) do |t| + t.options = { + fail_tags: ['any'], + tags: [ + '~FC005', + '~FC015', + '~FC023', + ] + } + end +end + +desc 'Run all style checks' +task style: ['style:chef', 'style:ruby'] + +# Rspec and ChefSpec +desc "Run ChefSpec examples" +RSpec::Core::RakeTask.new(:spec) + +# Integration tests. Kitchen.ci +namespace :integration do + desc 'Run Test Kitchen with Vagrant' + task :vagrant do + Kitchen.logger = Kitchen.default_file_logger + Kitchen::Config.new.instances.each do |instance| + instance.test(:always) + end + end + + desc 'Run Test Kitchen with cloud plugins' + task :cloud do + run_kitchen = true + if ENV['TRAVIS'] == 'true' && ENV['TRAVIS_PULL_REQUEST'] != 'false' + run_kitchen = false + end + + if run_kitchen + Kitchen.logger = Kitchen.default_file_logger + @loader = Kitchen::Loader::YAML.new(project_config: './.kitchen.cloud.yml') + config = Kitchen::Config.new( loader: @loader) + config.instances.each do |instance| + instance.test(:always) + end + end + end +end + +desc 'Run all tests on Travis' +task travis: ['style', 'spec', 'integration:cloud'] + +# Default +task default: ['style', 'spec', 'integration:vagrant'] diff --git a/TESTING.md b/TESTING.md index b4102e321..26481c2d7 100644 --- a/TESTING.md +++ b/TESTING.md @@ -1,53 +1,187 @@ -This cookbook uses a variety of testing components: - -- Unit tests: [ChefSpec](https://github.com/acrmp/chefspec) -- Integration tests: [Test Kitchen](https://github.com/opscode/test-kitchen) -- Chef Style lints: [Foodcritic](https://github.com/acrmp/foodcritic) -- Ruby Style lints: [Rubocop](https://github.com/bbatsov/rubocop) - - -Prerequisites +yum Cookbook TESTING doc +======================== + +Bundler +------- +A ruby environment with Bundler installed is a prerequisite for using +the testing harness shipped with this cookbook. At the time of this +writing, it works with Ruby 2.0 and Bundler 1.5.3. All programs +involved, with the exception of Vagrant, can be installed by cd'ing +into the parent directory of this cookbook and running "bundle install" + +Rakefile +-------- +The Rakefile ships with a number of tasks, each of which can be ran +individually, or in groups. Typing "rake" by itself will perform style +checks with Rubocop and Foodcritic, ChefSpec with rspec, and +integration with Test Kitchen using the Vagrant driver by +default.Alternatively, integration tests can be ran with Test Kitchen +cloud drivers. + +``` +$ rake -T +rake integration:cloud # Run Test Kitchen with cloud plugins +rake integration:vagrant # Run Test Kitchen with Vagrant +rake spec # Run ChefSpec examples +rake style # Run all style checks +rake style:chef # Lint Chef cookbooks +rake style:ruby # Run Ruby style checks +rake travis # Run all tests on Travis +``` + +Style Testing ------------- -To develop on this cookbook, you must have a sane Ruby 1.9+ environment. Given the nature of this installation process (and it's variance across multiple operating systems), we will leave this installation process to the user. - -You must also have `bundler` installed: - - $ gem install bundler - -You must also have Vagrant and VirtualBox installed: - -- [Vagrant](https://vagrantup.com) -- [VirtualBox](https://virtualbox.org) - -Once installed, you must install the `vagrant-berkshelf` plugin: - - $ vagrant plugin install vagrant-berkshelf - - -Development ------------ -1. Clone the git repository from GitHub: - - $ git clone git@github.com:opscode-cookbooks/COOKBOOK.git - -2. Install the dependencies using bundler: - - $ bundle install - -3. Create a branch for your changes: - - $ git checkout -b my_bug_fix - -4. Make any changes -5. Write tests to support those changes. It is highly recommended you write both unit and integration tests. -6. Run the tests: - - `bundle exec rspec` - - `bundle exec foodcritic .` - - `bundle exec rubocop` - - `bundle exec kitchen test` - -7. Assuming the tests pass, open a Pull Request on GitHub -8. Open a JIRA ticket for this compontent, linking the JIRA ticket to the Pull Request and visa versa. -9. Mark the JIRA ticket as "Fix Provided" +Ruby style tests can be performed by Rubocop by issuing either +``` +bundle exec rubocop +``` +or +``` +rake style:ruby +``` + +Chef style tests can be performed with Foodcritic by issuing either +``` +bundle exec foodcritic +``` +or +``` +rake style:chef +``` + +Spec Testing +------------- +Unit testing is done by running Rspec examples. Rspec will test any +libraries, then test recipes using ChefSpec. This works by compiling a +recipe (but not converging it), and allowing the user to make +assertions about the resource_collection. + +Integration Testing +------------------- +Integration testing is performed by Test Kitchen. Test Kitchen will +use either the Vagrant driver or various cloud drivers to instantiate +machines and apply cookbooks. After a successful converge, tests are +uploaded and ran out of band of Chef. Tests should be designed to +ensure that a recipe has accomplished its goal. + +Integration Testing using Vagrant +--------------------------------- +Integration tests can be performed on a local workstation using +Virtualbox or VMWare. Detailed instructions for setting this up can be +found at the [Bento](https://github.com/opscode/bento) project web site. + +Integration tests using Vagrant can be performed with either +``` +bundle exec kitchen test +``` +or +``` +rake integration:vagrant +``` + +Integration Testing using Cloud providers +----------------------------------------- +Integration tests can be performed on cloud providers using +Test Kitchen plugins. This cookbook ships a ```.kitchen.cloud.yml``` +that references environmental variables present in the shell that +```kitchen test``` is ran from. These usually contain authentication +tokens for driving IaaS APIs, as well as the paths to ssh private keys +needed for Test Kitchen log into them after they've been created. + +Examples of environment variables being set in ```~/.bash_profile```: +``` +# digital_ocean +export DIGITAL_OCEAN_CLIENT_ID='your_bits_here' +export DIGITAL_OCEAN_API_KEY='your_bits_here' +export DIGITAL_OCEAN_SSH_KEY_IDS='your_bits_here' + +# aws +export AWS_ACCESS_KEY_ID='your_bits_here' +export AWS_SECRET_ACCESS_KEY='your_bits_here' +export AWS_KEYPAIR_NAME='your_bits_here' + +# joyent +export SDC_CLI_ACCOUNT='your_bits_here' +export SDC_CLI_IDENTITY='your_bits_here' +export SDC_CLI_KEY_ID='your_bits_here' +``` + +Integration tests using cloud drivers can be performed with either +``` +export KITCHEN_YAML=.kitchen.cloud.yml +bundle exec kitchen test +``` +or +``` +rake integration:cloud +``` + +Digital Ocean Hint +------------------ +At the time of this writing, you cannot find the numerical values +needed for your SSH_KEY_IDS from the GUI. Instead, you will need to +access the API from the command line. + + curl -L 'https://api.digitalocean.com/ssh_keys/?client_id=your_bits_here&api_key=your_bits_here' + +Words about .travis.yml +----------------------- +In order for Travis to perform integration tests on public cloud +providers, two major things need to happen. First, the environment +variables referenced by ```.kitchen.cloud.yml``` need to be made +available. Second, the private half of the ssh keys needed to log into +machines need to be dropped off on the machine. + +The first part is straight forward. The travis gem can encrypt +environment variables against the public key on the Travis repository +and add them to the .travis.yml. + +``` +gem install travis +travis encrypt AWS_ACCESS_KEY_ID='your_bits_here' --add +travis encrypt AWS_SECRET_ACCESS_'your_bits_here' --add +travis encrypt AWS_KEYPAIR_NAME='your_bits_here' --add +travis encrypt EC2_SSH_KEY_PATH='~/.ssh/id_ec2.pem' --add + +travis encrypt DIGITAL_OCEAN_CLIENT_ID='your_bits_here' --add +travis encrypt DIGITAL_OCEAN_API_KEY='your_bits_here' --add +travis encrypt DIGITAL_OCEAN_SSH_KEY_IDS='your_bits_here' --add +travis encrypt DIGITAL_OCEAN_SSH_KEY_PATH='~/.ssh/id_do.pem' --add +``` + +The second part is a little more complicated. Travis ENV variables are +restricted to 90 bytes, and will not fit an entire SSH key. This can +be worked around by breaking them up into 90 byte chunks, stashing +them into ENV variables, then digging them out in the +```before_install``` section of .travis.yml + +Here is an AWK script to do the encoding. +``` +base64 ~/.ssh/travisci_cook_digitalocean.pem | \ +awk '{ + j=0; + for( i=1; i> ~/.ssh/id_do.base64 +- cat ~/.ssh/id_do.base64 | tr -d ' ' | base64 --decode > ~/.ssh/id_do.pem + - echo -n $EC2_KEY_CHUNK_{0..30} >> ~/.ssh/id_ec2.base64 + - cat ~/.ssh/id_ec2.base64 | tr -d ' ' | base64 --decode > ~/.ssh/id_ec2.pem +``` -For more information, see [Opscode's Contribution Guidelines](https://wiki.opscode.com/display/chef/How+to+Contribute). diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1dd5126bf..4e0000484 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,2 +1,4 @@ require 'chefspec' require 'chefspec/berkshelf' + +at_exit { ChefSpec::Coverage.report! } From 6ddbe3692479bb76ba8ad484c58b7e9b30a1bd88 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Tue, 25 Feb 2014 13:29:36 -0500 Subject: [PATCH 11/37] Version bump to 2.3.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index a87a32c03..d57881c91 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@opscode.com' license 'Apache 2.0' description 'Installs and configures nginx' -version '2.2.3' +version '2.3.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' From fbd3cb49ec64286354d4080ab401dfecb7e25d70 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Tue, 25 Feb 2014 13:30:09 -0500 Subject: [PATCH 12/37] Publish 2.3.0 Changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 121fdf0b7..85fca540f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ nginx Cookbook CHANGELOG This file is used to list changes made in each version of the nginx cookbook. +v2.3.0 (2014-02-25) +------------------- +- **[COOK-4293](https://tickets.opscode.com/browse/COOK-4293)** - Update testing Gems in nginx and fix a rubocop warnings +- **[COOK-4237] - Nginx version incorrectly parsed on Ubuntu 13 +- **[COOK-3866] - Nginx default site folder + + v2.2.2 (2014-01-23) ------------------- [COOK-3672] - Add gzip_static option From bebd1cdd8005179b9c913e4f303bb0d1de2184f2 Mon Sep 17 00:00:00 2001 From: Eric Herot Date: Wed, 26 Feb 2014 17:07:49 -0500 Subject: [PATCH 13/37] [COOK-4380] - kitchen.yml platform listings for ubuntu-10.04 and ubuntu-12.04 are missing the dot Signed-off-by: Sean OMeara --- .kitchen.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index c654a9336..63ec48206 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -8,8 +8,8 @@ platforms: - name: centos-5.10 - name: centos-6.5 - name: fedora-19 - - name: ubuntu-1004 - - name: ubuntu-1204 + - name: ubuntu-10.04 + - name: ubuntu-12.04 suites: - name: default From 9716b8ff97d1fd16ff45fcc487b622cb913550e5 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Wed, 12 Feb 2014 18:17:59 +1030 Subject: [PATCH 14/37] [COOK-4330] - Bump nginx version for security issues (CVE-2013-0337, CVE-2013-4547) Signed-off-by: Sean OMeara --- attributes/default.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/attributes/default.rb b/attributes/default.rb index 1b64fcd44..b28abaf17 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -20,6 +20,7 @@ # limitations under the License. # +<<<<<<< HEAD # In order to update the version, the checksum attribute must be changed too. # This attribute is in the source.rb file, though we recommend overriding # attributes by modifying a role, or the node itself. @@ -30,6 +31,17 @@ default['nginx']['log_dir'] = '/var/log/nginx' default['nginx']['binary'] = '/usr/sbin/nginx' default['nginx']['default_root'] = '/var/www/nginx-default' +======= +# In order to update the version, the checksum attribute should be +# changed too. It is in the source.rb file, though we recommend +# overriding attributes by modifying a role, or the node itself. +# default['nginx']['source']['checksum'] +default['nginx']['version'] = "1.4.4" +default['nginx']['package_name'] = "nginx" +default['nginx']['dir'] = "/etc/nginx" +default['nginx']['log_dir'] = "/var/log/nginx" +default['nginx']['binary'] = "/usr/sbin/nginx" +>>>>>>> d117cbe... Upgrade to 1.4.4 to avoid CVE-2013-4547 case node['platform_family'] when 'debian' From 05d0e1b01bee6d1ce1fb1b3bc12cdb8d9f261efa Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 27 Feb 2014 22:29:27 -0500 Subject: [PATCH 15/37] Version bump to 2.4.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index d57881c91..1e95b2a91 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@opscode.com' license 'Apache 2.0' description 'Installs and configures nginx' -version '2.3.0' +version '2.4.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' From 96b89292fda171279e9607a2da11909d1e18774e Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 27 Feb 2014 22:29:47 -0500 Subject: [PATCH 16/37] Publish 2.4.0 Changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85fca540f..19edfcd5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ nginx Cookbook CHANGELOG This file is used to list changes made in each version of the nginx cookbook. +v2.4.0 (2014-02-27) +------------------- +- [COOK-4380] - kitchen.yml platform listings for ubuntu-10.04 and ubuntu-12.04 are missing the dot +- [COOK-4330] - Bump nginx version for security issues (CVE-2013-0337, CVE-2013-4547) + + v2.3.0 (2014-02-25) ------------------- - **[COOK-4293](https://tickets.opscode.com/browse/COOK-4293)** - Update testing Gems in nginx and fix a rubocop warnings From b3180e518e3292606a41ca0e4f8287fd25065322 Mon Sep 17 00:00:00 2001 From: Joshua Timberman Date: Thu, 27 Feb 2014 22:36:12 -0500 Subject: [PATCH 17/37] COOK-4345 - nginx default recipe include install type recipe directly Signed-off-by: Sean OMeara --- recipes/default.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/recipes/default.rb b/recipes/default.rb index 76b35bb71..8ff8f96c0 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -19,12 +19,7 @@ # limitations under the License. # -case node['nginx']['install_method'] -when 'source' - include_recipe 'nginx::source' -when 'package' - include_recipe 'nginx::package' -end +include_recipe "nginx::#{node['nginx']['install_method']}" service 'nginx' do supports :status => true, :restart => true, :reload => true From 7dfffa88d41ec01619b1b0d002553ec963a7e824 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 27 Feb 2014 22:36:45 -0500 Subject: [PATCH 18/37] Version bump to 2.4.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 1e95b2a91..124b6d404 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@opscode.com' license 'Apache 2.0' description 'Installs and configures nginx' -version '2.4.0' +version '2.4.1' 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' From 5b2246f1672a1a9d8ab8ba5599a88bc0522347c0 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 27 Feb 2014 22:37:03 -0500 Subject: [PATCH 19/37] Publish 2.4.1 Changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19edfcd5a..2028d56de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ nginx Cookbook CHANGELOG This file is used to list changes made in each version of the nginx cookbook. +v2.4.1 (2014-02-27) +------------------- +- [COOK-4345] - nginx default recipe include install type recipe directly + + v2.4.0 (2014-02-27) ------------------- - [COOK-4380] - kitchen.yml platform listings for ubuntu-10.04 and ubuntu-12.04 are missing the dot From 76ba901bd5220f1e65c40eb815ece6281ed95718 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Fri, 28 Feb 2014 09:19:26 -0500 Subject: [PATCH 20/37] Revert "[COOK-4330] - Bump nginx version for security issues (CVE-2013-0337, CVE-2013-4547)" This reverts commit 9716b8ff97d1fd16ff45fcc487b622cb913550e5. --- attributes/default.rb | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index b28abaf17..1b64fcd44 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -20,7 +20,6 @@ # limitations under the License. # -<<<<<<< HEAD # In order to update the version, the checksum attribute must be changed too. # This attribute is in the source.rb file, though we recommend overriding # attributes by modifying a role, or the node itself. @@ -31,17 +30,6 @@ default['nginx']['log_dir'] = '/var/log/nginx' default['nginx']['binary'] = '/usr/sbin/nginx' default['nginx']['default_root'] = '/var/www/nginx-default' -======= -# In order to update the version, the checksum attribute should be -# changed too. It is in the source.rb file, though we recommend -# overriding attributes by modifying a role, or the node itself. -# default['nginx']['source']['checksum'] -default['nginx']['version'] = "1.4.4" -default['nginx']['package_name'] = "nginx" -default['nginx']['dir'] = "/etc/nginx" -default['nginx']['log_dir'] = "/var/log/nginx" -default['nginx']['binary'] = "/usr/sbin/nginx" ->>>>>>> d117cbe... Upgrade to 1.4.4 to avoid CVE-2013-4547 case node['platform_family'] when 'debian' From 45311b285902838ad0350557dc65040564c97c85 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Fri, 28 Feb 2014 09:34:28 -0500 Subject: [PATCH 21/37] [COOK-4330] - Bump nginx version for security issues (CVE-2013-0337, CVE-2013-4547) --- attributes/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 1b64fcd44..969fee505 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -23,7 +23,7 @@ # In order to update the version, the checksum attribute must be changed too. # This attribute is in the source.rb file, though we recommend overriding # attributes by modifying a role, or the node itself. -default['nginx']['version'] = '1.2.9' +default['nginx']['version'] = '1.4.4' default['nginx']['package_name'] = 'nginx' default['nginx']['dir'] = '/etc/nginx' default['nginx']['script_dir'] = '/usr/sbin' From 079ed7c834f9222f4e63a2454e9db0640544795d Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Fri, 28 Feb 2014 09:39:17 -0500 Subject: [PATCH 22/37] Version bump to 2.4.2 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 124b6d404..b8a2df21d 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@opscode.com' license 'Apache 2.0' description 'Installs and configures nginx' -version '2.4.1' +version '2.4.2' 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' From 6d3bf30ce1983465978abe46600461037b810288 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Fri, 28 Feb 2014 09:39:32 -0500 Subject: [PATCH 23/37] Publish 2.4.2 Changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2028d56de..0e738e7f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ nginx Cookbook CHANGELOG This file is used to list changes made in each version of the nginx cookbook. +v2.4.2 (2014-02-28) +------------------- +Fixing bad commit from COOK-4330 + + v2.4.1 (2014-02-27) ------------------- - [COOK-4345] - nginx default recipe include install type recipe directly From fc572f0eab471d9a0c609d2b415ec89c6a5ced50 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Fri, 28 Feb 2014 09:41:42 -0500 Subject: [PATCH 24/37] Bumping to 2.4.3 for devodd --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index b8a2df21d..708ad9def 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@opscode.com' license 'Apache 2.0' description 'Installs and configures nginx' -version '2.4.2' +version '2.4.3' 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' From 3c1e9362e5fe96ae9bd4da25b213fcfd78d8aee6 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Thu, 13 Mar 2014 21:27:21 -0400 Subject: [PATCH 25/37] Update Rubocop and fix new warnings Fixes #175 --- .rubocop.yml | 5 ++--- Gemfile | 3 +-- attributes/default.rb | 26 +++++++++++++------------- attributes/passenger.rb | 4 ++-- attributes/source.rb | 18 +++++++++--------- recipes/commons_dir.rb | 2 +- recipes/commons_script.rb | 2 +- recipes/http_geoip_module.rb | 4 ++-- recipes/passenger.rb | 4 ++-- recipes/repo.rb | 2 +- recipes/source.rb | 6 +++--- 11 files changed, 37 insertions(+), 39 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 5f5d138a9..b1b67f99e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,11 +1,10 @@ AlignParameters: Enabled: false - +ClassAndModuleChildren: + Enabled: false Encoding: Enabled: false - LineLength: Max: 200 - HashSyntax: EnforcedStyle: hash_rockets diff --git a/Gemfile b/Gemfile index 7207cc127..2752760ad 100644 --- a/Gemfile +++ b/Gemfile @@ -2,8 +2,7 @@ source 'https://rubygems.org' group :lint do gem 'foodcritic', '~> 3.0' - gem 'rubocop', '~> 0.18' - gem 'rainbow', '< 2.0' + gem 'rubocop', '~> 0.19' end group :unit do diff --git a/attributes/default.rb b/attributes/default.rb index 969fee505..9052e4288 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -62,19 +62,19 @@ default['nginx']['gzip_proxied'] = 'any' default['nginx']['gzip_vary'] = 'off' default['nginx']['gzip_buffers'] = nil -default['nginx']['gzip_types'] = %w[ - text/plain - text/css - application/x-javascript - text/xml - application/xml - application/rss+xml - application/atom+xml - text/javascript - application/javascript - application/json - text/mathml - ] +default['nginx']['gzip_types'] = %w( + text/plain + text/css + application/x-javascript + text/xml + application/xml + application/rss+xml + application/atom+xml + text/javascript + application/javascript + application/json + text/mathml +) default['nginx']['gzip_min_length'] = 1_000 default['nginx']['gzip_disable'] = 'MSIE [1-6]\.' diff --git a/attributes/passenger.rb b/attributes/passenger.rb index 361b142e0..c84d4ee7e 100644 --- a/attributes/passenger.rb +++ b/attributes/passenger.rb @@ -33,8 +33,8 @@ node.default['nginx']['passenger']['ruby'] = '/usr/bin/ruby' end -node.default['nginx']['passenger']['packages']['rhel'] = %w[ruby-devel curl-devel] -node.default['nginx']['passenger']['packages']['debian'] = %w[ruby-dev libcurl4-gnutls-dev] +node.default['nginx']['passenger']['packages']['rhel'] = %w(ruby-devel curl-devel) +node.default['nginx']['passenger']['packages']['debian'] = %w(ruby-dev libcurl4-gnutls-dev) node.default['nginx']['passenger']['spawn_method'] = 'smart-lv2' node.default['nginx']['passenger']['buffer_response'] = 'on' diff --git a/attributes/source.rb b/attributes/source.rb index 7b4ec635a..59240c24f 100644 --- a/attributes/source.rb +++ b/attributes/source.rb @@ -25,18 +25,18 @@ default['nginx']['source']['prefix'] = "/opt/nginx-#{node['nginx']['source']['version']}" default['nginx']['source']['conf_path'] = "#{node['nginx']['dir']}/nginx.conf" default['nginx']['source']['sbin_path'] = "#{node['nginx']['source']['prefix']}/sbin/nginx" -default['nginx']['source']['default_configure_flags'] = %W[ - --prefix=#{node['nginx']['source']['prefix']} - --conf-path=#{node['nginx']['dir']}/nginx.conf - --sbin-path=#{node['nginx']['source']['sbin_path']} - ] +default['nginx']['source']['default_configure_flags'] = %W( + --prefix=#{node['nginx']['source']['prefix']} + --conf-path=#{node['nginx']['dir']}/nginx.conf + --sbin-path=#{node['nginx']['source']['sbin_path']} +) default['nginx']['configure_flags'] = [] default['nginx']['source']['version'] = node['nginx']['version'] default['nginx']['source']['url'] = "http://nginx.org/download/nginx-#{node['nginx']['source']['version']}.tar.gz" default['nginx']['source']['checksum'] = '0510af71adac4b90484ac8caf3b8bd519a0f7126250c2799554d7a751a2db388' -default['nginx']['source']['modules'] = %w[ - nginx::http_ssl_module - nginx::http_gzip_static_module - ] +default['nginx']['source']['modules'] = %w( + nginx::http_ssl_module + nginx::http_gzip_static_module +) default['nginx']['source']['use_existing_user'] = false diff --git a/recipes/commons_dir.rb b/recipes/commons_dir.rb index 93356b5ee..d2c87ed5e 100644 --- a/recipes/commons_dir.rb +++ b/recipes/commons_dir.rb @@ -40,7 +40,7 @@ recursive true end -%w[sites-available sites-enabled conf.d].each do |leaf| +%w(sites-available sites-enabled conf.d).each do |leaf| directory File.join(node['nginx']['dir'], leaf) do owner 'root' group 'root' diff --git a/recipes/commons_script.rb b/recipes/commons_script.rb index bb6b65ff2..bf0d22561 100644 --- a/recipes/commons_script.rb +++ b/recipes/commons_script.rb @@ -19,7 +19,7 @@ # limitations under the License. # -%w[nxensite nxdissite].each do |nxscript| +%w(nxensite nxdissite).each do |nxscript| template "#{node['nginx']['script_dir']}/#{nxscript}" do source "#{nxscript}.erb" mode '0755' diff --git a/recipes/http_geoip_module.rb b/recipes/http_geoip_module.rb index 619e707b1..42d21aea6 100644 --- a/recipes/http_geoip_module.rb +++ b/recipes/http_geoip_module.rb @@ -60,7 +60,7 @@ remote_file country_src_filepath do not_if do - File.exists?(country_src_filepath) && + File.exist?(country_src_filepath) && File.mtime(country_src_filepath) > Time.now - 86_400 end source node['nginx']['geoip']['country_dat_url'] @@ -82,7 +82,7 @@ remote_file city_src_filepath do not_if do - File.exists?(city_src_filepath) && + File.exist?(city_src_filepath) && File.mtime(city_src_filepath) > Time.now - 86_400 end source node['nginx']['geoip']['city_dat_url'] diff --git a/recipes/passenger.rb b/recipes/passenger.rb index 5b6cfbf4e..b89792a53 100644 --- a/recipes/passenger.rb +++ b/recipes/passenger.rb @@ -18,8 +18,8 @@ # packages = value_for_platform_family( - %w[rhel] => node['nginx']['passenger']['packages']['rhel'], - %w[debian] => node['nginx']['passenger']['packages']['debian'] + %w(rhel) => node['nginx']['passenger']['packages']['rhel'], + %w(debian) => node['nginx']['passenger']['packages']['debian'] ) unless packages.empty? diff --git a/recipes/repo.rb b/recipes/repo.rb index 89548cb7b..3570d2f47 100644 --- a/recipes/repo.rb +++ b/recipes/repo.rb @@ -34,7 +34,7 @@ apt_repository 'nginx' do uri node['nginx']['upstream_repository'] distribution node['lsb']['codename'] - components %w[nginx] + components %w(nginx) deb_src true key 'http://nginx.org/keys/nginx_signing.key' end diff --git a/recipes/source.rb b/recipes/source.rb index a45724161..7a40c1eb1 100644 --- a/recipes/source.rb +++ b/recipes/source.rb @@ -46,9 +46,9 @@ src_filepath = "#{Chef::Config['file_cache_path'] || '/tmp'}/nginx-#{node['nginx']['source']['version']}.tar.gz" packages = value_for_platform_family( - %w[rhel fedora] => %w[pcre-devel openssl-devel], - %w[gentoo] => [], - %w[default] => %w[libpcre3 libpcre3-dev libssl-dev] + %w(rhel fedora) => %w(pcre-devel openssl-devel), + %w(gentoo) => [], + %w(default) => %w(libpcre3 libpcre3-dev libssl-dev) ) packages.each do |name| From a7cc365e5c663ce8fd4b23c35b556007c2591e61 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Thu, 13 Mar 2014 21:27:35 -0400 Subject: [PATCH 26/37] Bump Berkshelf version --- Berksfile | 2 +- Gemfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Berksfile b/Berksfile index 9493e590b..2f6bb4186 100644 --- a/Berksfile +++ b/Berksfile @@ -1,4 +1,4 @@ -site :opscode +source 'https://api.berkshelf.com' metadata group :integration do diff --git a/Gemfile b/Gemfile index 2752760ad..9dae2bf63 100644 --- a/Gemfile +++ b/Gemfile @@ -6,8 +6,8 @@ group :lint do end group :unit do - gem 'berkshelf', '~> 3.0.0.beta6' - gem 'chefspec', '~> 3.1' + gem 'berkshelf', '~> 3.0.0.beta7' + gem 'chefspec', '~> 3.1' end group :kitchen_common do From a2e4c6713eb3a03565a11ecf64e2e0e23485a513 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Thu, 13 Mar 2014 21:27:43 -0400 Subject: [PATCH 27/37] Use build-essential 2.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 708ad9def..3f99b3af3 100644 --- a/metadata.rb +++ b/metadata.rb @@ -10,7 +10,7 @@ depends 'apt', '~> 2.2' depends 'bluepill', '~> 2.3' -depends 'build-essential', '~> 1.4' +depends 'build-essential', '~> 2.0' depends 'ohai', '~> 1.1' depends 'runit', '~> 1.2' depends 'yum', '~> 3.0' From 26ab04cfcaf842493a06a8dd59278a5bf63d5a42 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Thu, 13 Mar 2014 21:27:55 -0400 Subject: [PATCH 28/37] Don't lock transitive dependency yum (just use yum-epel) --- metadata.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/metadata.rb b/metadata.rb index 3f99b3af3..b4e123c37 100644 --- a/metadata.rb +++ b/metadata.rb @@ -13,8 +13,7 @@ depends 'build-essential', '~> 2.0' depends 'ohai', '~> 1.1' depends 'runit', '~> 1.2' -depends 'yum', '~> 3.0' -depends 'yum-epel' +depends 'yum-epel', '~> 0.3' supports 'amazon' supports 'centos' From f99eab5bda67fdc08586e72c86a8a8100fe7112c Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Thu, 13 Mar 2014 21:30:51 -0400 Subject: [PATCH 29/37] Fix lua (EXPORT -> export) - Fixes #178 - Fixes #186 --- recipes/lua.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/lua.rb b/recipes/lua.rb index 208570e51..73cbdeff4 100644 --- a/recipes/lua.rb +++ b/recipes/lua.rb @@ -36,8 +36,8 @@ tar xzf #{luajit_src_filename} -C #{luajit_extract_path} cd luajit-#{node['nginx']['luajit']['version']}/LuaJIT-#{node['nginx']['luajit']['version']} make && make install - EXPORT LUAJIT_INC="/usr/local/include/luajit-2.0" - EXPORT LUAJIT_LIB="usr/local/lib" + export LUAJIT_INC="/usr/local/include/luajit-2.0" + export LUAJIT_LIB="usr/local/lib" EOH not_if { ::File.exists?(luajit_extract_path) } end From d7f96adf700158f2400ee606830c598c62858a87 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Thu, 13 Mar 2014 21:32:28 -0400 Subject: [PATCH 30/37] Fix service name in tests - Fixes #198 --- test/integration/default/bats/check_service.bats | 2 +- test/integration/source/bats/check_service.bats | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/default/bats/check_service.bats b/test/integration/default/bats/check_service.bats index 2306be385..2dca4bd60 100644 --- a/test/integration/default/bats/check_service.bats +++ b/test/integration/default/bats/check_service.bats @@ -1,3 +1,3 @@ -@test "check memcache service" { +@test "check nginx service" { ps -ef | grep nginx } diff --git a/test/integration/source/bats/check_service.bats b/test/integration/source/bats/check_service.bats index 2306be385..2dca4bd60 100644 --- a/test/integration/source/bats/check_service.bats +++ b/test/integration/source/bats/check_service.bats @@ -1,3 +1,3 @@ -@test "check memcache service" { +@test "check nginx service" { ps -ef | grep nginx } From afb65682ec4fa44956aeb53b847677364fede5d8 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 13 Mar 2014 22:02:03 -0400 Subject: [PATCH 31/37] Version bump to 2.4.4 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index b4e123c37..7bf9d649f 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@opscode.com' license 'Apache 2.0' description 'Installs and configures nginx' -version '2.4.3' +version '2.4.4' 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' From 023741b9b3ee9beb0e812ebb75437e07a28470fb Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 13 Mar 2014 22:02:15 -0400 Subject: [PATCH 32/37] Publish 2.4.4 Changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e738e7f6..8fb442e30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ nginx Cookbook CHANGELOG This file is used to list changes made in each version of the nginx cookbook. +v2.4.4 (2014-03-13) +------------------- +- Updating for build-essential 2.0 + + v2.4.2 (2014-02-28) ------------------- Fixing bad commit from COOK-4330 From b3bc5467da89e264515562a71486b3f560bc96a0 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 13 Mar 2014 22:19:04 -0400 Subject: [PATCH 33/37] updating for devodd --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 7bf9d649f..75f901d4a 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@opscode.com' license 'Apache 2.0' description 'Installs and configures nginx' -version '2.4.4' +version '2.4.5' 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' From 094685b2c649d80fb7c58b0cf0805820dcbe174c Mon Sep 17 00:00:00 2001 From: James Cuzella Date: Thu, 27 Mar 2014 23:27:55 -0400 Subject: [PATCH 34/37] [COOK-4323] - Need a resource to easily configure available sites (vhosts) Signed-off-by: Sean OMeara --- .kitchen.yml | 9 +++ Berksfile | 1 + README.md | 69 +++++++++++++++++++ attributes/default.rb | 5 ++ definitions/nginx_site.rb | 15 +++- recipes/commons_conf.rb | 8 --- templates/default/default-site.erb | 19 +++-- .../cookbooks/nginx_test/CHANGELOG.md | 13 ++++ test/fixtures/cookbooks/nginx_test/README.md | 31 +++++++++ .../nginx_test/files/default/index.html | 9 +++ .../fixtures/cookbooks/nginx_test/metadata.rb | 7 ++ .../cookbooks/nginx_test/recipes/default.rb | 18 +++++ .../cookbooks/nginx_test/recipes/lwrps.rb | 51 ++++++++++++++ .../helpers/serverspec/spec_helper.rb | 10 +++ .../lwrps/serverspec/nginx_site_spec.rb | 13 ++++ 15 files changed, 264 insertions(+), 14 deletions(-) create mode 100644 test/fixtures/cookbooks/nginx_test/CHANGELOG.md create mode 100644 test/fixtures/cookbooks/nginx_test/README.md create mode 100644 test/fixtures/cookbooks/nginx_test/files/default/index.html create mode 100644 test/fixtures/cookbooks/nginx_test/metadata.rb create mode 100644 test/fixtures/cookbooks/nginx_test/recipes/default.rb create mode 100644 test/fixtures/cookbooks/nginx_test/recipes/lwrps.rb create mode 100644 test/integration/helpers/serverspec/spec_helper.rb create mode 100644 test/integration/lwrps/serverspec/nginx_site_spec.rb diff --git a/.kitchen.yml b/.kitchen.yml index 63ec48206..53e2b507e 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -6,10 +6,15 @@ provisioner: platforms: - name: centos-5.10 + run_list: recipe[yum::default] - name: centos-6.5 + run_list: recipe[yum::default] - name: fedora-19 + run_list: recipe[yum::default] - name: ubuntu-10.04 + run_list: recipe[apt::default] - name: ubuntu-12.04 + run_list: recipe[apt::default] suites: - name: default @@ -28,6 +33,10 @@ suites: attributes: nginx: repo_source: nginx + - name: lwrps + run_list: + - recipe[nginx::default] + - recipe[nginx_test::lwrps] - name: modules run_list: - recipe[nginx::source] diff --git a/Berksfile b/Berksfile index 2f6bb4186..b1ce575a1 100644 --- a/Berksfile +++ b/Berksfile @@ -2,6 +2,7 @@ source 'https://api.berkshelf.com' metadata group :integration do + cookbook 'nginx_test', path: 'test/fixtures/cookbooks/nginx_test' cookbook 'apt', '~> 2.0' cookbook 'minitest-handler' end diff --git a/README.md b/README.md index eda32d092..bef968c32 100644 --- a/README.md +++ b/README.md @@ -354,6 +354,75 @@ attribute `node['nginx']['source']['modules']`. - `openssl_source.rb` - downloads and uses custom OpenSSL source when compiling nginx +Definitions +=========== + +The cookbook provides a definition. At some point in the future +these definitions may be refactored into lightweight resources and +providers as suggested by +[foodcritic rule FC015](http://acrmp.github.com/foodcritic/#FC015). + +nginx\_site +-------- + +Manage a template resource for a Server Block (VirtualHost) site, and enable it with +`nxensite` script. This is commonly done for managing web applications +such as Ruby on Rails, PHP or Django, and the default behavior +reflects that. However it is flexible. + + +It will then configure the template (see __Parameters__ and +__Examples__ below), and enable or disable the site per the `enable` +parameter. + +### Parameters: + +Current parameters used by the definition: + +* `name` - The name of the site. The template will be written to + `#{node['nginx']['dir']}/sites-available/#{params['name']}` +* `cookbook` - Optional. Cookbook where the source template is. If + this is not defined, Chef will use the named template in the + cookbook where the definition is used. +* `template` - Default `default-site.erb`, source template file. +* `enable` - Default true. Uses `nxensite` or `nxdissite` script as appropriate. + +Additional parameters can be defined when the definition is called in +a recipe, see __Examples__. + +### Examples: + +All parameters are passed into the template. You can use whatever you +like. The nginx cookbook comes with a `default-site.erb` template as +an example. The following parameters are used in the template: + +* `server_name` - Default `node['hostname']`, Sets `server_name` directive. +* `port` - Default 80, Used to set the port for the `listen` directive. +* `default_server` - Used in `listen` directive. Will set `default_server` option on nginx >= `0.8.21` and `default` on nginx < `0.8.21`. +* `docroot` - Default `node['nginx']['default_root']`, root directive for default `location /` block. +* `directory_index` - Allow overriding the default `index` setting, optional + +To use the default nginx_site, for example: + + nginx_site 'test-site' do + cookbook 'nginx' + server_name 'example.com' + default_server true + docroot '/var/www/test-site' + directory_index 'index.html index.htm' + end + +The parameters specified will be used as: + +* `@params[:server_name]` +* `@params[:default_server]` +* `@params[:docroot]` +* `@params[:directory_index]` + +In the template. When you write your own, the `@` is significant. + +For more information about Definitions and parameters, see the +[Chef Wiki](http://wiki.opscode.com/display/chef/Definitions) Adding New Modules ------------------ diff --git a/attributes/default.rb b/attributes/default.rb index 9052e4288..8eaff1a39 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -30,6 +30,7 @@ default['nginx']['log_dir'] = '/var/log/nginx' default['nginx']['binary'] = '/usr/sbin/nginx' default['nginx']['default_root'] = '/var/www/nginx-default' +default['nginx']['root_group'] = 'root' case node['platform_family'] when 'debian' @@ -42,6 +43,10 @@ when 'gentoo' default['nginx']['user'] = 'nginx' default['nginx']['init_style'] = 'init' +when 'freebsd' + default['nginx']['user'] = 'www' + default['nginx']['init_style'] = 'init' + default['nginx']['root_group'] = 'wheel' else default['nginx']['user'] = 'www-data' default['nginx']['init_style'] = 'init' diff --git a/definitions/nginx_site.rb b/definitions/nginx_site.rb index 934b0e124..a16816668 100644 --- a/definitions/nginx_site.rb +++ b/definitions/nginx_site.rb @@ -19,8 +19,21 @@ # limitations under the License. # -define :nginx_site, :enable => true, :timing => :delayed do +define :nginx_site, :template => 'default-site.erb', :port => 80, :docroot => '/var/www/nginx-default', :enable => true, :timing => :delayed do if params[:enable] + + if params[:template] + template "#{node['nginx']['dir']}/sites-available/#{params[:name]}" do + source params[:template] + owner 'root' + group node['nginx']['root_group'] + mode '0644' + cookbook params[:cookbook] if params[:cookbook] + variables(:params => params) + notifies :reload, 'service[nginx]', params[:timing] if ::File.exists?("#{node['nginx']['dir']}/sites-enabled/#{params[:name]}") + end + end + execute "nxensite #{params[:name]}" do command "#{node['nginx']['script_dir']}/nxensite #{params[:name]}" notifies :reload, 'service[nginx]', params[:timing] diff --git a/recipes/commons_conf.rb b/recipes/commons_conf.rb index 9cbc21cb4..67a3ce9fa 100644 --- a/recipes/commons_conf.rb +++ b/recipes/commons_conf.rb @@ -28,14 +28,6 @@ notifies :reload, 'service[nginx]' end -template "#{node['nginx']['dir']}/sites-available/default" do - source 'default-site.erb' - owner 'root' - group 'root' - mode '0644' - notifies :reload, 'service[nginx]' -end - nginx_site 'default' do enable node['nginx']['default_site_enabled'] end diff --git a/templates/default/default-site.erb b/templates/default/default-site.erb index 8ee06d03b..e37786d91 100644 --- a/templates/default/default-site.erb +++ b/templates/default/default-site.erb @@ -1,11 +1,20 @@ +# Generated by Chef for <%= node['hostname'] %> (nginx version: <%= node['nginx']['version'] %>) +# +# Local modifications will be overwritten. +# server { - listen 80; - server_name <%= node['hostname'] %>; + listen <%= @params[:port] %><%= @params[:default_server] ? node['nginx']['version'] >= '0.8.21' ? ' default_server' : ' default' : '' %>; + server_name <%= @params[:server_name].nil? ? node['hostname'] : @params[:server_name] %>; - access_log <%= node['nginx']['log_dir'] %>/localhost.access.log; + access_log <%= node['nginx']['log_dir'] %>/<%= @params[:name] %>-access.log; + error_log <%= node['nginx']['log_dir'] %>/<%= @params[:name] %>-error.log; location / { - root <%= node['nginx']['default_root'] %>; - index index.html index.htm; + root <%= @params[:docroot].nil? ? node['nginx']['default_root'] : @params[:docroot] %>; + <% if @params[:directory_index] -%> + index <%= [@params[:directory_index]].flatten.join " " %>; + <% else -%> + index index.html index.htm; + <% end -%> } } diff --git a/test/fixtures/cookbooks/nginx_test/CHANGELOG.md b/test/fixtures/cookbooks/nginx_test/CHANGELOG.md new file mode 100644 index 000000000..bb276b57d --- /dev/null +++ b/test/fixtures/cookbooks/nginx_test/CHANGELOG.md @@ -0,0 +1,13 @@ +nginx_test CHANGELOG +==================== + +This file is used to list changes made in each version of the nginx_test cookbook. + +0.1.0 +----- +- [your_name] - Initial release of nginx_test + +- - - +Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown. + +The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown. diff --git a/test/fixtures/cookbooks/nginx_test/README.md b/test/fixtures/cookbooks/nginx_test/README.md new file mode 100644 index 000000000..a19f8432b --- /dev/null +++ b/test/fixtures/cookbooks/nginx_test/README.md @@ -0,0 +1,31 @@ +nginx_test Cookbook +=================== +A test fixture cookbook for importing some test SQL files into a test-kitchen VM + +Using the [test fixture cookbook pattern](https://gist.github.com/nathwill/8827641). + +What? Surprised to see a cookbook within a cookbook you say? Don't tell me you haven't seen [Inception](http://www.imdb.com/title/tt1375666/)! + +Requirements +------------ + + +#### cookbooks +- `nginx` - nginx_test needs nginx to test it. + +Usage +----- +#### nginx_test::lwrps +Just include `nginx_test::lwrps` in your test-kitchen suite's `run_list`: + +```yaml +suites: + - name: nginx_site + run_list: + - recipe[nginx::default] + - recipe[nginx:lwrps] +``` + +License and Authors +------------------- +Authors: James Cuzella diff --git a/test/fixtures/cookbooks/nginx_test/files/default/index.html b/test/fixtures/cookbooks/nginx_test/files/default/index.html new file mode 100644 index 000000000..233e285a7 --- /dev/null +++ b/test/fixtures/cookbooks/nginx_test/files/default/index.html @@ -0,0 +1,9 @@ + + + + Nginx Works! + + +

It Works!

+ + diff --git a/test/fixtures/cookbooks/nginx_test/metadata.rb b/test/fixtures/cookbooks/nginx_test/metadata.rb new file mode 100644 index 000000000..3aae0ba54 --- /dev/null +++ b/test/fixtures/cookbooks/nginx_test/metadata.rb @@ -0,0 +1,7 @@ +name 'nginx_test' +maintainer 'TangoGroup' +maintainer_email 'cookbooks@tangogroup.com' +license 'Apache 2.0' +description 'Installs/Configures nginx_test' +long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) +version '0.1.0' diff --git a/test/fixtures/cookbooks/nginx_test/recipes/default.rb b/test/fixtures/cookbooks/nginx_test/recipes/default.rb new file mode 100644 index 000000000..27c28de2f --- /dev/null +++ b/test/fixtures/cookbooks/nginx_test/recipes/default.rb @@ -0,0 +1,18 @@ +# +# Cookbook Name:: nginx_test +# Recipe:: default +# +# Copyright 2014, TangoGroup +# +# 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. +# diff --git a/test/fixtures/cookbooks/nginx_test/recipes/lwrps.rb b/test/fixtures/cookbooks/nginx_test/recipes/lwrps.rb new file mode 100644 index 000000000..25a6a8645 --- /dev/null +++ b/test/fixtures/cookbooks/nginx_test/recipes/lwrps.rb @@ -0,0 +1,51 @@ +# +# Cookbook Name:: nginx_test +# Recipe:: lwrps +# +# Copyright 2014, James Cuzella +# +# 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. +# +include_recipe 'nginx::default' + +# Need wget to test that the site works in serverspec +package 'wget' + +# Need netstat from net-tools package on fedora +case node['platform'] +when 'fedora' + package 'net-tools' +end + +directory '/var/www/' do + owner 'root' + action :create +end + +directory '/var/www/test-site' do + owner node['nginx']['user'] + action :create +end + +cookbook_file 'index.html' do + owner node['nginx']['user'] + path '/var/www/test-site/index.html' + action :create +end + +nginx_site 'test-site' do + cookbook 'nginx' + default_server true + docroot '/var/www/test-site' + directory_index 'index.html index.htm' +end diff --git a/test/integration/helpers/serverspec/spec_helper.rb b/test/integration/helpers/serverspec/spec_helper.rb new file mode 100644 index 000000000..81b4e4a19 --- /dev/null +++ b/test/integration/helpers/serverspec/spec_helper.rb @@ -0,0 +1,10 @@ +require 'serverspec' + +include Serverspec::Helper::DetectOS +include Serverspec::Helper::Exec + +RSpec.configure do |c| + c.before :all do + c.os = backend(Serverspec::Commands::Base).check_os + end +end diff --git a/test/integration/lwrps/serverspec/nginx_site_spec.rb b/test/integration/lwrps/serverspec/nginx_site_spec.rb new file mode 100644 index 000000000..fc5c81a67 --- /dev/null +++ b/test/integration/lwrps/serverspec/nginx_site_spec.rb @@ -0,0 +1,13 @@ +require 'spec_helper' + +describe port(80) do + it { should be_listening } +end + +# Check that the demo app is functioning properly +# This was setup by the test fixture cookbook: nginx_test::lwrps +# Site defined in test/fixtures/cookbooks/nginx_test/files/default/index.html +describe command('wget -O- http://127.0.0.1/') do + it { should return_stdout(/Nginx Works!/) } + it { should return_stderr(/200 OK/) } +end From dcf1274ea401e5c29c4b3471580b988aa8e7fad8 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 27 Mar 2014 23:31:02 -0400 Subject: [PATCH 35/37] Version bump to 2.5.0 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 75f901d4a..7ff2fdf7c 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@opscode.com' license 'Apache 2.0' description 'Installs and configures nginx' -version '2.4.5' +version '2.5.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' From 97eb9168f3fedb3a4e5c2fe95c22d5fc153848b5 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 27 Mar 2014 23:31:09 -0400 Subject: [PATCH 36/37] Publish 2.5.0 Changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fb442e30..9336407aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ nginx Cookbook CHANGELOG This file is used to list changes made in each version of the nginx cookbook. +v2.5.0 (2014-03-27) +------------------- +- [COOK-4323] - Need a resource to easily configure available sites (vhosts) + + v2.4.4 (2014-03-13) ------------------- - Updating for build-essential 2.0 From 609b9191c95bf33430962c9e57f224fc00c51680 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 27 Mar 2014 23:32:21 -0400 Subject: [PATCH 37/37] bumping for devodd --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 7ff2fdf7c..1690a8083 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'cookbooks@opscode.com' license 'Apache 2.0' description 'Installs and configures nginx' -version '2.5.0' +version '2.5.1' 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'