From fc265014de81c244fb31521b4b7c1eeba07ebdfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Thu, 14 Mar 2019 10:35:11 +0100 Subject: [PATCH] Switch back to the upstream nginx cookbook chef_nginx is deprecated --- Berksfile | 4 +- Berksfile.lock | 25 ++-- cookbooks/chef_nginx/.foodcritic | 1 - cookbooks/chef_nginx/MAINTAINERS.md | 15 -- cookbooks/chef_nginx/libraries/matchers.rb | 35 ----- cookbooks/chef_nginx/metadata.json | 1 - cookbooks/mediawiki/metadata.json | 2 +- cookbooks/mediawiki/metadata.rb | 2 +- cookbooks/mediawiki/recipes/database.rb | 1 + cookbooks/mediawiki/recipes/default.rb | 2 +- cookbooks/mediawiki/recipes/nginx.rb | 2 +- cookbooks/{chef_nginx => nginx}/CHANGELOG.md | 90 +++++++++++- .../{chef_nginx => nginx}/CONTRIBUTING.md | 0 cookbooks/{chef_nginx => nginx}/README.md | 131 ++++++++++-------- .../attributes/auth_request.rb | 2 +- .../attributes/default.rb | 16 ++- .../{chef_nginx => nginx}/attributes/devel.rb | 2 +- .../{chef_nginx => nginx}/attributes/echo.rb | 6 +- .../{chef_nginx => nginx}/attributes/geoip.rb | 2 +- .../attributes/headers_more.rb | 2 +- .../{chef_nginx => nginx}/attributes/lua.rb | 6 +- .../{chef_nginx => nginx}/attributes/naxsi.rb | 2 +- .../attributes/openssl_source.rb | 2 +- .../attributes/pagespeed.rb | 2 +- .../attributes/passenger.rb | 17 ++- .../attributes/rate_limiting.rb | 2 +- .../{chef_nginx => nginx}/attributes/repo.rb | 18 ++- .../attributes/set_misc.rb | 2 +- .../attributes/socketproxy.rb | 2 +- .../attributes/source.rb | 13 +- .../attributes/status.rb | 2 +- .../attributes/syslog.rb | 2 +- .../attributes/upload_progress.rb | 2 +- .../files/default => nginx/files}/mime.types | 1 + .../default => nginx/files}/naxsi_core.rules | 0 .../libraries/helpers.rb | 4 +- .../libraries/nginx_version.rb | 0 cookbooks/nginx/metadata.json | 1 + .../recipes/authorized_ips.rb | 0 .../{chef_nginx => nginx}/recipes/commons.rb | 6 +- .../recipes/commons_conf.rb | 0 .../recipes/commons_dir.rb | 2 +- .../recipes/commons_script.rb | 2 +- .../{chef_nginx => nginx}/recipes/default.rb | 6 +- .../recipes/headers_more_module.rb | 0 .../recipes/http_auth_request_module.rb | 2 +- .../recipes/http_echo_module.rb | 0 .../recipes/http_geoip_module.rb | 0 .../recipes/http_gzip_static_module.rb | 0 .../recipes/http_mp4_module.rb | 0 .../recipes/http_perl_module.rb | 0 .../recipes/http_realip_module.rb | 0 .../recipes/http_spdy_module.rb | 0 .../recipes/http_ssl_module.rb | 0 .../recipes/http_stub_status_module.rb | 2 +- .../recipes/http_v2_module.rb | 0 .../{chef_nginx => nginx}/recipes/ipv6.rb | 0 .../{chef_nginx => nginx}/recipes/lua.rb | 0 .../recipes/naxsi_module.rb | 0 .../recipes/ngx_devel_module.rb | 0 .../recipes/ngx_lua_module.rb | 4 +- .../recipes/ohai_plugin.rb | 0 .../recipes/openssl_source.rb | 0 .../{chef_nginx => nginx}/recipes/package.rb | 16 ++- .../recipes/pagespeed_module.rb | 2 +- .../recipes/passenger.rb | 2 +- .../{chef_nginx => nginx}/recipes/repo.rb | 0 .../recipes/repo_passenger.rb | 3 +- .../{chef_nginx => nginx}/recipes/set_misc.rb | 2 +- .../recipes/socketproxy.rb | 2 +- .../{chef_nginx => nginx}/recipes/source.rb | 19 +-- .../recipes/syslog_module.rb | 0 .../recipes/upload_progress_module.rb | 0 cookbooks/nginx/resources/cleanup_runit.rb | 36 +++++ .../{chef_nginx => nginx}/resources/site.rb | 24 ++-- cookbooks/nginx/resources/stream.rb | 65 +++++++++ .../templates/debian/nginx.init.erb | 0 .../templates/default/default-site.erb | 0 .../default/modules/authorized_ip.erb | 0 .../default/modules/http_geoip.conf.erb | 0 .../default/modules/http_gzip_static.conf.erb | 0 .../default/modules/http_realip.conf.erb | 2 - .../default/modules/nginx_status.erb | 0 .../default/modules/passenger.conf.erb | 0 .../default/modules/socketproxy.conf.erb | 0 .../default/modules/upload_progress.erb | 0 .../templates/default/nginx-upstart.conf.erb | 2 +- .../templates/default/nginx.conf.erb | 22 ++- .../templates/default/nginx.init.erb | 0 .../templates/default/nginx.service.erb | 0 .../templates/default/nginx.sysconfig.erb | 1 + .../templates/default/nxdissite.erb | 0 .../nginx/templates/default/nxdisstream.erb | 29 ++++ .../templates/default/nxensite.erb | 0 .../nginx/templates/default/nxenstream.erb | 38 +++++ .../default/plugins/ohai-nginx.rb.erb | 0 .../templates/default/sv-nginx-log-run.erb | 0 .../templates/default/sv-nginx-run.erb | 0 .../templates/ubuntu/nginx.init.erb | 0 cookbooks/tar/.foodcritic | 1 - cookbooks/tar/CHANGELOG.md | 16 +++ cookbooks/tar/MAINTAINERS.md | 15 -- cookbooks/tar/README.md | 80 +++++++---- cookbooks/tar/libraries/matchers.rb | 16 --- cookbooks/tar/metadata.json | 2 +- cookbooks/tar/recipes/default.rb | 2 +- cookbooks/tar/resources/extract.rb | 5 +- cookbooks/tar/resources/package.rb | 6 +- cookbooks/wordpress/metadata.json | 2 +- cookbooks/wordpress/metadata.rb | 2 +- cookbooks/wordpress/recipes/nginx.rb | 2 +- cookbooks/zypper/CHANGELOG.md | 25 ---- cookbooks/zypper/README.md | 126 ----------------- cookbooks/zypper/attributes/default.rb | 1 - cookbooks/zypper/libraries/matchers.rb | 12 -- cookbooks/zypper/metadata.json | 1 - cookbooks/zypper/providers/repo.rb | 68 --------- cookbooks/zypper/recipes/default.rb | 30 ---- cookbooks/zypper/recipes/smt_client.rb | 50 ------- cookbooks/zypper/resources/repo.rb | 8 -- site-cookbooks/kosmos-nginx/metadata.rb | 2 +- .../kosmos-nginx/recipes/default.rb | 2 +- 122 files changed, 565 insertions(+), 617 deletions(-) delete mode 100644 cookbooks/chef_nginx/.foodcritic delete mode 100644 cookbooks/chef_nginx/MAINTAINERS.md delete mode 100644 cookbooks/chef_nginx/libraries/matchers.rb delete mode 100644 cookbooks/chef_nginx/metadata.json rename cookbooks/{chef_nginx => nginx}/CHANGELOG.md (88%) rename cookbooks/{chef_nginx => nginx}/CONTRIBUTING.md (100%) rename cookbooks/{chef_nginx => nginx}/README.md (80%) rename cookbooks/{chef_nginx => nginx}/attributes/auth_request.rb (97%) rename cookbooks/{chef_nginx => nginx}/attributes/default.rb (90%) rename cookbooks/{chef_nginx => nginx}/attributes/devel.rb (97%) rename cookbooks/{chef_nginx => nginx}/attributes/echo.rb (81%) rename cookbooks/{chef_nginx => nginx}/attributes/geoip.rb (98%) rename cookbooks/{chef_nginx => nginx}/attributes/headers_more.rb (97%) rename cookbooks/{chef_nginx => nginx}/attributes/lua.rb (86%) rename cookbooks/{chef_nginx => nginx}/attributes/naxsi.rb (97%) rename cookbooks/{chef_nginx => nginx}/attributes/openssl_source.rb (97%) rename cookbooks/{chef_nginx => nginx}/attributes/pagespeed.rb (95%) rename cookbooks/{chef_nginx => nginx}/attributes/passenger.rb (75%) rename cookbooks/{chef_nginx => nginx}/attributes/rate_limiting.rb (97%) rename cookbooks/{chef_nginx => nginx}/attributes/repo.rb (63%) rename cookbooks/{chef_nginx => nginx}/attributes/set_misc.rb (93%) rename cookbooks/{chef_nginx => nginx}/attributes/socketproxy.rb (95%) rename cookbooks/{chef_nginx => nginx}/attributes/source.rb (85%) rename cookbooks/{chef_nginx => nginx}/attributes/status.rb (96%) rename cookbooks/{chef_nginx => nginx}/attributes/syslog.rb (97%) rename cookbooks/{chef_nginx => nginx}/attributes/upload_progress.rb (97%) rename cookbooks/{chef_nginx/files/default => nginx/files}/mime.types (99%) rename cookbooks/{chef_nginx/files/default => nginx/files}/naxsi_core.rules (100%) rename cookbooks/{chef_nginx => nginx}/libraries/helpers.rb (90%) rename cookbooks/{chef_nginx => nginx}/libraries/nginx_version.rb (100%) create mode 100644 cookbooks/nginx/metadata.json rename cookbooks/{chef_nginx => nginx}/recipes/authorized_ips.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/commons.rb (84%) rename cookbooks/{chef_nginx => nginx}/recipes/commons_conf.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/commons_dir.rb (93%) rename cookbooks/{chef_nginx => nginx}/recipes/commons_script.rb (92%) rename cookbooks/{chef_nginx => nginx}/recipes/default.rb (81%) rename cookbooks/{chef_nginx => nginx}/recipes/headers_more_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/http_auth_request_module.rb (95%) rename cookbooks/{chef_nginx => nginx}/recipes/http_echo_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/http_geoip_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/http_gzip_static_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/http_mp4_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/http_perl_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/http_realip_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/http_spdy_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/http_ssl_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/http_stub_status_module.rb (95%) rename cookbooks/{chef_nginx => nginx}/recipes/http_v2_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/ipv6.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/lua.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/naxsi_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/ngx_devel_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/ngx_lua_module.rb (94%) rename cookbooks/{chef_nginx => nginx}/recipes/ohai_plugin.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/openssl_source.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/package.rb (80%) rename cookbooks/{chef_nginx => nginx}/recipes/pagespeed_module.rb (95%) rename cookbooks/{chef_nginx => nginx}/recipes/passenger.rb (96%) rename cookbooks/{chef_nginx => nginx}/recipes/repo.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/repo_passenger.rb (96%) rename cookbooks/{chef_nginx => nginx}/recipes/set_misc.rb (95%) rename cookbooks/{chef_nginx => nginx}/recipes/socketproxy.rb (94%) rename cookbooks/{chef_nginx => nginx}/recipes/source.rb (90%) rename cookbooks/{chef_nginx => nginx}/recipes/syslog_module.rb (100%) rename cookbooks/{chef_nginx => nginx}/recipes/upload_progress_module.rb (100%) create mode 100644 cookbooks/nginx/resources/cleanup_runit.rb rename cookbooks/{chef_nginx => nginx}/resources/site.rb (85%) create mode 100644 cookbooks/nginx/resources/stream.rb rename cookbooks/{chef_nginx => nginx}/templates/debian/nginx.init.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/default-site.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/modules/authorized_ip.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/modules/http_geoip.conf.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/modules/http_gzip_static.conf.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/modules/http_realip.conf.erb (72%) rename cookbooks/{chef_nginx => nginx}/templates/default/modules/nginx_status.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/modules/passenger.conf.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/modules/socketproxy.conf.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/modules/upload_progress.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/nginx-upstart.conf.erb (91%) rename cookbooks/{chef_nginx => nginx}/templates/default/nginx.conf.erb (83%) rename cookbooks/{chef_nginx => nginx}/templates/default/nginx.init.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/nginx.service.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/nginx.sysconfig.erb (50%) rename cookbooks/{chef_nginx => nginx}/templates/default/nxdissite.erb (100%) create mode 100644 cookbooks/nginx/templates/default/nxdisstream.erb rename cookbooks/{chef_nginx => nginx}/templates/default/nxensite.erb (100%) create mode 100644 cookbooks/nginx/templates/default/nxenstream.erb rename cookbooks/{chef_nginx => nginx}/templates/default/plugins/ohai-nginx.rb.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/sv-nginx-log-run.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/default/sv-nginx-run.erb (100%) rename cookbooks/{chef_nginx => nginx}/templates/ubuntu/nginx.init.erb (100%) delete mode 100644 cookbooks/tar/.foodcritic delete mode 100644 cookbooks/tar/MAINTAINERS.md delete mode 100644 cookbooks/tar/libraries/matchers.rb delete mode 100644 cookbooks/zypper/CHANGELOG.md delete mode 100644 cookbooks/zypper/README.md delete mode 100644 cookbooks/zypper/attributes/default.rb delete mode 100644 cookbooks/zypper/libraries/matchers.rb delete mode 100644 cookbooks/zypper/metadata.json delete mode 100644 cookbooks/zypper/providers/repo.rb delete mode 100644 cookbooks/zypper/recipes/default.rb delete mode 100644 cookbooks/zypper/recipes/smt_client.rb delete mode 100644 cookbooks/zypper/resources/repo.rb diff --git a/Berksfile b/Berksfile index c2b5428..7f1aa74 100644 --- a/Berksfile +++ b/Berksfile @@ -4,7 +4,7 @@ source 'https://supermarket.chef.io' cookbook 'mediawiki', git: 'https://github.com/67P/mediawiki-cookbook.git', - ref: 'd96a886e554e338e982e82c2502701d8e40fa55d' + ref: 'f8d0f6b19af4381fdc390aaa32c51a54bd73afdc' cookbook 'wordpress', git: 'https://github.com/67P/wordpress-cookbook.git', ref: 'relax_dependencies' @@ -31,7 +31,7 @@ cookbook 'users', '~> 5.3.1' cookbook 'sudo', '~> 5.3.3' cookbook 'hostname', '= 0.4.2' cookbook 'firewall', '~> 2.6.3' -cookbook 'chef_nginx', '= 6.1.1' +cookbook 'nginx', '= 9.0.0' cookbook 'build-essential', '~> 8.1.1' cookbook 'mysql', '= 6.1.3' cookbook 'postgresql', '= 6.1.1' diff --git a/Berksfile.lock b/Berksfile.lock index 42435fe..4ddbc5d 100644 --- a/Berksfile.lock +++ b/Berksfile.lock @@ -9,7 +9,6 @@ DEPENDENCIES build-essential (~> 8.1.1) chef-sugar (= 3.3.0) chef_client_updater (= 1.1.1) - chef_nginx (= 6.1.1) compat_resource (= 12.19.0) composer (~> 2.6.1) database (= 6.1.1) @@ -28,11 +27,12 @@ DEPENDENCIES mariadb (= 0.3.1) mediawiki git: https://github.com/67P/mediawiki-cookbook.git - revision: d96a886e554e338e982e82c2502701d8e40fa55d - ref: d96a886 + revision: f8d0f6b19af4381fdc390aaa32c51a54bd73afdc + ref: f8d0f6b mingw (= 2.0.0) mysql (= 6.1.3) mysql2_chef_gem (= 1.1.0) + nginx (= 9.0.0) nodejs (~> 5.0.0) ntp (= 3.4.0) ohai (= 5.0.4) @@ -58,7 +58,7 @@ DEPENDENCIES windows (= 3.1.1) wordpress git: https://github.com/67P/wordpress-cookbook.git - revision: a80b8a17fb823a01b769f690349d745c40fff04c + revision: 593ad2c7957fc427da739510de59f36ad648ee5e ref: relax_d yum (= 3.13.0) yum-epel (= 0.3.6) @@ -94,12 +94,6 @@ GRAPH chef-sugar (3.3.0) chef_client_updater (1.1.1) compat_resource (>= 12.16.3) - chef_nginx (6.1.1) - build-essential (>= 0.0.0) - compat_resource (>= 12.16.3) - ohai (>= 4.1.0) - yum-epel (>= 0.0.0) - zypper (>= 0.0.0) compat_resource (12.19.0) composer (2.6.1) apt (>= 0.0.0) @@ -129,10 +123,10 @@ GRAPH yum-epel (>= 0.0.0) mediawiki (0.3.0) apache2 (>= 0.0.0) - chef_nginx (>= 0.0.0) database (>= 0.0.0) mysql (>= 0.0.0) mysql2_chef_gem (>= 0.0.0) + nginx (>= 0.0.0) php (>= 0.0.0) php-fpm (>= 0.0.0) mingw (2.0.0) @@ -144,6 +138,10 @@ GRAPH build-essential (>= 0.0.0) mariadb (>= 0.0.0) mysql (>= 6.0) + nginx (9.0.0) + build-essential (>= 5.0) + ohai (>= 4.1.0) + yum-epel (>= 0.0.0) nodejs (5.0.0) ark (>= 2.0.2) build-essential (>= 0.0.0) @@ -196,7 +194,7 @@ GRAPH smf (2.2.8) rbac (>= 1.0.1) sudo (5.3.3) - tar (2.1.1) + tar (2.2.0) timezone_iii (1.0.4) users (5.3.1) windows (3.1.1) @@ -204,11 +202,11 @@ GRAPH wordpress (3.1.0) apache2 (>= 2.0.0) build-essential (>= 0.0.0) - chef_nginx (>= 0.0.0) database (>= 1.6.0) iis (>= 1.6.2) mysql (>= 6.0) mysql2_chef_gem (>= 1.0.1) + nginx (>= 0.0.0) openssl (>= 0.0.0) php (>= 0.0.0) php-fpm (>= 0.0.0) @@ -221,4 +219,3 @@ GRAPH yum (~> 3.0) yum-mysql-community (2.1.0) compat_resource (>= 12.16.3) - zypper (0.4.0) diff --git a/cookbooks/chef_nginx/.foodcritic b/cookbooks/chef_nginx/.foodcritic deleted file mode 100644 index b9f8767..0000000 --- a/cookbooks/chef_nginx/.foodcritic +++ /dev/null @@ -1 +0,0 @@ -~FC016 diff --git a/cookbooks/chef_nginx/MAINTAINERS.md b/cookbooks/chef_nginx/MAINTAINERS.md deleted file mode 100644 index 645ed14..0000000 --- a/cookbooks/chef_nginx/MAINTAINERS.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# Maintainers - -This file lists how this cookbook project is maintained. When making changes to the system, this file tells you who needs to review your patch - you need a review from an existing maintainer for the cookbook to provide a :+1: on your pull request. Additionally, you need to not receive a veto from a Lieutenant or the Project Lead. - -Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) for details on the process and how to become a maintainer or the project lead. - -# Project Maintainer -* [Tim Smith](https://github.com/tas50) - -# Maintainers -* [Jennifer Davis](https://github.com/sigje) -* [Tim Smith](https://github.com/tas50) -* [Thom May](https://github.com/thommay) diff --git a/cookbooks/chef_nginx/libraries/matchers.rb b/cookbooks/chef_nginx/libraries/matchers.rb deleted file mode 100644 index 1a6acc4..0000000 --- a/cookbooks/chef_nginx/libraries/matchers.rb +++ /dev/null @@ -1,35 +0,0 @@ -# -# Cookbook:: chef_nginx -# Library:: matchers -# -# Author:: Tim Smith () -# -# Copyright:: 2016-2017, Chef Software, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -if defined?(ChefSpec) - ############# - # nginx_site - ############# - ChefSpec.define_matcher :nginx_site - - def enable_nginx_site(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:nginx_site, :enable, resource_name) - end - - def disable_nginx_site(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:nginx_site, :disable, resource_name) - end -end diff --git a/cookbooks/chef_nginx/metadata.json b/cookbooks/chef_nginx/metadata.json deleted file mode 100644 index 3a4fe56..0000000 --- a/cookbooks/chef_nginx/metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"chef_nginx","version":"6.1.1","description":"Installs and configures nginx","long_description":"# nginx Cookbook\n\n[![Cookbook](http://img.shields.io/cookbook/v/chef_nginx.svg)](https://supermarket.chef.io/cookbooks/chef_nginx) [![Build Status](https://travis-ci.org/chef-cookbooks/chef_nginx.svg?branch=master)](https://travis-ci.org/chef-cookbooks/chef_nginx)\n\nInstalls nginx from package OR source code and sets up configuration handling similar to Debian's Apache2 scripts.\n\n## nginx vs. chef_nginx\n\nThis cookbook is a fork from the 2.7.x branch of the [community nginx cookbook](https://github.com/miketheman/nginx).\n\nThis fork will be actively supported by Chef Software and we will continue to migrate the cookbook to a more resource driven model, with incremental changes following the SemVer model.\n\n## Requirements\n\n### Cookbooks\n\nThe following cookbooks are direct dependencies because they're used for common \"default\" functionality.\n\n- `build-essential` for source installations\n- `ohai` for setting up the ohai plugin\n- `compat_resource` for setting up the nginx.org repository on Chef 12.1 - 12.13\n- `yum-epel` for setting up the EPEL repository on RHEL platforms\n- `zypper` for setting up the nginx.org repository on Suse platforms\n\n### Platforms\n\nThe following platforms are supported and tested with Test Kitchen:\n\n- Ubuntu 14.04+\n- CentOS 6+\n- Debian 7+\n- openSUSE\n- FreeBSD\n\nOther Debian and RHEL family distributions are assumed to work.\n\n### Chef\n\n- Chef 12.1+\n\n## Attributes\n\nNode attributes for this cookbook are logically separated into different files. Some attributes are set only via a specific recipe.\n\n### chef_nginx::auth_request\n\nThese attributes are used in the `chef_nginx::auth_request` recipe.\n\n- `node['nginx']['auth_request']['url']` - The url to the auth_request module tar.gz file\n- `node['nginx']['auth_request']['checksum']` - The checksum of the auth_request module tar.gz file\n\n### chef_nginx::default\n\nGenerally used attributes. Some have platform specific values. See `attributes/default.rb`. \"The Config\" refers to \"nginx.conf\" the main config file.\n\n- `node['nginx']['dir']` - Location for nginx configuration.\n- `node['nginx']['conf_template']` - The `source` template to use when creating the `nginx.conf`.\n- `node['nginx']['conf_cookbook']` - The cookbook where `node['nginx']['conf_template']` resides.\n- `node['nginx']['log_dir']` - Location for nginx logs.\n- `node['nginx']['log_dir_perm']` - Permissions for nginx logs folder.\n- `node['nginx']['user']` - User that nginx will run as.\n- `node['nginx']['group']` - Group for nginx.\n- `node['nginx']['port']` - Port for nginx to listen on.\n- `node['nginx']['binary']` - Path to the nginx binary.\n- `node['nginx']['init_style']` - How to run nginx as a service when using `chef_nginx::source`. Values can be \"upstart\", \"systemd\", or \"init\". This attribute is not used in the `package` recipe because the package manager's init script style for the platform is assumed.\n- `node['nginx']['upstart']['foreground']` - Set this to true if you want upstart to run nginx in the foreground, set to false if you want upstart to detach and track the process via pid.\n- `node['nginx']['upstart']['runlevels']` - String of runlevels in the format '2345' which determines which runlevels nginx will start at when entering and stop at when leaving.\n- `node['nginx']['upstart']['respawn_limit']` - Respawn limit in upstart stanza format, count followed by space followed by interval in seconds.\n- `node['nginx']['keepalive']` - Whether to use `keepalive_timeout`, any value besides \"on\" will leave that option out of the config.\n- `node['nginx']['keepalive_requests']` - used for config value of `keepalive_requests`.\n- `node['nginx']['keepalive_timeout']` - used for config value of `keepalive_timeout`.\n- `node['nginx']['worker_processes']` - used for config value of `worker_processes`.\n- `node['nginx']['worker_connections']` - used for config value of `events { worker_connections }`\n- `node['nginx']['worker_rlimit_nofile']` - used for config value of `worker_rlimit_nofile`. Can replace any \"ulimit -n\" command. The value depend on your usage (cache or not) but must always be superior than worker_connections.\n- `node['nginx']['worker_shutdown_timeout']` - used for config value of `worker_shutdown_timeout`.\n- `node['nginx']['worker_connections']` - used for config value of `events { worker_connections }`\n- `node['nginx']['multi_accept']` - used for config value of `events { multi_accept }`. Try to accept() as many connections as possible. Disable by default.\n- `node['nginx']['event']` - used for config value of `events { use }`. Set the event-model. By default nginx looks for the most suitable method for your OS.\n- `node['nginx']['accept_mutex_delay']` - used for config value of `accept_mutex_delay`\n- `node['nginx']['server_tokens']` - used for config value of `server_tokens`.\n- `node['nginx']['server_names_hash_bucket_size']` - used for config value of `server_names_hash_bucket_size`.\n- `node['nginx']['disable_access_log']` - set to true to disable the general access log, may be useful on high traffic sites.\n- `node['nginx']['access_log_options']` - Set to a string of additional options to be appended to the access log directive\n- `node['nginx']['error_log_options']` - Set to a string of additional options to be appended to the error log directive\n- `node['nginx']['default_site_enabled']` - enable the default site\n- `node['nginx']['sendfile']` - Whether to use `sendfile`. Defaults to \"on\".\n- `node['nginx']['tcp_nopush']` - Whether to use `tcp_nopush`. Defaults to \"on\".\n- `node['nginx']['tcp_nodelay']` - Whether to use `tcp_nodelay`. Defaults to \"on\".\n- `node['nginx']['install_method']` - Whether nginx is installed from packages or from source.\n- `node['nginx']['types_hash_max_size']` - Used for the `types_hash_max_size` configuration directive.\n- `node['nginx']['types_hash_bucket_size']` - Used for the `types_hash_bucket_size` configuration directive.\n- `node['nginx']['proxy_read_timeout']` - defines a timeout (between two successive read operations) for reading a response from the proxied server.\n- `node['nginx']['client_body_buffer_size']` - used for config value of `client_body_buffer_size`.\n- `node['nginx']['client_max_body_size']` - specifies the maximum accepted body size of a client request, as indicated by the request header Content-Length.\n- `node['nginx']['repo_source']` - when installed from a package this attribute affects which yum repositories, if any, will be added before installing the nginx package. The default value of 'epel' will use the `yum-epel` cookbook, 'nginx' will use the `chef_nginx::repo` recipe, 'passenger' will use the 'chef_nginx::repo_passenger' recipe, and setting no value will not add any additional repositories.\n- `node['nginx']['sts_max_age']` - Enable Strict Transport Security for all apps (See: ). This attribute adds the following header: Strict-Transport-Security max-age=SECONDS to all incoming requests and takes an integer (in seconds) as its argument.\n- `node['nginx']['default']['modules']` - Array specifying which modules to enable via the conf-enabled config include function. Currently the only valid value is \"socketproxy\".\n- `node['nginx']['load_modules']` - Array of paths to modules to dynamically load on nginx startup using the `load_module` directive. Default is `[]`.\n\n#### authorized_ips module\n\n- `node['nginx']['remote_ip_var']` - The remote ip variable name to use.\n- `node['nginx']['authorized_ips']` - IPs authorized by the module\n\n#### gzip module\n\n- `node['nginx']['gzip']` - Whether to use gzip, can be \"on\" or \"off\"\n- `node['nginx']['gzip_http_version']` - used for config value of `gzip_http_version`.\n- `node['nginx']['gzip_comp_level']` - used for config value of `gzip_comp_level`.\n- `node['nginx']['gzip_proxied']` - used for config value of `gzip_proxied`.\n- `node['nginx']['gzip_vary']` - used for config value of `gzip_vary`.\n- `node['nginx']['gzip_buffers']` - used for config value of `gzip_buffers`.\n- `node['nginx']['gzip_types']` - used for config value of `gzip_types` - must be an Array.\n- `node['nginx']['gzip_min_length']` - used for config value of `gzip_min_length`.\n- `node['nginx']['gzip_disable']` - used for config value of `gzip_disable`.\n- `node['nginx']['gzip_static']` - used for config value of `gzip_static` (`http_gzip_static_module` must be enabled)\n\n#### Other configurations\n\n- `node['nginx']['extra_configs']` - a Hash of key/values to nginx configuration.\n\n### chef_nginx::devel\n\nThese attributes are used in the `chef_nginx::ngx_devel_module` recipe.\n\n- `node['nginx']['devel']['version']` - The version of the nginx devel module\n- `node['nginx']['devel']['url']` - The URL of the nginx devel module tar.gz file\n- `node['nginx']['devel']['checksum']` - The checksum of the nginx devel module tar.gz file\n\n### chef_nginx::echo\n\nThese attributes are used in the `chef_nginx::http_echo_module` recipe.\n\n- `node['nginx']['echo']['version']` - The version of `http_echo` you want (default: 0.59)\n- `node['nginx']['echo']['url']` - URL for the tarball.\n- `node['nginx']['echo']['checksum']` - Checksum of the tarball.\n\n### chef_nginx::geoip\n\nThese attributes are used in the `chef_nginx::http_geoip_module` recipe. Please note that the `country_dat_checksum` and `city_dat_checksum` are based on downloads from a datacenter in Fremont, CA, USA. You really should override these with checksums for the geo tarballs from your node location.\n\n**Note** The upstream, maxmind.com, may block access for repeated downloads of the data files. It is recommended that you download and host the data files, and change the URLs in the attributes.\n\n- `node['nginx']['geoip']['path']` - Location where to install the geoip libraries.\n- `node['nginx']['geoip']['enable_city']` - Whether to enable City data\n- `node['nginx']['geoip']['country_dat_url']` - Country data tarball URL\n- `node['nginx']['geoip']['country_dat_checksum']` - Country data tarball checksum\n- `node['nginx']['geoip']['city_dat_url']` - City data tarball URL\n- `node['nginx']['geoip']['city_dat_checksum']` - City data tarball checksum\n- `node['nginx']['geoip']['lib_version']` - Version of the GeoIP library to install\n- `node['nginx']['geoip']['lib_url']` - (Versioned) Tarball URL of the GeoIP library\n- `node['nginx']['geoip']['lib_checksum']` - Checksum of the GeoIP library tarball\n\n### chef_nginx::http_realip_module\n\nFrom: \n\n- `node['nginx']['realip']['header']` - Header to use for the RealIp Module; only accepts \"X-Forwarded-For\" or \"X-Real-IP\"\n- `node['nginx']['realip']['addresses']` - Addresses to use for the `http_realip` configuration.\n- `node['nginx']['realip']['real_ip_recursive']` - If recursive search is enabled, the original client address that matches one of the trusted addresses is replaced by the last non-trusted address sent in the request header field. Can be on \"on\" or \"off\" (default).\n\n### chef_nginx::openssl_source\n\nThese attributes are used in the `chef_nginx::openssl_source` recipe.\n\n- `node['nginx']['openssl_source']['version']` - The version of OpenSSL you want to download and use (default: 1.0.1t)\n- `node['nginx']['openssl_source']['url']` - The url for the OpenSSL source\n\n### chef_nginx::passenger\n\nThese attributes are used in the `chef_nginx::passenger` recipe.\n\n- `node['nginx']['passenger']['version']` - passenger gem version\n- `node['nginx']['passenger']['root']` - passenger gem root path\n- `node['nginx']['passenger']['install_rake']` - set to false if rake already present on system\n- `node['nginx']['passenger']['max_pool_size']` - maximum passenger pool size (default=10)\n- `node['nginx']['passenger']['ruby']` - Ruby path for Passenger to use (default=`$(which ruby)`)\n- `node['nginx']['passenger']['spawn_method']` - passenger spawn method to use (default=`smart-lv2`)\n- `node['nginx']['passenger']['buffer_response']` - turns on or off response buffering (default=`on`)\n- `node['nginx']['passenger']['max_pool_size']` - passenger maximum pool size (default=`6`)\n- `node['nginx']['passenger']['min_instances']` - minimum instances (default=`1`)\n- `node['nginx']['passenger']['max_instances_per_app']` - maximum instances per app (default=`0`)\n- `node['nginx']['passenger']['pool_idle_time']` - passenger pool idle time (default=`300`)\n- `node['nginx']['passenger']['max_requests']` - maximum requests (default=`0`)\n- `node['nginx']['passenger']['nodejs']` - Nodejs path for Passenger to use (default=nil)\n- `node['nginx']['passenger']['show_version_in_header']` - Show passenger version in HTTP headers (default=`on`)\n\nBasic configuration to use the official Phusion Passenger repositories:\n\n- `node['nginx']['repo_source']` - 'passenger'\n- `node['nginx']['package_name']` - 'nginx-extras'\n- `node['nginx']['passenger']['install_method']` - 'package'\n\n### chef_nginx::rate_limiting\n\n- `node['nginx']['enable_rate_limiting']` - set to true to enable rate limiting (`limit_req_zone` in nginx.conf)\n- `node['nginx']['rate_limiting_zone_name']` - sets the zone in `limit_req_zone`.\n- `node['nginx']['rate_limiting_backoff']` - sets the backoff time for `limit_req_zone`.\n- `node['nginx']['rate_limit']` - set the rate limit amount for `limit_req_zone`.\n\n### chef_nginx::repo\n\n- `node['nginx']['upstream_repository']` - the URL to use for the package repository resource; default is set based on platform type\n- `node['nginx']['repo_signing_key']` - The URL from which package signing/gpg key is retrieved\n\n### chef_nginx::socketproxy\n\nThese attributes are used in the `chef_nginx::socketproxy` recipe.\n\n- `node['nginx']['socketproxy']['root']` - The directory (on your server) where socketproxy apps are deployed.\n- `node['nginx']['socketproxy']['default_app']` - Static assets directory for requests to \"/\" that don't meet any proxy_pass filter requirements.\n- `node['nginx']['socketproxy']['apps']['app_name']['prepend_slash']` - Prepend a slash to requests to app \"app_name\" before sending them to the socketproxy socket.\n- `node['nginx']['socketproxy']['apps']['app_name']['context_name']` - URI (e.g. \"app_name\" in order to achieve \"\") at which to host the application \"app_name\"\n- `node['nginx']['socketproxy']['apps']['app_name']['subdir']` - Directory (under `node['nginx']['socketproxy']['root']`) in which to find the application.\n\n### chef_nginx::source\n\nThese attributes are used in the `chef_nginx::source` recipe. Some of them are dynamically modified during the run. See `attributes/source.rb` for default values.\n\n- `node['nginx']['source']['url']` - (versioned) URL for the nginx source code. By default this will use the version specified as `node['nginx']['version']`.\n- `node['nginx']['source']['prefix']` - (versioned) prefix for installing nginx from source\n- `node['nginx']['source']['conf_path']` - location of the main config file, in `node['nginx']['dir']` by default.\n- `node['nginx']['source']['modules']` - Array of modules that should be compiled into nginx by including their recipes in `chef_nginx::source`.\n- `node['nginx']['source']['default_configure_flags']` - The default flags passed to the configure script when building nginx.\n- `node['nginx']['configure_flags']` - Preserved for compatibility and dynamically generated from the `node['nginx']['source']['default_configure_flags']` in the `chef_nginx::source` recipe.\n- `node['nginx']['source']['use_existing_user']` - set to `true` if you do not want `chef_nginx::source` recipe to create system user with name `node['nginx']['user']`.\n\n### chef_nginx::status\n\nThese attributes are used in the `chef_nginx::http_stub_status_module` recipe.\n\n- `node['nginx']['status']['port']` - The port on which nginx will serve the status info (default: 8090)\n\n### chef_nginx::syslog\n\nThese attributes are used in the `chef_nginx::syslog_module` recipe.\n\n- `node['nginx']['syslog']['git_repo']` - The git repository url to use for the syslog patches.\n- `node['nginx']['syslog']['git_revision']` - The revision on the git repository to checkout.\n\n### chef_nginx::upload_progress\n\nThese attributes are used in the `chef_nginx::upload_progress_module` recipe.\n\n- `node['nginx']['upload_progress']['url']` - URL for the tarball.\n- `node['nginx']['upload_progress']['checksum']` - Checksum of the tarball.\n- `node['nginx']['upload_progress']['javascript_output']` - Output in javascript. Default is `true` for backwards compatibility.\n- `node['nginx']['upload_progress']['zone_name']` - Zone name which will be used to store the per-connection tracking information. Default is `proxied`.\n- `node['nginx']['upload_progress']['zone_size']` - Zone size in bytes. Default is `1m` (1 megabyte).\n\n## Resources\n\n### nginx_site\n\nEnable or disable a Server Block in `#{node['nginx']['dir']}/sites-available` by calling nxensite or nxdissite (introduced by this cookbook) to manage the symbolic link in `#{node['nginx']['dir']}/sites-enabled`.\n\n### Actions\n\n- `enable` - Enable the nginx site (default)\n- `disable` - Disable the nginx site\n\n### Properties:\n\n- `name` - (optional) Name of the site to enable. By default it's assumed that the name of the nginx_site resource is the site name, but this allows overriding that.\n- `template` - (optional) Path to the source for the `template` resource.\n- `variables` - (optional) Variables to be used with the `template` resource\n\n## Ohai Plugin\n\nThe `ohai_plugin` recipe includes an Ohai plugin. It will be automatically installed and activated, providing the following attributes via ohai, no matter how nginx is installed (source or package):\n\n- `node['nginx']['version']` - version of nginx\n- `node['nginx']['configure_arguments']` - options passed to `./configure` when nginx was built\n- `node['nginx']['prefix']` - installation prefix\n- `node['nginx']['conf_path']` - configuration file path\n\nIn the source recipe, it is used to determine whether control attributes for building nginx have changed.\n\n## Usage\n\nThis cookbook provides three distinct installation methods, all of which are controlled via attributes and executed using the chef_nginx::default recipe.\n\n### Package installation using the nginx.org repositories\n\nNginx provides repositories for RHEL, Debian/Ubuntu, and Suse platforms with up to date packages available on older distributions. Due to the age of many nginx packages shipping with distros we believe this is the ideal installation method. With no attributes set the nginx.org repositories will be added to your system and nginx will be installed via package. This provides a solid out of the box install for most users.\n\n### Package installation using distro repositories\n\nIf you prefer to use the packages included in your distro or to roll your own packages you'll want to set `node['nginx']['repo_source']` to `nil` or `distro` to skip the repository setup. The default recipe will still install nginx from packages, but you'll retain control over the package location.\n\n### Source installation to compile non-dynamic modules\n\nIf you need control over how nginx is built, or you need non-dynamic modules to be included you'll need to compile nginx from source. We highly recommend against using this method as it requires the installation of a full compilation toolchain and development dependencies on your nodes. Creating your own packages with nginx compiled as necessary is a preferred option. If that's not possible you can set `node['nginx']['install_method']` to `source` and provide a version in `node['nginx']['version']`.\n\n#### Specifying Modules to compile\n\nThe following recipes are used to build module support into nginx. To compile a module, add its recipe name to the array attribute `node['nginx']['source']['modules']`.\n\n- `ipv6.rb` - enables IPv6 support\n- `headers_more_module` -\n- `http_auth_request_module``\n- `http_echo_module.rb` - downloads the `http_echo_module` module and enables it as a module when compiling nginx.\n- `http_geoip_module.rb` - installs the GeoIP libraries and data files and enables the module for compilation.\n- `http_gzip_static_module.rb` - enables the module for compilation. Be sure to set `node['nginx']['gzip_static'] = 'yes'`.\n- `http_mp4_module` -\n- `http_perl_module.rb` - enables embedded Perl for compilation.\n- `http_realip_module.rb` - enables the module for compilation and creates the configuration.\n- `http_spdy_module` -\n- `http_ssl_module.rb` - enables SSL for compilation.\n- `http_stub_status_module.rb` - provides `nginx_status` configuration and enables the module for compilation.\n- `http_v2_module`\n- `ipv6` -\n- `naxsi_module` - enables the naxsi module for the web application firewall for nginx.\n- `ngx_devel_module` -\n- `ngx_lua_module` -\n- `openssl_source.rb` - downloads and uses custom OpenSSL source when compiling nginx\n- `pagespeed_module`-\n- `passenger` - builds the passenger gem and configuration for \"`mod_passenger`\".\n- `set_misc` -\n- `syslog_module` - enables syslog support for nginx. This only works with source builds. See -\n- `upload_progress_module.rb` - builds the `upload_progress` module and enables it as a module when compiling nginx.\n\n## Resources\n\n### nginx_site\n\nEnable or disable a Server Block in `#{node['nginx']['dir']}/sites-available` by calling nxensite or nxdissite (introduced by this cookbook) to manage the symbolic link in `#{node['nginx']['dir']}/sites-enabled`.\n\n### Actions\n\n- `enable` - Enable the nginx site (default)\n- `disable` - Disable the nginx site\n\n### Properties:\n\n- `name` - (optional) Name of the site to enable. By default it's assumed that the name of the nginx_site resource is the site name, but this allows overriding that.\n- `template` - (optional) Path to the source for the `template` resource.\n- `cookbook` - (optional) The cookbook that contains the template source.\n- `variables` - (optional) Variables to be used with the `template` resource\n\n## Adding New Modules\n\nPreviously we'd add each possible module to this cookbook itself. That's not necessary using wrapper cookbooks and we'd prefer to not add any addition module recipes at this time. Instead in your nginx wrapper cookbook setup any necessary packages and then include the follow code to add the module to the list of modules to compile:\n\n```ruby\nnode.run_state['nginx_configure_flags'] =\n node.run_state['nginx_configure_flags'] | ['--with-SOMETHING', \"--with-SOME_OPT='things'\"]\n```\n\n## License & Authors\n\n- Author:: Joshua Timberman ([joshua@chef.io](mailto:joshua@chef.io))\n- Author:: Adam Jacob ([adam@chef.io](mailto:adam@chef.io))\n- Author:: AJ Christensen ([aj@chef.io](mailto:aj@chef.io))\n- Author:: Jamie Winsor ([jamie@vialstudios.com](mailto:jamie@vialstudios.com))\n- Author:: Mike Fiedler ([miketheman@gmail.com](mailto:miketheman@gmail.com))\n\n```text\nCopyright 2008-2016, Chef Software, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"amazon":">= 0.0.0","centos":">= 0.0.0","debian":">= 0.0.0","fedora":">= 0.0.0","oracle":">= 0.0.0","redhat":">= 0.0.0","scientific":">= 0.0.0","ubuntu":">= 0.0.0","suse":">= 0.0.0","opensuse":">= 0.0.0","opensuseleap":">= 0.0.0"},"dependencies":{"build-essential":">= 0.0.0","ohai":">= 4.1.0","yum-epel":">= 0.0.0","compat_resource":">= 12.16.3","zypper":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{"chef_nginx":"Installs nginx package and sets up configuration with Debian apache style with sites-enabled/sites-available","chef_nginx::source":"Installs nginx from source and sets up configuration with Debian apache style with sites-enabled/sites-available"},"source_url":"https://github.com/chef-cookbooks/chef_nginx","issues_url":"https://github.com/chef-cookbooks/chef_nginx/issues","chef_version":[[">= 12.1"]],"ohai_version":[]} \ No newline at end of file diff --git a/cookbooks/mediawiki/metadata.json b/cookbooks/mediawiki/metadata.json index c5923ce..50110b8 100644 --- a/cookbooks/mediawiki/metadata.json +++ b/cookbooks/mediawiki/metadata.json @@ -14,7 +14,7 @@ "php": ">= 0.0.0", "mysql": ">= 0.0.0", "database": ">= 0.0.0", - "chef_nginx": ">= 0.0.0", + "nginx": ">= 0.0.0", "mysql2_chef_gem": ">= 0.0.0", "php-fpm": ">= 0.0.0" }, diff --git a/cookbooks/mediawiki/metadata.rb b/cookbooks/mediawiki/metadata.rb index cafb353..7faebd8 100644 --- a/cookbooks/mediawiki/metadata.rb +++ b/cookbooks/mediawiki/metadata.rb @@ -9,7 +9,7 @@ depends 'apache2' depends 'php' depends 'mysql' depends 'database' -depends 'chef_nginx' +depends 'nginx' depends 'mysql2_chef_gem' depends 'php-fpm' diff --git a/cookbooks/mediawiki/recipes/database.rb b/cookbooks/mediawiki/recipes/database.rb index 382d65c..05e9780 100644 --- a/cookbooks/mediawiki/recipes/database.rb +++ b/cookbooks/mediawiki/recipes/database.rb @@ -64,5 +64,6 @@ mysql_database_user db["user"] do connection mysql_connection_info database_name db["name"] privileges [:all] + password db["pass"] action :grant end diff --git a/cookbooks/mediawiki/recipes/default.rb b/cookbooks/mediawiki/recipes/default.rb index bb8d8f2..fbd63a3 100644 --- a/cookbooks/mediawiki/recipes/default.rb +++ b/cookbooks/mediawiki/recipes/default.rb @@ -63,9 +63,9 @@ bash "configure_mediawiki_database" do cwd node["mediawiki"]["webdir"] code "php maintenance/install.php" + " --pass '" + node["mediawiki"]["admin_password"] + - "' --dbserver 'localhost:/run/mysql-default/mysqld.sock" + "' --dbname '" + node["mediawiki"]["db"]["name"] + "' --dbuser '" + node["mediawiki"]["db"]["user"] + + "' --dbpass '" + node["mediawiki"]["db"]["pass"] + "' --server '" + node["mediawiki"]["server"] + "' --scriptpath '" + node["mediawiki"]["scriptpath"] + "' --lang '" + node["mediawiki"]["language_code"] + diff --git a/cookbooks/mediawiki/recipes/nginx.rb b/cookbooks/mediawiki/recipes/nginx.rb index 47bf189..22ff455 100644 --- a/cookbooks/mediawiki/recipes/nginx.rb +++ b/cookbooks/mediawiki/recipes/nginx.rb @@ -25,7 +25,7 @@ php_fpm_pool "mediawiki" do end include_recipe "php::module_mysql" -include_recipe "chef_nginx" +include_recipe "nginx" directory node["mediawiki"]["docroot_dir"] do user node['nginx']['user'] diff --git a/cookbooks/chef_nginx/CHANGELOG.md b/cookbooks/nginx/CHANGELOG.md similarity index 88% rename from cookbooks/chef_nginx/CHANGELOG.md rename to cookbooks/nginx/CHANGELOG.md index 3987735..900fa7c 100644 --- a/cookbooks/chef_nginx/CHANGELOG.md +++ b/cookbooks/nginx/CHANGELOG.md @@ -2,6 +2,86 @@ This file is used to list changes made in each version of the nginx cookbook. +## 9.0.0 (2018-11-13) + +- This cookbook now requires Chef 13.3 or later, but no longer requires the zypper cookbook. This cookbook was throwing deprecation warnings for users of current Chef 14 releases. + +## 8.1.6 (2018-10-05) + +- passenger: fixed install order +- passenger Ubuntu 18.04 support +- Evaluate ohai_plugin_enabled in the source recipe +- Abstract nginx users home path to attribute + +## 8.1.5 (2018-07-23) + +- Fixes cookbook fails when installing repo passenger because there is no service declaration inline +- Add proxy buffers options + +## 8.1.4 (2018-07-18) + +- Adds the ability to toggle Ohai Plugin +- Use build_essential resource instead of the cookbook so we can use the built in resource on Chef 14+ + +## 8.1.2 (2018-02-26) + +- Add map_hash_max_size as configuration option + +## 8.1.1 (2018-02-26) + +- Use Chef::VersionConstraint in auth request module so we properly compare versions + +## 8.1.0 (2018-02-19) + +- Added a new nginx_stream resource for enabling/disable nginx stream blocks +- Make sure we install zlib for source installs. This gives us compression support and fixes compilation on Debian 9 + +## 8.0.1 (2018-02-16) + +- Update the required Chef release to 12.14 since we're using yum/apt repository resources +- Add a new 'site_name' property to the nginx_site resource. This allows you to specify a site name if it differs from the resource name +- Removed the check for nginx < 1.2 in the realip module + +## 8.0.0 (2018-02-16) + +- Remove ChefSpec matchers since these are autogenerated now +- Remove compat_resource cookbook dependency and require Chef 12.7+ instead +- Expand testing and test on Amazon Linux + +## 7.0.2 (2017-11-22) + +- Fix a bug that led to nginx recompiling when it didn't need to + +## 7.0.1 (2017-11-14) + +- Move passenger test attributes into the cookbook +- Resolve FC108 warning + +## 7.0.0 (2017-09-18) + +### Breaking Changes + +- This release of the nginx cookbook merges all changes that occurred within the chef_nginx fork from 2.8 - 6.2\. This includes multiple breaking changes along with a large number of improvements and bug fixes. If you're upgrading from 2.7 to current make sure to read the whole changelog to make sure you're ready. + +### Other Changes + +- Added a new resource nginx_runit_cleanup has been introduced which stops the existing nginx runit service and removes the init files. This is now called automatically from the default recipe to cleanup an existing installation. This should make it possible for users to migrate from the 2.X release to the current w/o manual steps. +- Fixed compile failures on Fedora and any other distros released in the future which use GCC 7 +- Added the .m3u8 mimetype +- Moved all files out of the files/default directory since this isn't required with Chef 12 and later +- Added ulimit to the nginx sysconfig file for RHEL platforms + +## 6.2.0 (2017-09-12) + +- Install basic configuration before starting the nginx service +- Correct documentation for `rate_limiting_backoff` attribute +- Phusion Passenger distro has pid file location in /run/nginx.pid +- [GH-92] add a test suite for passenger install +- Swap the maintainer files for a readme section +- Update nginx version [1.12.1] and checksum attributes for source installs +- Update versions and checksums for lua-nginx-module and echo-nginx-module +- Simplify repo logic and use HTTPS repos + ## 6.1.1 (2017-06-08) - Use multipackage installs in the pagespeed recipe to speed things up @@ -12,14 +92,13 @@ This file is used to list changes made in each version of the nginx cookbook. - Add attributes for setting the repository URLs - Fix support for Amazon Linux repos on Chef 13+ - ## 6.0.3 (2017-06-05) - Correctly compare nginx versions with multiple digits so 1.10 is properly recognized as coming after 1.2. ## 6.0.2 (2017-04-27) -- Resolve name conflicts in the resource +- Resolve name conflicts in the resource ## 6.0.1 (2017-04-04) @@ -34,7 +113,7 @@ This file is used to list changes made in each version of the nginx cookbook. ### Other changes - Install nginx 1.10.3 for source based installs -- Remove freebsd cookbook from testing as it’s not necessary anymore +- Remove freebsd cookbook from testing as it's not necessary anymore - Bump OpenSSL to 1.0.2k ## 5.1.3 (2017-03-24) @@ -82,13 +161,14 @@ This file is used to list changes made in each version of the nginx cookbook. - Properly disable the default site with nginx.org packages ## 5.0.2 (2016-12-22) + - Requite the latest compat_resource ## 5.0.1 (2016-12-13) - Use multipackage in pagespeed module recipe to speed up installs - Simplify the distro repo setup logic to ensure we're using the correct repos under all conditions. Previously the upstream repo was being missed on Suse systems -- Determine pidfile location correctly via a helper so we correctly set pidfiles when using Upstream packages on Ubuntu 14.04 / 16.04. This involved removing the attribute for the pidfile location, which may cause issues if you relied on that attribute. +- Determine pidfile location correctly via a helper so we correctly set pidfiles when using Upstream packages on Ubuntu 14.04 / 16.04\. This involved removing the attribute for the pidfile location, which may cause issues if you relied on that attribute. - Testing improvements to make sure all suites run and the suites are testing the correct conditions ## 5.0.0 (2016-12-07) @@ -104,12 +184,14 @@ This file is used to list changes made in each version of the nginx cookbook. - Better document how to compile modules ## 4.0.2 (2016-12-01) + - Default to openssl 1.0.2j with source installs - Add cookbook property to the nginx_site resource to allow using templates defined in other cookbooks - Prevent default docroot index.html on bad url in status - Readme improvements ## 4.0.1 (2016-10-31) + - Fix a version check in the realip recipe - Align the config with the default config a bit - Fix the ChefSpec matchers now that nginx_site is a custom resource diff --git a/cookbooks/chef_nginx/CONTRIBUTING.md b/cookbooks/nginx/CONTRIBUTING.md similarity index 100% rename from cookbooks/chef_nginx/CONTRIBUTING.md rename to cookbooks/nginx/CONTRIBUTING.md diff --git a/cookbooks/chef_nginx/README.md b/cookbooks/nginx/README.md similarity index 80% rename from cookbooks/chef_nginx/README.md rename to cookbooks/nginx/README.md index 249f795..2191025 100644 --- a/cookbooks/chef_nginx/README.md +++ b/cookbooks/nginx/README.md @@ -1,15 +1,9 @@ # nginx Cookbook -[![Cookbook](http://img.shields.io/cookbook/v/chef_nginx.svg)](https://supermarket.chef.io/cookbooks/chef_nginx) [![Build Status](https://travis-ci.org/chef-cookbooks/chef_nginx.svg?branch=master)](https://travis-ci.org/chef-cookbooks/chef_nginx) +[![Cookbook](http://img.shields.io/cookbook/v/nginx.svg)](https://supermarket.chef.io/cookbooks/nginx) [![Build Status](https://travis-ci.org/chef-cookbooks/nginx.svg?branch=master)](https://travis-ci.org/chef-cookbooks/nginx) Installs nginx from package OR source code and sets up configuration handling similar to Debian's Apache2 scripts. -## nginx vs. chef_nginx - -This cookbook is a fork from the 2.7.x branch of the [community nginx cookbook](https://github.com/miketheman/nginx). - -This fork will be actively supported by Chef Software and we will continue to migrate the cookbook to a more resource driven model, with incremental changes following the SemVer model. - ## Requirements ### Cookbooks @@ -18,7 +12,6 @@ The following cookbooks are direct dependencies because they're used for common - `build-essential` for source installations - `ohai` for setting up the ohai plugin -- `compat_resource` for setting up the nginx.org repository on Chef 12.1 - 12.13 - `yum-epel` for setting up the EPEL repository on RHEL platforms - `zypper` for setting up the nginx.org repository on Suse platforms @@ -36,20 +29,20 @@ Other Debian and RHEL family distributions are assumed to work. ### Chef -- Chef 12.1+ +- Chef 13.3+ ## Attributes Node attributes for this cookbook are logically separated into different files. Some attributes are set only via a specific recipe. -### chef_nginx::auth_request +### nginx::auth_request -These attributes are used in the `chef_nginx::auth_request` recipe. +These attributes are used in the `nginx::auth_request` recipe. - `node['nginx']['auth_request']['url']` - The url to the auth_request module tar.gz file - `node['nginx']['auth_request']['checksum']` - The checksum of the auth_request module tar.gz file -### chef_nginx::default +### nginx::default Generally used attributes. Some have platform specific values. See `attributes/default.rb`. "The Config" refers to "nginx.conf" the main config file. @@ -59,10 +52,12 @@ Generally used attributes. Some have platform specific values. See `attributes/d - `node['nginx']['log_dir']` - Location for nginx logs. - `node['nginx']['log_dir_perm']` - Permissions for nginx logs folder. - `node['nginx']['user']` - User that nginx will run as. +- `node['nginx']['user_home']` - User home path, used during user creation. - `node['nginx']['group']` - Group for nginx. - `node['nginx']['port']` - Port for nginx to listen on. - `node['nginx']['binary']` - Path to the nginx binary. -- `node['nginx']['init_style']` - How to run nginx as a service when using `chef_nginx::source`. Values can be "upstart", "systemd", or "init". This attribute is not used in the `package` recipe because the package manager's init script style for the platform is assumed. +- `node['nginx']['init_style']` - How to run nginx as a service when using `nginx::source`. Values can be "upstart", "systemd", or "init". This attribute is not used in the `package` recipe because the package manager's init script style for the platform is assumed. +- `node['nginx']['cleanup_runit']` - Cleanup existing runit based nginx service installation. Uses the `nginx_cleanup_runit` resource. Default: true - `node['nginx']['upstart']['foreground']` - Set this to true if you want upstart to run nginx in the foreground, set to false if you want upstart to detach and track the process via pid. - `node['nginx']['upstart']['runlevels']` - String of runlevels in the format '2345' which determines which runlevels nginx will start at when entering and stop at when leaving. - `node['nginx']['upstart']['respawn_limit']` - Respawn limit in upstart stanza format, count followed by space followed by interval in seconds. @@ -92,7 +87,7 @@ Generally used attributes. Some have platform specific values. See `attributes/d - `node['nginx']['proxy_read_timeout']` - defines a timeout (between two successive read operations) for reading a response from the proxied server. - `node['nginx']['client_body_buffer_size']` - used for config value of `client_body_buffer_size`. - `node['nginx']['client_max_body_size']` - specifies the maximum accepted body size of a client request, as indicated by the request header Content-Length. -- `node['nginx']['repo_source']` - when installed from a package this attribute affects which yum repositories, if any, will be added before installing the nginx package. The default value of 'epel' will use the `yum-epel` cookbook, 'nginx' will use the `chef_nginx::repo` recipe, 'passenger' will use the 'chef_nginx::repo_passenger' recipe, and setting no value will not add any additional repositories. +- `node['nginx']['repo_source']` - when installed from a package this attribute affects which yum repositories, if any, will be added before installing the nginx package. The default value of 'epel' will use the `yum-epel` cookbook, 'nginx' will use the `nginx::repo` recipe, 'passenger' will use the 'nginx::repo_passenger' recipe, and setting no value will not add any additional repositories. - `node['nginx']['sts_max_age']` - Enable Strict Transport Security for all apps (See: ). This attribute adds the following header: Strict-Transport-Security max-age=SECONDS to all incoming requests and takes an integer (in seconds) as its argument. - `node['nginx']['default']['modules']` - Array specifying which modules to enable via the conf-enabled config include function. Currently the only valid value is "socketproxy". - `node['nginx']['load_modules']` - Array of paths to modules to dynamically load on nginx startup using the `load_module` directive. Default is `[]`. @@ -119,25 +114,25 @@ Generally used attributes. Some have platform specific values. See `attributes/d - `node['nginx']['extra_configs']` - a Hash of key/values to nginx configuration. -### chef_nginx::devel +### nginx::devel -These attributes are used in the `chef_nginx::ngx_devel_module` recipe. +These attributes are used in the `nginx::ngx_devel_module` recipe. - `node['nginx']['devel']['version']` - The version of the nginx devel module - `node['nginx']['devel']['url']` - The URL of the nginx devel module tar.gz file - `node['nginx']['devel']['checksum']` - The checksum of the nginx devel module tar.gz file -### chef_nginx::echo +### nginx::echo -These attributes are used in the `chef_nginx::http_echo_module` recipe. +These attributes are used in the `nginx::http_echo_module` recipe. - `node['nginx']['echo']['version']` - The version of `http_echo` you want (default: 0.59) - `node['nginx']['echo']['url']` - URL for the tarball. - `node['nginx']['echo']['checksum']` - Checksum of the tarball. -### chef_nginx::geoip +### nginx::geoip -These attributes are used in the `chef_nginx::http_geoip_module` recipe. Please note that the `country_dat_checksum` and `city_dat_checksum` are based on downloads from a datacenter in Fremont, CA, USA. You really should override these with checksums for the geo tarballs from your node location. +These attributes are used in the `nginx::http_geoip_module` recipe. Please note that the `country_dat_checksum` and `city_dat_checksum` are based on downloads from a datacenter in Fremont, CA, USA. You really should override these with checksums for the geo tarballs from your node location. **Note** The upstream, maxmind.com, may block access for repeated downloads of the data files. It is recommended that you download and host the data files, and change the URLs in the attributes. @@ -151,7 +146,7 @@ These attributes are used in the `chef_nginx::http_geoip_module` recipe. Please - `node['nginx']['geoip']['lib_url']` - (Versioned) Tarball URL of the GeoIP library - `node['nginx']['geoip']['lib_checksum']` - Checksum of the GeoIP library tarball -### chef_nginx::http_realip_module +### nginx::http_realip_module From: @@ -159,16 +154,28 @@ From: - `node['nginx']['realip']['addresses']` - Addresses to use for the `http_realip` configuration. - `node['nginx']['realip']['real_ip_recursive']` - If recursive search is enabled, the original client address that matches one of the trusted addresses is replaced by the last non-trusted address sent in the request header field. Can be on "on" or "off" (default). -### chef_nginx::openssl_source +### nginx::ohai_plugin -These attributes are used in the `chef_nginx::openssl_source` recipe. +The `ohai_plugin` recipe includes an Ohai plugin. It will be automatically installed and activated, providing the following attributes via ohai, no matter how nginx is installed (source or package): + +- `node['nginx']['version']` - version of nginx +- `node['nginx']['configure_arguments']` - options passed to `./configure` when nginx was built +- `node['nginx']['prefix']` - installation prefix +- `node['nginx']['conf_path']` - configuration file path +- `node['nginx']['ohai_plugin_enabled']` - Toggles ohai_plugin recipe. Defaults to true. + +In the source recipe, it is used to determine whether control attributes for building nginx have changed. + +### nginx::openssl_source + +These attributes are used in the `nginx::openssl_source` recipe. - `node['nginx']['openssl_source']['version']` - The version of OpenSSL you want to download and use (default: 1.0.1t) - `node['nginx']['openssl_source']['url']` - The url for the OpenSSL source -### chef_nginx::passenger +### nginx::passenger -These attributes are used in the `chef_nginx::passenger` recipe. +These attributes are used in the `nginx::passenger` recipe. - `node['nginx']['passenger']['version']` - passenger gem version - `node['nginx']['passenger']['root']` - passenger gem root path @@ -191,21 +198,21 @@ Basic configuration to use the official Phusion Passenger repositories: - `node['nginx']['package_name']` - 'nginx-extras' - `node['nginx']['passenger']['install_method']` - 'package' -### chef_nginx::rate_limiting +### nginx::rate_limiting - `node['nginx']['enable_rate_limiting']` - set to true to enable rate limiting (`limit_req_zone` in nginx.conf) - `node['nginx']['rate_limiting_zone_name']` - sets the zone in `limit_req_zone`. -- `node['nginx']['rate_limiting_backoff']` - sets the backoff time for `limit_req_zone`. +- `node['nginx']['rate_limiting_backoff']` - **Incorrect name, retained for compatibility reasons** - sets the size of the shared memory zone (default=`10m`, 10 megabytes) - `node['nginx']['rate_limit']` - set the rate limit amount for `limit_req_zone`. -### chef_nginx::repo +### nginx::repo - `node['nginx']['upstream_repository']` - the URL to use for the package repository resource; default is set based on platform type - `node['nginx']['repo_signing_key']` - The URL from which package signing/gpg key is retrieved -### chef_nginx::socketproxy +### nginx::socketproxy -These attributes are used in the `chef_nginx::socketproxy` recipe. +These attributes are used in the `nginx::socketproxy` recipe. - `node['nginx']['socketproxy']['root']` - The directory (on your server) where socketproxy apps are deployed. - `node['nginx']['socketproxy']['default_app']` - Static assets directory for requests to "/" that don't meet any proxy_pass filter requirements. @@ -213,34 +220,34 @@ These attributes are used in the `chef_nginx::socketproxy` recipe. - `node['nginx']['socketproxy']['apps']['app_name']['context_name']` - URI (e.g. "app_name" in order to achieve "") at which to host the application "app_name" - `node['nginx']['socketproxy']['apps']['app_name']['subdir']` - Directory (under `node['nginx']['socketproxy']['root']`) in which to find the application. -### chef_nginx::source +### nginx::source -These attributes are used in the `chef_nginx::source` recipe. Some of them are dynamically modified during the run. See `attributes/source.rb` for default values. +These attributes are used in the `nginx::source` recipe. Some of them are dynamically modified during the run. See `attributes/source.rb` for default values. - `node['nginx']['source']['url']` - (versioned) URL for the nginx source code. By default this will use the version specified as `node['nginx']['version']`. - `node['nginx']['source']['prefix']` - (versioned) prefix for installing nginx from source - `node['nginx']['source']['conf_path']` - location of the main config file, in `node['nginx']['dir']` by default. -- `node['nginx']['source']['modules']` - Array of modules that should be compiled into nginx by including their recipes in `chef_nginx::source`. +- `node['nginx']['source']['modules']` - Array of modules that should be compiled into nginx by including their recipes in `nginx::source`. - `node['nginx']['source']['default_configure_flags']` - The default flags passed to the configure script when building nginx. -- `node['nginx']['configure_flags']` - Preserved for compatibility and dynamically generated from the `node['nginx']['source']['default_configure_flags']` in the `chef_nginx::source` recipe. -- `node['nginx']['source']['use_existing_user']` - set to `true` if you do not want `chef_nginx::source` recipe to create system user with name `node['nginx']['user']`. +- `node['nginx']['configure_flags']` - Preserved for compatibility and dynamically generated from the `node['nginx']['source']['default_configure_flags']` in the `nginx::source` recipe. +- `node['nginx']['source']['use_existing_user']` - set to `true` if you do not want `nginx::source` recipe to create system user with name `node['nginx']['user']` and `node['nginx']['user_home']`. -### chef_nginx::status +### nginx::status -These attributes are used in the `chef_nginx::http_stub_status_module` recipe. +These attributes are used in the `nginx::http_stub_status_module` recipe. - `node['nginx']['status']['port']` - The port on which nginx will serve the status info (default: 8090) -### chef_nginx::syslog +### nginx::syslog -These attributes are used in the `chef_nginx::syslog_module` recipe. +These attributes are used in the `nginx::syslog_module` recipe. - `node['nginx']['syslog']['git_repo']` - The git repository url to use for the syslog patches. - `node['nginx']['syslog']['git_revision']` - The revision on the git repository to checkout. -### chef_nginx::upload_progress +### nginx::upload_progress -These attributes are used in the `chef_nginx::upload_progress_module` recipe. +These attributes are used in the `nginx::upload_progress_module` recipe. - `node['nginx']['upload_progress']['url']` - URL for the tarball. - `node['nginx']['upload_progress']['checksum']` - Checksum of the tarball. @@ -261,24 +268,36 @@ Enable or disable a Server Block in `#{node['nginx']['dir']}/sites-available` by ### Properties: -- `name` - (optional) Name of the site to enable. By default it's assumed that the name of the nginx_site resource is the site name, but this allows overriding that. +- `site_name` - (optional) Name of the site to enable. By default it's assumed that the name of the nginx_site resource is the site name, but this allows overriding that. - `template` - (optional) Path to the source for the `template` resource. - `variables` - (optional) Variables to be used with the `template` resource -## Ohai Plugin +### nginx_stream -The `ohai_plugin` recipe includes an Ohai plugin. It will be automatically installed and activated, providing the following attributes via ohai, no matter how nginx is installed (source or package): +Enable or disable a Stream Block in `#{node['nginx']['dir']}/streams-available` by calling nxenstream or nxdisstream (introduced by this cookbook) to manage the symbolic link in `#{node['nginx']['dir']}/streams-enabled`. -- `node['nginx']['version']` - version of nginx -- `node['nginx']['configure_arguments']` - options passed to `./configure` when nginx was built -- `node['nginx']['prefix']` - installation prefix -- `node['nginx']['conf_path']` - configuration file path +### Actions -In the source recipe, it is used to determine whether control attributes for building nginx have changed. +- `enable` - Enable the nginx stream (default) +- `disable` - Disable the nginx stream + +### Properties: + +- `stream_name` - (optional) Name of the stream to enable. +- `template` - (optional) Path to the source for the `template` resource. +- `variables` - (optional) Variables to be used with the `template` resource + +### nginx_cleanup_runit + +A simple resource to remove existing runit based nginx service installations. This is used in the default nginx recipe to stop runit based nginx services and cleanup runit service configs before setting up nginx under the system's own init system. + +### Actions + +- `cleanup` - Stop runit based nginx and remove runit configs (default) ## Usage -This cookbook provides three distinct installation methods, all of which are controlled via attributes and executed using the chef_nginx::default recipe. +This cookbook provides three distinct installation methods, all of which are controlled via attributes and executed using the nginx::default recipe. ### Package installation using the nginx.org repositories @@ -347,17 +366,13 @@ node.run_state['nginx_configure_flags'] = node.run_state['nginx_configure_flags'] | ['--with-SOMETHING', "--with-SOME_OPT='things'"] ``` -## License & Authors +## Maintainers -- Author:: Joshua Timberman ([joshua@chef.io](mailto:joshua@chef.io)) -- Author:: Adam Jacob ([adam@chef.io](mailto:adam@chef.io)) -- Author:: AJ Christensen ([aj@chef.io](mailto:aj@chef.io)) -- Author:: Jamie Winsor ([jamie@vialstudios.com](mailto:jamie@vialstudios.com)) -- Author:: Mike Fiedler ([miketheman@gmail.com](mailto:miketheman@gmail.com)) +This cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our [team documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/COOKBOOK_TEAM.MD). To learn more about contributing to cookbooks like this see our [contributing documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD), or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the [Chef Community Slack](http://community-slack.chef.io/) -```text -Copyright 2008-2016, Chef Software, Inc +## License +``` 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 diff --git a/cookbooks/chef_nginx/attributes/auth_request.rb b/cookbooks/nginx/attributes/auth_request.rb similarity index 97% rename from cookbooks/chef_nginx/attributes/auth_request.rb rename to cookbooks/nginx/attributes/auth_request.rb index 21eb14f..8538a66 100644 --- a/cookbooks/chef_nginx/attributes/auth_request.rb +++ b/cookbooks/nginx/attributes/auth_request.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: auth_request # # Author:: David Radcliffe () diff --git a/cookbooks/chef_nginx/attributes/default.rb b/cookbooks/nginx/attributes/default.rb similarity index 90% rename from cookbooks/chef_nginx/attributes/default.rb rename to cookbooks/nginx/attributes/default.rb index ac1dbf4..d3e4cac 100644 --- a/cookbooks/chef_nginx/attributes/default.rb +++ b/cookbooks/nginx/attributes/default.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: default # # Author:: Adam Jacob () @@ -22,7 +22,7 @@ # In order to update the version, the checksum attribute must be changed too. # This attribute is defined in the source.rb attribute file -default['nginx']['version'] = '1.10.3' +default['nginx']['version'] = '1.12.1' default['nginx']['package_name'] = 'nginx' default['nginx']['port'] = '80' default['nginx']['dir'] = '/etc/nginx' @@ -33,6 +33,9 @@ default['nginx']['binary'] = '/usr/sbin/nginx' default['nginx']['default_root'] = '/var/www/nginx-default' default['nginx']['ulimit'] = '1024' +# cleanup runit install of previous cookbooks +default['nginx']['cleanup_runit'] = true + # use the upstream nginx repo vs. distro packages # this enables the use of modern nginx releases # set this to nil to use the distro packages @@ -42,7 +45,7 @@ default['nginx']['install_method'] = 'package' case node['platform_family'] when 'rhel', 'fedora', 'amazon' - default['nginx']['user'] = 'nginx' + default['nginx']['user'] = 'nginx' when 'freebsd' default['nginx']['package_name'] = 'www/nginx' default['nginx']['user'] = 'www' @@ -57,6 +60,8 @@ else # debian probably default['nginx']['user'] = 'www-data' end +default['nginx']['user_home'] = '/var/www' + default['nginx']['upstart']['runlevels'] = '2345' default['nginx']['upstart']['respawn_limit'] = nil default['nginx']['upstart']['foreground'] = true @@ -117,8 +122,13 @@ default['nginx']['proxy_read_timeout'] = nil default['nginx']['client_body_buffer_size'] = nil default['nginx']['client_max_body_size'] = nil default['nginx']['large_client_header_buffers'] = nil +default['nginx']['map_hash_max_size'] = nil +default['nginx']['proxy_buffer_size'] = nil +default['nginx']['proxy_buffers'] = nil +default['nginx']['proxy_busy_buffers_size'] = nil default['nginx']['default']['modules'] = [] default['nginx']['extra_configs'] = {} +default['nginx']['ohai_plugin_enabled'] = true default['nginx']['load_modules'] = [] diff --git a/cookbooks/chef_nginx/attributes/devel.rb b/cookbooks/nginx/attributes/devel.rb similarity index 97% rename from cookbooks/chef_nginx/attributes/devel.rb rename to cookbooks/nginx/attributes/devel.rb index 0d3cb72..3c1aa39 100644 --- a/cookbooks/chef_nginx/attributes/devel.rb +++ b/cookbooks/nginx/attributes/devel.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: devel # # Author:: Arthur Freyman () diff --git a/cookbooks/chef_nginx/attributes/echo.rb b/cookbooks/nginx/attributes/echo.rb similarity index 81% rename from cookbooks/chef_nginx/attributes/echo.rb rename to cookbooks/nginx/attributes/echo.rb index 78db4d6..75a3524 100644 --- a/cookbooks/chef_nginx/attributes/echo.rb +++ b/cookbooks/nginx/attributes/echo.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: echo # # Author:: Danial Pearce () @@ -19,6 +19,6 @@ # limitations under the License. # -default['nginx']['echo']['version'] = '0.59' +default['nginx']['echo']['version'] = '0.61' default['nginx']['echo']['url'] = "https://github.com/openresty/echo-nginx-module/archive/v#{node['nginx']['echo']['version']}.tar.gz" -default['nginx']['echo']['checksum'] = '9b319ad7836202883128d2b9c24ed818082541df57ef7f2065b7557085c603cd' +default['nginx']['echo']['checksum'] = '2e6a03032555f5da1bdff2ae96c96486f447da3da37c117e0f964ae0753d22aa' diff --git a/cookbooks/chef_nginx/attributes/geoip.rb b/cookbooks/nginx/attributes/geoip.rb similarity index 98% rename from cookbooks/chef_nginx/attributes/geoip.rb rename to cookbooks/nginx/attributes/geoip.rb index aee552e..2d1f6b1 100644 --- a/cookbooks/chef_nginx/attributes/geoip.rb +++ b/cookbooks/nginx/attributes/geoip.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: geoip # # Author:: Jamie Winsor () diff --git a/cookbooks/chef_nginx/attributes/headers_more.rb b/cookbooks/nginx/attributes/headers_more.rb similarity index 97% rename from cookbooks/chef_nginx/attributes/headers_more.rb rename to cookbooks/nginx/attributes/headers_more.rb index 66f2525..1150a4b 100644 --- a/cookbooks/chef_nginx/attributes/headers_more.rb +++ b/cookbooks/nginx/attributes/headers_more.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: headers_more # # Author:: Lucas Jandrew () diff --git a/cookbooks/chef_nginx/attributes/lua.rb b/cookbooks/nginx/attributes/lua.rb similarity index 86% rename from cookbooks/chef_nginx/attributes/lua.rb rename to cookbooks/nginx/attributes/lua.rb index 27327dc..c896d6d 100644 --- a/cookbooks/chef_nginx/attributes/lua.rb +++ b/cookbooks/nginx/attributes/lua.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: lua # # Author:: Arthur Freyman () @@ -19,9 +19,9 @@ # limitations under the License. # -default['nginx']['lua']['version'] = '0.10.7' +default['nginx']['lua']['version'] = '0.10.10' default['nginx']['lua']['url'] = "https://github.com/chaoslawful/lua-nginx-module/archive/v#{node['nginx']['lua']['version']}.tar.gz" -default['nginx']['lua']['checksum'] = 'c21c8937dcdd6fc2b6a955f929e3f4d1388610f47180e60126e6dcab06786f77' +default['nginx']['lua']['checksum'] = 'b4acb84e2d631035a516d61830c910ef6e6485aba86096221ec745e0dbb3fbc9' default['nginx']['luajit']['version'] = '2.0.4' default['nginx']['luajit']['url'] = "http://luajit.org/download/LuaJIT-#{node['nginx']['luajit']['version']}.tar.gz" diff --git a/cookbooks/chef_nginx/attributes/naxsi.rb b/cookbooks/nginx/attributes/naxsi.rb similarity index 97% rename from cookbooks/chef_nginx/attributes/naxsi.rb rename to cookbooks/nginx/attributes/naxsi.rb index 8d0d682..3615c2e 100644 --- a/cookbooks/chef_nginx/attributes/naxsi.rb +++ b/cookbooks/nginx/attributes/naxsi.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: naxsi # # Author:: Artiom Lunev () diff --git a/cookbooks/chef_nginx/attributes/openssl_source.rb b/cookbooks/nginx/attributes/openssl_source.rb similarity index 97% rename from cookbooks/chef_nginx/attributes/openssl_source.rb rename to cookbooks/nginx/attributes/openssl_source.rb index 2368ce3..2da8791 100644 --- a/cookbooks/chef_nginx/attributes/openssl_source.rb +++ b/cookbooks/nginx/attributes/openssl_source.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: openssl_source # # Author:: David Radcliffe () diff --git a/cookbooks/chef_nginx/attributes/pagespeed.rb b/cookbooks/nginx/attributes/pagespeed.rb similarity index 95% rename from cookbooks/chef_nginx/attributes/pagespeed.rb rename to cookbooks/nginx/attributes/pagespeed.rb index b32c693..319d416 100644 --- a/cookbooks/chef_nginx/attributes/pagespeed.rb +++ b/cookbooks/nginx/attributes/pagespeed.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Recipe:: pagespeed_module # default['nginx']['pagespeed']['version'] = '1.11.33.2' diff --git a/cookbooks/chef_nginx/attributes/passenger.rb b/cookbooks/nginx/attributes/passenger.rb similarity index 75% rename from cookbooks/chef_nginx/attributes/passenger.rb rename to cookbooks/nginx/attributes/passenger.rb index 8c503e4..4c34b6b 100644 --- a/cookbooks/chef_nginx/attributes/passenger.rb +++ b/cookbooks/nginx/attributes/passenger.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attribute:: passenger # # Author:: Alex Dergachev () @@ -19,7 +19,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +ubuntu_18 = platform?('ubuntu') && node['platform_version'].to_i >= 18 +# this is only used for source installs +# for package installs you will receive the latest version in the repository node.default['nginx']['passenger']['version'] = '4.0.57' if node['nginx']['repo_source'] == 'passenger' @@ -36,13 +39,23 @@ else node.default['nginx']['passenger']['ruby'] = '/usr/bin/ruby' end +node.default['nginx']['passenger']['conf_file'] = if ubuntu_18 + "#{node['nginx']['dir']}/conf.d/mod-http-passenger.conf" + else + "#{node['nginx']['dir']}/conf.d/passenger.conf" + end + node.default['nginx']['passenger']['packages']['rhel'] = if platform_family?('rhel') && node['platform_version'].to_i >= 6 %w(ruby-devel libcurl-devel) else %w(ruby-devel curl-devel) end node.default['nginx']['passenger']['packages']['fedora'] = %w(ruby-devel libcurl-devel) -node.default['nginx']['passenger']['packages']['debian'] = %w(ruby-dev libcurl4-gnutls-dev) +node.default['nginx']['passenger']['packages']['debian'] = if ubuntu_18 + %w(ruby-dev libcurl4-gnutls-dev libnginx-mod-http-passenger) + else + %w(ruby-dev libcurl4-gnutls-dev) + end node.default['nginx']['passenger']['install_rake'] = true node.default['nginx']['passenger']['spawn_method'] = 'smart-lv2' diff --git a/cookbooks/chef_nginx/attributes/rate_limiting.rb b/cookbooks/nginx/attributes/rate_limiting.rb similarity index 97% rename from cookbooks/chef_nginx/attributes/rate_limiting.rb rename to cookbooks/nginx/attributes/rate_limiting.rb index a4db398..c29e8ba 100644 --- a/cookbooks/chef_nginx/attributes/rate_limiting.rb +++ b/cookbooks/nginx/attributes/rate_limiting.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attribute:: rate_limiting # # Copyright:: 2013-2017, Chef Software, Inc. diff --git a/cookbooks/chef_nginx/attributes/repo.rb b/cookbooks/nginx/attributes/repo.rb similarity index 63% rename from cookbooks/chef_nginx/attributes/repo.rb rename to cookbooks/nginx/attributes/repo.rb index ea334fc..3f630cc 100644 --- a/cookbooks/chef_nginx/attributes/repo.rb +++ b/cookbooks/nginx/attributes/repo.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Recipe:: repo # # Author:: Nick Rycar @@ -21,22 +21,20 @@ default['nginx']['upstream_repository'] = case node['platform_family'] - when 'amazon' # Chef 13+ on amazon linux - 'http://nginx.org/packages/rhel/6/$basearch/' - when 'rhel', 'fedora' + when 'rhel', 'fedora', 'amazon' case node['platform'] when 'centos' # See http://wiki.nginx.org/Install - "http://nginx.org/packages/centos/#{node['platform_version'].to_i}/$basearch/" + "https://nginx.org/packages/centos/#{node['platform_version'].to_i}/$basearch/" when 'amazon' # Chef < 13 on Amazon - 'http://nginx.org/packages/rhel/6/$basearch/' + 'https://nginx.org/packages/rhel/6/$basearch/' else - "http://nginx.org/packages/rhel/#{node['platform_version'].to_i}/$basearch/" + "https://nginx.org/packages/rhel/#{node['platform_version'].to_i}/$basearch/" end when 'debian' - "http://nginx.org/packages/#{node['platform']}" + "https://nginx.org/packages/#{node['platform']}" when 'suse' - 'http://nginx.org/packages/sles/12' + 'https://nginx.org/packages/sles/12' end -default['nginx']['repo_signing_key'] = 'http://nginx.org/keys/nginx_signing.key' +default['nginx']['repo_signing_key'] = 'https://nginx.org/keys/nginx_signing.key' diff --git a/cookbooks/chef_nginx/attributes/set_misc.rb b/cookbooks/nginx/attributes/set_misc.rb similarity index 93% rename from cookbooks/chef_nginx/attributes/set_misc.rb rename to cookbooks/nginx/attributes/set_misc.rb index 6d8a126..2bf905c 100644 --- a/cookbooks/chef_nginx/attributes/set_misc.rb +++ b/cookbooks/nginx/attributes/set_misc.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: set_misc # diff --git a/cookbooks/chef_nginx/attributes/socketproxy.rb b/cookbooks/nginx/attributes/socketproxy.rb similarity index 95% rename from cookbooks/chef_nginx/attributes/socketproxy.rb rename to cookbooks/nginx/attributes/socketproxy.rb index e680118..d4a2e3c 100644 --- a/cookbooks/chef_nginx/attributes/socketproxy.rb +++ b/cookbooks/nginx/attributes/socketproxy.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: socketproxy.rb # diff --git a/cookbooks/chef_nginx/attributes/source.rb b/cookbooks/nginx/attributes/source.rb similarity index 85% rename from cookbooks/chef_nginx/attributes/source.rb rename to cookbooks/nginx/attributes/source.rb index 24dce3c..5c81dc1 100644 --- a/cookbooks/chef_nginx/attributes/source.rb +++ b/cookbooks/nginx/attributes/source.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: source # # Author:: Jamie Winsor () @@ -19,7 +19,7 @@ # limitations under the License. # -include_attribute 'chef_nginx::default' +include_attribute 'nginx::default' default['nginx']['init_style'] = if node['platform'] == 'ubuntu' && node['platform_version'].to_f <= 14.04 # init_package identifies 12.04/14.04 as init, but we should be using upstart here @@ -32,18 +32,21 @@ default['nginx']['source']['version'] = node['nginx']['version'] 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" + +# Wno-error can be removed when nginx compiles on GCC7: https://trac.nginx.org/nginx/ticket/1259 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']} + --with-cc-opt=-Wno-error ) 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'] = '75020f1364cac459cb733c4e1caed2d00376e40ea05588fb8793076a4c69dd90' +default['nginx']['source']['checksum'] = '8793bf426485a30f91021b6b945a9fd8a84d87d17b566562c3797aba8fac76fb' default['nginx']['source']['modules'] = %w( - chef_nginx::http_ssl_module - chef_nginx::http_gzip_static_module + nginx::http_ssl_module + nginx::http_gzip_static_module ) default['nginx']['source']['use_existing_user'] = false diff --git a/cookbooks/chef_nginx/attributes/status.rb b/cookbooks/nginx/attributes/status.rb similarity index 96% rename from cookbooks/chef_nginx/attributes/status.rb rename to cookbooks/nginx/attributes/status.rb index 00bbef2..e2191aa 100644 --- a/cookbooks/chef_nginx/attributes/status.rb +++ b/cookbooks/nginx/attributes/status.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: status # # Author:: David Radcliffe () diff --git a/cookbooks/chef_nginx/attributes/syslog.rb b/cookbooks/nginx/attributes/syslog.rb similarity index 97% rename from cookbooks/chef_nginx/attributes/syslog.rb rename to cookbooks/nginx/attributes/syslog.rb index 707e050..073ded3 100644 --- a/cookbooks/chef_nginx/attributes/syslog.rb +++ b/cookbooks/nginx/attributes/syslog.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: syslog # # Author:: Bob Ziuchkovski () diff --git a/cookbooks/chef_nginx/attributes/upload_progress.rb b/cookbooks/nginx/attributes/upload_progress.rb similarity index 97% rename from cookbooks/chef_nginx/attributes/upload_progress.rb rename to cookbooks/nginx/attributes/upload_progress.rb index af38586..9c1819a 100644 --- a/cookbooks/chef_nginx/attributes/upload_progress.rb +++ b/cookbooks/nginx/attributes/upload_progress.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Attributes:: upload_progress # # Author:: Jamie Winsor () diff --git a/cookbooks/chef_nginx/files/default/mime.types b/cookbooks/nginx/files/mime.types similarity index 99% rename from cookbooks/chef_nginx/files/default/mime.types rename to cookbooks/nginx/files/mime.types index 6b03a32..fd3000f 100644 --- a/cookbooks/chef_nginx/files/default/mime.types +++ b/cookbooks/nginx/files/mime.types @@ -96,6 +96,7 @@ types { application/pdf pdf; application/postscript ai eps ps; application/rtf rtf; + application/vnd.apple.mpegurl m3u8; application/vnd.google-earth.kml+xml kml; application/vnd.google-earth.kmz kmz; application/vnd.wap.wmlc wmlc; diff --git a/cookbooks/chef_nginx/files/default/naxsi_core.rules b/cookbooks/nginx/files/naxsi_core.rules similarity index 100% rename from cookbooks/chef_nginx/files/default/naxsi_core.rules rename to cookbooks/nginx/files/naxsi_core.rules diff --git a/cookbooks/chef_nginx/libraries/helpers.rb b/cookbooks/nginx/libraries/helpers.rb similarity index 90% rename from cookbooks/chef_nginx/libraries/helpers.rb rename to cookbooks/nginx/libraries/helpers.rb index a81413b..8c4f3b1 100644 --- a/cookbooks/chef_nginx/libraries/helpers.rb +++ b/cookbooks/nginx/libraries/helpers.rb @@ -1,5 +1,5 @@ # -# Cookbook:: chef_nginx +# Cookbook:: nginx # Library:: helpers # # Author:: Tim Smith () @@ -26,7 +26,7 @@ module NginxRecipeHelpers # systemd based distros and Ubuntu 14.04 use '/run/nginx.pid' for their # packages def pidfile_location - if (node['nginx']['repo_source'].nil? || node['nginx']['repo_source'] == 'distro') && + if (node['nginx']['repo_source'].nil? || %w(distro passenger).include?(node['nginx']['repo_source'])) && (node['init_package'] == 'systemd' || node['platform_version'].to_f == 14.04) '/run/nginx.pid' else diff --git a/cookbooks/chef_nginx/libraries/nginx_version.rb b/cookbooks/nginx/libraries/nginx_version.rb similarity index 100% rename from cookbooks/chef_nginx/libraries/nginx_version.rb rename to cookbooks/nginx/libraries/nginx_version.rb diff --git a/cookbooks/nginx/metadata.json b/cookbooks/nginx/metadata.json new file mode 100644 index 0000000..ba305ab --- /dev/null +++ b/cookbooks/nginx/metadata.json @@ -0,0 +1 @@ +{"name":"nginx","version":"9.0.0","description":"Installs and configures nginx","long_description":"# nginx Cookbook\n\n[![Cookbook](http://img.shields.io/cookbook/v/nginx.svg)](https://supermarket.chef.io/cookbooks/nginx) [![Build Status](https://travis-ci.org/chef-cookbooks/nginx.svg?branch=master)](https://travis-ci.org/chef-cookbooks/nginx)\n\nInstalls nginx from package OR source code and sets up configuration handling similar to Debian's Apache2 scripts.\n\n## Requirements\n\n### Cookbooks\n\nThe following cookbooks are direct dependencies because they're used for common \"default\" functionality.\n\n- `build-essential` for source installations\n- `ohai` for setting up the ohai plugin\n- `yum-epel` for setting up the EPEL repository on RHEL platforms\n- `zypper` for setting up the nginx.org repository on Suse platforms\n\n### Platforms\n\nThe following platforms are supported and tested with Test Kitchen:\n\n- Ubuntu 14.04+\n- CentOS 6+\n- Debian 7+\n- openSUSE\n- FreeBSD\n\nOther Debian and RHEL family distributions are assumed to work.\n\n### Chef\n\n- Chef 13.3+\n\n## Attributes\n\nNode attributes for this cookbook are logically separated into different files. Some attributes are set only via a specific recipe.\n\n### nginx::auth_request\n\nThese attributes are used in the `nginx::auth_request` recipe.\n\n- `node['nginx']['auth_request']['url']` - The url to the auth_request module tar.gz file\n- `node['nginx']['auth_request']['checksum']` - The checksum of the auth_request module tar.gz file\n\n### nginx::default\n\nGenerally used attributes. Some have platform specific values. See `attributes/default.rb`. \"The Config\" refers to \"nginx.conf\" the main config file.\n\n- `node['nginx']['dir']` - Location for nginx configuration.\n- `node['nginx']['conf_template']` - The `source` template to use when creating the `nginx.conf`.\n- `node['nginx']['conf_cookbook']` - The cookbook where `node['nginx']['conf_template']` resides.\n- `node['nginx']['log_dir']` - Location for nginx logs.\n- `node['nginx']['log_dir_perm']` - Permissions for nginx logs folder.\n- `node['nginx']['user']` - User that nginx will run as.\n- `node['nginx']['user_home']` - User home path, used during user creation.\n- `node['nginx']['group']` - Group for nginx.\n- `node['nginx']['port']` - Port for nginx to listen on.\n- `node['nginx']['binary']` - Path to the nginx binary.\n- `node['nginx']['init_style']` - How to run nginx as a service when using `nginx::source`. Values can be \"upstart\", \"systemd\", or \"init\". This attribute is not used in the `package` recipe because the package manager's init script style for the platform is assumed.\n- `node['nginx']['cleanup_runit']` - Cleanup existing runit based nginx service installation. Uses the `nginx_cleanup_runit` resource. Default: true\n- `node['nginx']['upstart']['foreground']` - Set this to true if you want upstart to run nginx in the foreground, set to false if you want upstart to detach and track the process via pid.\n- `node['nginx']['upstart']['runlevels']` - String of runlevels in the format '2345' which determines which runlevels nginx will start at when entering and stop at when leaving.\n- `node['nginx']['upstart']['respawn_limit']` - Respawn limit in upstart stanza format, count followed by space followed by interval in seconds.\n- `node['nginx']['keepalive']` - Whether to use `keepalive_timeout`, any value besides \"on\" will leave that option out of the config.\n- `node['nginx']['keepalive_requests']` - used for config value of `keepalive_requests`.\n- `node['nginx']['keepalive_timeout']` - used for config value of `keepalive_timeout`.\n- `node['nginx']['worker_processes']` - used for config value of `worker_processes`.\n- `node['nginx']['worker_connections']` - used for config value of `events { worker_connections }`\n- `node['nginx']['worker_rlimit_nofile']` - used for config value of `worker_rlimit_nofile`. Can replace any \"ulimit -n\" command. The value depend on your usage (cache or not) but must always be superior than worker_connections.\n- `node['nginx']['worker_shutdown_timeout']` - used for config value of `worker_shutdown_timeout`.\n- `node['nginx']['worker_connections']` - used for config value of `events { worker_connections }`\n- `node['nginx']['multi_accept']` - used for config value of `events { multi_accept }`. Try to accept() as many connections as possible. Disable by default.\n- `node['nginx']['event']` - used for config value of `events { use }`. Set the event-model. By default nginx looks for the most suitable method for your OS.\n- `node['nginx']['accept_mutex_delay']` - used for config value of `accept_mutex_delay`\n- `node['nginx']['server_tokens']` - used for config value of `server_tokens`.\n- `node['nginx']['server_names_hash_bucket_size']` - used for config value of `server_names_hash_bucket_size`.\n- `node['nginx']['disable_access_log']` - set to true to disable the general access log, may be useful on high traffic sites.\n- `node['nginx']['access_log_options']` - Set to a string of additional options to be appended to the access log directive\n- `node['nginx']['error_log_options']` - Set to a string of additional options to be appended to the error log directive\n- `node['nginx']['default_site_enabled']` - enable the default site\n- `node['nginx']['sendfile']` - Whether to use `sendfile`. Defaults to \"on\".\n- `node['nginx']['tcp_nopush']` - Whether to use `tcp_nopush`. Defaults to \"on\".\n- `node['nginx']['tcp_nodelay']` - Whether to use `tcp_nodelay`. Defaults to \"on\".\n- `node['nginx']['install_method']` - Whether nginx is installed from packages or from source.\n- `node['nginx']['types_hash_max_size']` - Used for the `types_hash_max_size` configuration directive.\n- `node['nginx']['types_hash_bucket_size']` - Used for the `types_hash_bucket_size` configuration directive.\n- `node['nginx']['proxy_read_timeout']` - defines a timeout (between two successive read operations) for reading a response from the proxied server.\n- `node['nginx']['client_body_buffer_size']` - used for config value of `client_body_buffer_size`.\n- `node['nginx']['client_max_body_size']` - specifies the maximum accepted body size of a client request, as indicated by the request header Content-Length.\n- `node['nginx']['repo_source']` - when installed from a package this attribute affects which yum repositories, if any, will be added before installing the nginx package. The default value of 'epel' will use the `yum-epel` cookbook, 'nginx' will use the `nginx::repo` recipe, 'passenger' will use the 'nginx::repo_passenger' recipe, and setting no value will not add any additional repositories.\n- `node['nginx']['sts_max_age']` - Enable Strict Transport Security for all apps (See: ). This attribute adds the following header: Strict-Transport-Security max-age=SECONDS to all incoming requests and takes an integer (in seconds) as its argument.\n- `node['nginx']['default']['modules']` - Array specifying which modules to enable via the conf-enabled config include function. Currently the only valid value is \"socketproxy\".\n- `node['nginx']['load_modules']` - Array of paths to modules to dynamically load on nginx startup using the `load_module` directive. Default is `[]`.\n\n#### authorized_ips module\n\n- `node['nginx']['remote_ip_var']` - The remote ip variable name to use.\n- `node['nginx']['authorized_ips']` - IPs authorized by the module\n\n#### gzip module\n\n- `node['nginx']['gzip']` - Whether to use gzip, can be \"on\" or \"off\"\n- `node['nginx']['gzip_http_version']` - used for config value of `gzip_http_version`.\n- `node['nginx']['gzip_comp_level']` - used for config value of `gzip_comp_level`.\n- `node['nginx']['gzip_proxied']` - used for config value of `gzip_proxied`.\n- `node['nginx']['gzip_vary']` - used for config value of `gzip_vary`.\n- `node['nginx']['gzip_buffers']` - used for config value of `gzip_buffers`.\n- `node['nginx']['gzip_types']` - used for config value of `gzip_types` - must be an Array.\n- `node['nginx']['gzip_min_length']` - used for config value of `gzip_min_length`.\n- `node['nginx']['gzip_disable']` - used for config value of `gzip_disable`.\n- `node['nginx']['gzip_static']` - used for config value of `gzip_static` (`http_gzip_static_module` must be enabled)\n\n#### Other configurations\n\n- `node['nginx']['extra_configs']` - a Hash of key/values to nginx configuration.\n\n### nginx::devel\n\nThese attributes are used in the `nginx::ngx_devel_module` recipe.\n\n- `node['nginx']['devel']['version']` - The version of the nginx devel module\n- `node['nginx']['devel']['url']` - The URL of the nginx devel module tar.gz file\n- `node['nginx']['devel']['checksum']` - The checksum of the nginx devel module tar.gz file\n\n### nginx::echo\n\nThese attributes are used in the `nginx::http_echo_module` recipe.\n\n- `node['nginx']['echo']['version']` - The version of `http_echo` you want (default: 0.59)\n- `node['nginx']['echo']['url']` - URL for the tarball.\n- `node['nginx']['echo']['checksum']` - Checksum of the tarball.\n\n### nginx::geoip\n\nThese attributes are used in the `nginx::http_geoip_module` recipe. Please note that the `country_dat_checksum` and `city_dat_checksum` are based on downloads from a datacenter in Fremont, CA, USA. You really should override these with checksums for the geo tarballs from your node location.\n\n**Note** The upstream, maxmind.com, may block access for repeated downloads of the data files. It is recommended that you download and host the data files, and change the URLs in the attributes.\n\n- `node['nginx']['geoip']['path']` - Location where to install the geoip libraries.\n- `node['nginx']['geoip']['enable_city']` - Whether to enable City data\n- `node['nginx']['geoip']['country_dat_url']` - Country data tarball URL\n- `node['nginx']['geoip']['country_dat_checksum']` - Country data tarball checksum\n- `node['nginx']['geoip']['city_dat_url']` - City data tarball URL\n- `node['nginx']['geoip']['city_dat_checksum']` - City data tarball checksum\n- `node['nginx']['geoip']['lib_version']` - Version of the GeoIP library to install\n- `node['nginx']['geoip']['lib_url']` - (Versioned) Tarball URL of the GeoIP library\n- `node['nginx']['geoip']['lib_checksum']` - Checksum of the GeoIP library tarball\n\n### nginx::http_realip_module\n\nFrom: \n\n- `node['nginx']['realip']['header']` - Header to use for the RealIp Module; only accepts \"X-Forwarded-For\" or \"X-Real-IP\"\n- `node['nginx']['realip']['addresses']` - Addresses to use for the `http_realip` configuration.\n- `node['nginx']['realip']['real_ip_recursive']` - If recursive search is enabled, the original client address that matches one of the trusted addresses is replaced by the last non-trusted address sent in the request header field. Can be on \"on\" or \"off\" (default).\n\n### nginx::ohai_plugin\n\nThe `ohai_plugin` recipe includes an Ohai plugin. It will be automatically installed and activated, providing the following attributes via ohai, no matter how nginx is installed (source or package):\n\n- `node['nginx']['version']` - version of nginx\n- `node['nginx']['configure_arguments']` - options passed to `./configure` when nginx was built\n- `node['nginx']['prefix']` - installation prefix\n- `node['nginx']['conf_path']` - configuration file path\n- `node['nginx']['ohai_plugin_enabled']` - Toggles ohai_plugin recipe. Defaults to true.\n\nIn the source recipe, it is used to determine whether control attributes for building nginx have changed.\n\n### nginx::openssl_source\n\nThese attributes are used in the `nginx::openssl_source` recipe.\n\n- `node['nginx']['openssl_source']['version']` - The version of OpenSSL you want to download and use (default: 1.0.1t)\n- `node['nginx']['openssl_source']['url']` - The url for the OpenSSL source\n\n### nginx::passenger\n\nThese attributes are used in the `nginx::passenger` recipe.\n\n- `node['nginx']['passenger']['version']` - passenger gem version\n- `node['nginx']['passenger']['root']` - passenger gem root path\n- `node['nginx']['passenger']['install_rake']` - set to false if rake already present on system\n- `node['nginx']['passenger']['max_pool_size']` - maximum passenger pool size (default=10)\n- `node['nginx']['passenger']['ruby']` - Ruby path for Passenger to use (default=`$(which ruby)`)\n- `node['nginx']['passenger']['spawn_method']` - passenger spawn method to use (default=`smart-lv2`)\n- `node['nginx']['passenger']['buffer_response']` - turns on or off response buffering (default=`on`)\n- `node['nginx']['passenger']['max_pool_size']` - passenger maximum pool size (default=`6`)\n- `node['nginx']['passenger']['min_instances']` - minimum instances (default=`1`)\n- `node['nginx']['passenger']['max_instances_per_app']` - maximum instances per app (default=`0`)\n- `node['nginx']['passenger']['pool_idle_time']` - passenger pool idle time (default=`300`)\n- `node['nginx']['passenger']['max_requests']` - maximum requests (default=`0`)\n- `node['nginx']['passenger']['nodejs']` - Nodejs path for Passenger to use (default=nil)\n- `node['nginx']['passenger']['show_version_in_header']` - Show passenger version in HTTP headers (default=`on`)\n\nBasic configuration to use the official Phusion Passenger repositories:\n\n- `node['nginx']['repo_source']` - 'passenger'\n- `node['nginx']['package_name']` - 'nginx-extras'\n- `node['nginx']['passenger']['install_method']` - 'package'\n\n### nginx::rate_limiting\n\n- `node['nginx']['enable_rate_limiting']` - set to true to enable rate limiting (`limit_req_zone` in nginx.conf)\n- `node['nginx']['rate_limiting_zone_name']` - sets the zone in `limit_req_zone`.\n- `node['nginx']['rate_limiting_backoff']` - **Incorrect name, retained for compatibility reasons** - sets the size of the shared memory zone (default=`10m`, 10 megabytes)\n- `node['nginx']['rate_limit']` - set the rate limit amount for `limit_req_zone`.\n\n### nginx::repo\n\n- `node['nginx']['upstream_repository']` - the URL to use for the package repository resource; default is set based on platform type\n- `node['nginx']['repo_signing_key']` - The URL from which package signing/gpg key is retrieved\n\n### nginx::socketproxy\n\nThese attributes are used in the `nginx::socketproxy` recipe.\n\n- `node['nginx']['socketproxy']['root']` - The directory (on your server) where socketproxy apps are deployed.\n- `node['nginx']['socketproxy']['default_app']` - Static assets directory for requests to \"/\" that don't meet any proxy_pass filter requirements.\n- `node['nginx']['socketproxy']['apps']['app_name']['prepend_slash']` - Prepend a slash to requests to app \"app_name\" before sending them to the socketproxy socket.\n- `node['nginx']['socketproxy']['apps']['app_name']['context_name']` - URI (e.g. \"app_name\" in order to achieve \"\") at which to host the application \"app_name\"\n- `node['nginx']['socketproxy']['apps']['app_name']['subdir']` - Directory (under `node['nginx']['socketproxy']['root']`) in which to find the application.\n\n### nginx::source\n\nThese attributes are used in the `nginx::source` recipe. Some of them are dynamically modified during the run. See `attributes/source.rb` for default values.\n\n- `node['nginx']['source']['url']` - (versioned) URL for the nginx source code. By default this will use the version specified as `node['nginx']['version']`.\n- `node['nginx']['source']['prefix']` - (versioned) prefix for installing nginx from source\n- `node['nginx']['source']['conf_path']` - location of the main config file, in `node['nginx']['dir']` by default.\n- `node['nginx']['source']['modules']` - Array of modules that should be compiled into nginx by including their recipes in `nginx::source`.\n- `node['nginx']['source']['default_configure_flags']` - The default flags passed to the configure script when building nginx.\n- `node['nginx']['configure_flags']` - Preserved for compatibility and dynamically generated from the `node['nginx']['source']['default_configure_flags']` in the `nginx::source` recipe.\n- `node['nginx']['source']['use_existing_user']` - set to `true` if you do not want `nginx::source` recipe to create system user with name `node['nginx']['user']` and `node['nginx']['user_home']`.\n\n### nginx::status\n\nThese attributes are used in the `nginx::http_stub_status_module` recipe.\n\n- `node['nginx']['status']['port']` - The port on which nginx will serve the status info (default: 8090)\n\n### nginx::syslog\n\nThese attributes are used in the `nginx::syslog_module` recipe.\n\n- `node['nginx']['syslog']['git_repo']` - The git repository url to use for the syslog patches.\n- `node['nginx']['syslog']['git_revision']` - The revision on the git repository to checkout.\n\n### nginx::upload_progress\n\nThese attributes are used in the `nginx::upload_progress_module` recipe.\n\n- `node['nginx']['upload_progress']['url']` - URL for the tarball.\n- `node['nginx']['upload_progress']['checksum']` - Checksum of the tarball.\n- `node['nginx']['upload_progress']['javascript_output']` - Output in javascript. Default is `true` for backwards compatibility.\n- `node['nginx']['upload_progress']['zone_name']` - Zone name which will be used to store the per-connection tracking information. Default is `proxied`.\n- `node['nginx']['upload_progress']['zone_size']` - Zone size in bytes. Default is `1m` (1 megabyte).\n\n## Resources\n\n### nginx_site\n\nEnable or disable a Server Block in `#{node['nginx']['dir']}/sites-available` by calling nxensite or nxdissite (introduced by this cookbook) to manage the symbolic link in `#{node['nginx']['dir']}/sites-enabled`.\n\n### Actions\n\n- `enable` - Enable the nginx site (default)\n- `disable` - Disable the nginx site\n\n### Properties:\n\n- `site_name` - (optional) Name of the site to enable. By default it's assumed that the name of the nginx_site resource is the site name, but this allows overriding that.\n- `template` - (optional) Path to the source for the `template` resource.\n- `variables` - (optional) Variables to be used with the `template` resource\n\n### nginx_stream\n\nEnable or disable a Stream Block in `#{node['nginx']['dir']}/streams-available` by calling nxenstream or nxdisstream (introduced by this cookbook) to manage the symbolic link in `#{node['nginx']['dir']}/streams-enabled`.\n\n### Actions\n\n- `enable` - Enable the nginx stream (default)\n- `disable` - Disable the nginx stream\n\n### Properties:\n\n- `stream_name` - (optional) Name of the stream to enable.\n- `template` - (optional) Path to the source for the `template` resource.\n- `variables` - (optional) Variables to be used with the `template` resource\n\n### nginx_cleanup_runit\n\nA simple resource to remove existing runit based nginx service installations. This is used in the default nginx recipe to stop runit based nginx services and cleanup runit service configs before setting up nginx under the system's own init system.\n\n### Actions\n\n- `cleanup` - Stop runit based nginx and remove runit configs (default)\n\n## Usage\n\nThis cookbook provides three distinct installation methods, all of which are controlled via attributes and executed using the nginx::default recipe.\n\n### Package installation using the nginx.org repositories\n\nNginx provides repositories for RHEL, Debian/Ubuntu, and Suse platforms with up to date packages available on older distributions. Due to the age of many nginx packages shipping with distros we believe this is the ideal installation method. With no attributes set the nginx.org repositories will be added to your system and nginx will be installed via package. This provides a solid out of the box install for most users.\n\n### Package installation using distro repositories\n\nIf you prefer to use the packages included in your distro or to roll your own packages you'll want to set `node['nginx']['repo_source']` to `nil` or `distro` to skip the repository setup. The default recipe will still install nginx from packages, but you'll retain control over the package location.\n\n### Source installation to compile non-dynamic modules\n\nIf you need control over how nginx is built, or you need non-dynamic modules to be included you'll need to compile nginx from source. We highly recommend against using this method as it requires the installation of a full compilation toolchain and development dependencies on your nodes. Creating your own packages with nginx compiled as necessary is a preferred option. If that's not possible you can set `node['nginx']['install_method']` to `source` and provide a version in `node['nginx']['version']`.\n\n#### Specifying Modules to compile\n\nThe following recipes are used to build module support into nginx. To compile a module, add its recipe name to the array attribute `node['nginx']['source']['modules']`.\n\n- `ipv6.rb` - enables IPv6 support\n- `headers_more_module` -\n- `http_auth_request_module``\n- `http_echo_module.rb` - downloads the `http_echo_module` module and enables it as a module when compiling nginx.\n- `http_geoip_module.rb` - installs the GeoIP libraries and data files and enables the module for compilation.\n- `http_gzip_static_module.rb` - enables the module for compilation. Be sure to set `node['nginx']['gzip_static'] = 'yes'`.\n- `http_mp4_module` -\n- `http_perl_module.rb` - enables embedded Perl for compilation.\n- `http_realip_module.rb` - enables the module for compilation and creates the configuration.\n- `http_spdy_module` -\n- `http_ssl_module.rb` - enables SSL for compilation.\n- `http_stub_status_module.rb` - provides `nginx_status` configuration and enables the module for compilation.\n- `http_v2_module`\n- `ipv6` -\n- `naxsi_module` - enables the naxsi module for the web application firewall for nginx.\n- `ngx_devel_module` -\n- `ngx_lua_module` -\n- `openssl_source.rb` - downloads and uses custom OpenSSL source when compiling nginx\n- `pagespeed_module`-\n- `passenger` - builds the passenger gem and configuration for \"`mod_passenger`\".\n- `set_misc` -\n- `syslog_module` - enables syslog support for nginx. This only works with source builds. See -\n- `upload_progress_module.rb` - builds the `upload_progress` module and enables it as a module when compiling nginx.\n\n## Resources\n\n### nginx_site\n\nEnable or disable a Server Block in `#{node['nginx']['dir']}/sites-available` by calling nxensite or nxdissite (introduced by this cookbook) to manage the symbolic link in `#{node['nginx']['dir']}/sites-enabled`.\n\n### Actions\n\n- `enable` - Enable the nginx site (default)\n- `disable` - Disable the nginx site\n\n### Properties:\n\n- `name` - (optional) Name of the site to enable. By default it's assumed that the name of the nginx_site resource is the site name, but this allows overriding that.\n- `template` - (optional) Path to the source for the `template` resource.\n- `cookbook` - (optional) The cookbook that contains the template source.\n- `variables` - (optional) Variables to be used with the `template` resource\n\n## Adding New Modules\n\nPreviously we'd add each possible module to this cookbook itself. That's not necessary using wrapper cookbooks and we'd prefer to not add any addition module recipes at this time. Instead in your nginx wrapper cookbook setup any necessary packages and then include the follow code to add the module to the list of modules to compile:\n\n```ruby\nnode.run_state['nginx_configure_flags'] =\n node.run_state['nginx_configure_flags'] | ['--with-SOMETHING', \"--with-SOME_OPT='things'\"]\n```\n\n## Maintainers\n\nThis cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our [team documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/COOKBOOK_TEAM.MD). To learn more about contributing to cookbooks like this see our [contributing documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD), or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the [Chef Community Slack](http://community-slack.chef.io/)\n\n## License\n\n```\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"amazon":">= 0.0.0","centos":">= 0.0.0","debian":">= 0.0.0","fedora":">= 0.0.0","oracle":">= 0.0.0","redhat":">= 0.0.0","scientific":">= 0.0.0","ubuntu":">= 0.0.0","suse":">= 0.0.0","opensuse":">= 0.0.0","opensuseleap":">= 0.0.0"},"dependencies":{"build-essential":">= 5.0","ohai":">= 4.1.0","yum-epel":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{"nginx":"Installs nginx package and sets up configuration with Debian apache style with sites-enabled/sites-available","nginx::source":"Installs nginx from source and sets up configuration with Debian apache style with sites-enabled/sites-available"},"source_url":"https://github.com/chef-cookbooks/nginx","issues_url":"https://github.com/chef-cookbooks/nginx/issues","chef_version":[[">= 13.3"]],"ohai_version":[]} \ No newline at end of file diff --git a/cookbooks/chef_nginx/recipes/authorized_ips.rb b/cookbooks/nginx/recipes/authorized_ips.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/authorized_ips.rb rename to cookbooks/nginx/recipes/authorized_ips.rb diff --git a/cookbooks/chef_nginx/recipes/commons.rb b/cookbooks/nginx/recipes/commons.rb similarity index 84% rename from cookbooks/chef_nginx/recipes/commons.rb rename to cookbooks/nginx/recipes/commons.rb index 46bdea7..cfcf9f5 100644 --- a/cookbooks/chef_nginx/recipes/commons.rb +++ b/cookbooks/nginx/recipes/commons.rb @@ -19,6 +19,6 @@ # limitations under the License. # -include_recipe 'chef_nginx::commons_dir' -include_recipe 'chef_nginx::commons_script' -include_recipe 'chef_nginx::commons_conf' +include_recipe 'nginx::commons_dir' +include_recipe 'nginx::commons_script' +include_recipe 'nginx::commons_conf' diff --git a/cookbooks/chef_nginx/recipes/commons_conf.rb b/cookbooks/nginx/recipes/commons_conf.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/commons_conf.rb rename to cookbooks/nginx/recipes/commons_conf.rb diff --git a/cookbooks/chef_nginx/recipes/commons_dir.rb b/cookbooks/nginx/recipes/commons_dir.rb similarity index 93% rename from cookbooks/chef_nginx/recipes/commons_dir.rb rename to cookbooks/nginx/recipes/commons_dir.rb index 0a86d56..0503ea5 100644 --- a/cookbooks/chef_nginx/recipes/commons_dir.rb +++ b/cookbooks/nginx/recipes/commons_dir.rb @@ -37,7 +37,7 @@ directory 'pid file directory' do recursive true end -%w(sites-available sites-enabled conf.d).each do |leaf| +%w(sites-available sites-enabled conf.d streams-available streams-enabled).each do |leaf| directory File.join(node['nginx']['dir'], leaf) do mode '0755' end diff --git a/cookbooks/chef_nginx/recipes/commons_script.rb b/cookbooks/nginx/recipes/commons_script.rb similarity index 92% rename from cookbooks/chef_nginx/recipes/commons_script.rb rename to cookbooks/nginx/recipes/commons_script.rb index 6b051c0..8e4a0f6 100644 --- a/cookbooks/chef_nginx/recipes/commons_script.rb +++ b/cookbooks/nginx/recipes/commons_script.rb @@ -19,7 +19,7 @@ # limitations under the License. # -%w(nxensite nxdissite).each do |nxscript| +%w(nxensite nxdissite nxenstream nxdisstream).each do |nxscript| template "#{node['nginx']['script_dir']}/#{nxscript}" do source "#{nxscript}.erb" mode '0755' diff --git a/cookbooks/chef_nginx/recipes/default.rb b/cookbooks/nginx/recipes/default.rb similarity index 81% rename from cookbooks/chef_nginx/recipes/default.rb rename to cookbooks/nginx/recipes/default.rb index c0e0d37..106f449 100644 --- a/cookbooks/chef_nginx/recipes/default.rb +++ b/cookbooks/nginx/recipes/default.rb @@ -19,8 +19,10 @@ # limitations under the License. # -include_recipe "chef_nginx::#{node['nginx']['install_method']}" +nginx_cleanup_runit 'cleanup' if node['nginx']['cleanup_runit'] + +include_recipe "nginx::#{node['nginx']['install_method']}" node['nginx']['default']['modules'].each do |ngx_module| - include_recipe "chef_nginx::#{ngx_module}" + include_recipe "nginx::#{ngx_module}" end diff --git a/cookbooks/chef_nginx/recipes/headers_more_module.rb b/cookbooks/nginx/recipes/headers_more_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/headers_more_module.rb rename to cookbooks/nginx/recipes/headers_more_module.rb diff --git a/cookbooks/chef_nginx/recipes/http_auth_request_module.rb b/cookbooks/nginx/recipes/http_auth_request_module.rb similarity index 95% rename from cookbooks/chef_nginx/recipes/http_auth_request_module.rb rename to cookbooks/nginx/recipes/http_auth_request_module.rb index 3a6f6de..5ed944f 100644 --- a/cookbooks/chef_nginx/recipes/http_auth_request_module.rb +++ b/cookbooks/nginx/recipes/http_auth_request_module.rb @@ -21,7 +21,7 @@ # Documentation: # http://nginx.org/en/docs/http/ngx_http_auth_request_module.html -if node['nginx']['source']['version'] >= '1.5.4' +if Chef::VersionConstraint.new('>= 1.5.4').include?(node['nginx']['source']['version']) node.run_state['nginx_configure_flags'] = node.run_state['nginx_configure_flags'] | ['--with-http_auth_request_module'] else diff --git a/cookbooks/chef_nginx/recipes/http_echo_module.rb b/cookbooks/nginx/recipes/http_echo_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/http_echo_module.rb rename to cookbooks/nginx/recipes/http_echo_module.rb diff --git a/cookbooks/chef_nginx/recipes/http_geoip_module.rb b/cookbooks/nginx/recipes/http_geoip_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/http_geoip_module.rb rename to cookbooks/nginx/recipes/http_geoip_module.rb diff --git a/cookbooks/chef_nginx/recipes/http_gzip_static_module.rb b/cookbooks/nginx/recipes/http_gzip_static_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/http_gzip_static_module.rb rename to cookbooks/nginx/recipes/http_gzip_static_module.rb diff --git a/cookbooks/chef_nginx/recipes/http_mp4_module.rb b/cookbooks/nginx/recipes/http_mp4_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/http_mp4_module.rb rename to cookbooks/nginx/recipes/http_mp4_module.rb diff --git a/cookbooks/chef_nginx/recipes/http_perl_module.rb b/cookbooks/nginx/recipes/http_perl_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/http_perl_module.rb rename to cookbooks/nginx/recipes/http_perl_module.rb diff --git a/cookbooks/chef_nginx/recipes/http_realip_module.rb b/cookbooks/nginx/recipes/http_realip_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/http_realip_module.rb rename to cookbooks/nginx/recipes/http_realip_module.rb diff --git a/cookbooks/chef_nginx/recipes/http_spdy_module.rb b/cookbooks/nginx/recipes/http_spdy_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/http_spdy_module.rb rename to cookbooks/nginx/recipes/http_spdy_module.rb diff --git a/cookbooks/chef_nginx/recipes/http_ssl_module.rb b/cookbooks/nginx/recipes/http_ssl_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/http_ssl_module.rb rename to cookbooks/nginx/recipes/http_ssl_module.rb diff --git a/cookbooks/chef_nginx/recipes/http_stub_status_module.rb b/cookbooks/nginx/recipes/http_stub_status_module.rb similarity index 95% rename from cookbooks/chef_nginx/recipes/http_stub_status_module.rb rename to cookbooks/nginx/recipes/http_stub_status_module.rb index fb3fdbd..7e89dd0 100644 --- a/cookbooks/chef_nginx/recipes/http_stub_status_module.rb +++ b/cookbooks/nginx/recipes/http_stub_status_module.rb @@ -19,7 +19,7 @@ # limitations under the License. # -include_recipe 'chef_nginx::authorized_ips' +include_recipe 'nginx::authorized_ips' template 'nginx_status' do path "#{node['nginx']['dir']}/sites-available/nginx_status" diff --git a/cookbooks/chef_nginx/recipes/http_v2_module.rb b/cookbooks/nginx/recipes/http_v2_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/http_v2_module.rb rename to cookbooks/nginx/recipes/http_v2_module.rb diff --git a/cookbooks/chef_nginx/recipes/ipv6.rb b/cookbooks/nginx/recipes/ipv6.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/ipv6.rb rename to cookbooks/nginx/recipes/ipv6.rb diff --git a/cookbooks/chef_nginx/recipes/lua.rb b/cookbooks/nginx/recipes/lua.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/lua.rb rename to cookbooks/nginx/recipes/lua.rb diff --git a/cookbooks/chef_nginx/recipes/naxsi_module.rb b/cookbooks/nginx/recipes/naxsi_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/naxsi_module.rb rename to cookbooks/nginx/recipes/naxsi_module.rb diff --git a/cookbooks/chef_nginx/recipes/ngx_devel_module.rb b/cookbooks/nginx/recipes/ngx_devel_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/ngx_devel_module.rb rename to cookbooks/nginx/recipes/ngx_devel_module.rb diff --git a/cookbooks/chef_nginx/recipes/ngx_lua_module.rb b/cookbooks/nginx/recipes/ngx_lua_module.rb similarity index 94% rename from cookbooks/chef_nginx/recipes/ngx_lua_module.rb rename to cookbooks/nginx/recipes/ngx_lua_module.rb index 25c09c6..083d8e1 100644 --- a/cookbooks/chef_nginx/recipes/ngx_lua_module.rb +++ b/cookbooks/nginx/recipes/ngx_lua_module.rb @@ -40,5 +40,5 @@ end node.run_state['nginx_configure_flags'] = node.run_state['nginx_configure_flags'] | ["--add-module=#{lua_extract_path}/lua-nginx-module-#{node['nginx']['lua']['version']}"] -include_recipe 'chef_nginx::lua' -include_recipe 'chef_nginx::ngx_devel_module' +include_recipe 'nginx::lua' +include_recipe 'nginx::ngx_devel_module' diff --git a/cookbooks/chef_nginx/recipes/ohai_plugin.rb b/cookbooks/nginx/recipes/ohai_plugin.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/ohai_plugin.rb rename to cookbooks/nginx/recipes/ohai_plugin.rb diff --git a/cookbooks/chef_nginx/recipes/openssl_source.rb b/cookbooks/nginx/recipes/openssl_source.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/openssl_source.rb rename to cookbooks/nginx/recipes/openssl_source.rb diff --git a/cookbooks/chef_nginx/recipes/package.rb b/cookbooks/nginx/recipes/package.rb similarity index 80% rename from cookbooks/chef_nginx/recipes/package.rb rename to cookbooks/nginx/recipes/package.rb index f39b375..461aaa6 100644 --- a/cookbooks/chef_nginx/recipes/package.rb +++ b/cookbooks/nginx/recipes/package.rb @@ -18,7 +18,7 @@ # limitations under the License. # -include_recipe 'chef_nginx::ohai_plugin' +include_recipe 'nginx::ohai_plugin' if node['nginx']['ohai_plugin_enabled'] case node['nginx']['repo_source'] when 'epel' @@ -28,11 +28,11 @@ when 'epel' Chef::Log.warn("node['nginx']['repo_source'] set to EPEL, but not running on a RHEL platform so skipping EPEL setup") end when 'nginx' - include_recipe 'chef_nginx::repo' + include_recipe 'nginx::repo' package_install_opts = '--disablerepo=* --enablerepo=nginx' if platform_family?('rhel') when 'passenger' if platform_family?('debian') - include_recipe 'chef_nginx::repo_passenger' + include_recipe 'nginx::repo_passenger' else Chef::Log.warn("node['nginx']['repo_source'] set to passenger, but not running on a Debian based platform so skipping repo setup") end @@ -42,12 +42,16 @@ end package node['nginx']['package_name'] do options package_install_opts - notifies :reload, 'ohai[reload_nginx]', :immediately + notifies :reload, 'ohai[reload_nginx]', :immediately if node['nginx']['ohai_plugin_enabled'] +end + +include_recipe 'nginx::commons' + +if node['nginx']['repo_source'] == 'passenger' + include_recipe 'nginx::passenger' end service 'nginx' do supports status: true, restart: true, reload: true action [:start, :enable] end - -include_recipe 'chef_nginx::commons' diff --git a/cookbooks/chef_nginx/recipes/pagespeed_module.rb b/cookbooks/nginx/recipes/pagespeed_module.rb similarity index 95% rename from cookbooks/chef_nginx/recipes/pagespeed_module.rb rename to cookbooks/nginx/recipes/pagespeed_module.rb index bf2975b..2793807 100644 --- a/cookbooks/chef_nginx/recipes/pagespeed_module.rb +++ b/cookbooks/nginx/recipes/pagespeed_module.rb @@ -22,7 +22,7 @@ remote_file psol_src_filepath do end package_array = value_for_platform_family( - %w(rhel amazon) => node['nginx']['pagespeed']['packages']['rhel'], + %w(rhel amazon) => node['nginx']['pagespeed']['packages']['rhel'], %w(debian) => node['nginx']['pagespeed']['packages']['debian'] ) diff --git a/cookbooks/chef_nginx/recipes/passenger.rb b/cookbooks/nginx/recipes/passenger.rb similarity index 96% rename from cookbooks/chef_nginx/recipes/passenger.rb rename to cookbooks/nginx/recipes/passenger.rb index dd7eda1..4709dd0 100644 --- a/cookbooks/chef_nginx/recipes/passenger.rb +++ b/cookbooks/nginx/recipes/passenger.rb @@ -51,7 +51,7 @@ elsif node['nginx']['passenger']['install_method'] == 'source' end -template "#{node['nginx']['dir']}/conf.d/passenger.conf" do +template node['nginx']['passenger']['conf_file'] do source 'modules/passenger.conf.erb' notifies :reload, 'service[nginx]', :delayed end diff --git a/cookbooks/chef_nginx/recipes/repo.rb b/cookbooks/nginx/recipes/repo.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/repo.rb rename to cookbooks/nginx/recipes/repo.rb diff --git a/cookbooks/chef_nginx/recipes/repo_passenger.rb b/cookbooks/nginx/recipes/repo_passenger.rb similarity index 96% rename from cookbooks/chef_nginx/recipes/repo_passenger.rb rename to cookbooks/nginx/recipes/repo_passenger.rb index e1a54cd..3886393 100644 --- a/cookbooks/chef_nginx/recipes/repo_passenger.rb +++ b/cookbooks/nginx/recipes/repo_passenger.rb @@ -26,10 +26,9 @@ if platform_family?('debian') keyserver 'keyserver.ubuntu.com' key '561F9B9CAC40B2F7' end - - include_recipe 'chef_nginx::passenger' else log "There is not official phusion passenger repo platform #{node['platform']}. Skipping repo setup!" do level :warn end end + diff --git a/cookbooks/chef_nginx/recipes/set_misc.rb b/cookbooks/nginx/recipes/set_misc.rb similarity index 95% rename from cookbooks/chef_nginx/recipes/set_misc.rb rename to cookbooks/nginx/recipes/set_misc.rb index e38e5f7..f09097c 100644 --- a/cookbooks/chef_nginx/recipes/set_misc.rb +++ b/cookbooks/nginx/recipes/set_misc.rb @@ -24,4 +24,4 @@ end node.run_state['nginx_configure_flags'] = node.run_state['nginx_configure_flags'] | ["--add-module=#{set_misc_extract_path}/set-misc-nginx-module-#{node['nginx']['set_misc']['version']}"] -include_recipe 'chef_nginx::ngx_devel_module' +include_recipe 'nginx::ngx_devel_module' diff --git a/cookbooks/chef_nginx/recipes/socketproxy.rb b/cookbooks/nginx/recipes/socketproxy.rb similarity index 94% rename from cookbooks/chef_nginx/recipes/socketproxy.rb rename to cookbooks/nginx/recipes/socketproxy.rb index 292142f..1415a18 100644 --- a/cookbooks/chef_nginx/recipes/socketproxy.rb +++ b/cookbooks/nginx/recipes/socketproxy.rb @@ -1,4 +1,4 @@ -include_recipe 'chef_nginx::commons_dir' +include_recipe 'nginx::commons_dir' directory node['nginx']['socketproxy']['root'] do owner node['nginx']['socketproxy']['app_owner'] diff --git a/cookbooks/chef_nginx/recipes/source.rb b/cookbooks/nginx/recipes/source.rb similarity index 90% rename from cookbooks/chef_nginx/recipes/source.rb rename to cookbooks/nginx/recipes/source.rb index 66f79bf..2e17e27 100644 --- a/cookbooks/chef_nginx/recipes/source.rb +++ b/cookbooks/nginx/recipes/source.rb @@ -29,22 +29,23 @@ node.normal['nginx']['daemon_disable'] = true user node['nginx']['user'] do system true shell '/bin/false' - home '/var/www' + home node['nginx']['user_home'] + manage_home true not_if { node['nginx']['source']['use_existing_user'] } end -include_recipe 'chef_nginx::ohai_plugin' -include_recipe 'chef_nginx::commons_dir' -include_recipe 'chef_nginx::commons_script' -include_recipe 'build-essential::default' +include_recipe 'nginx::ohai_plugin' if node['nginx']['ohai_plugin_enabled'] +include_recipe 'nginx::commons_dir' +include_recipe 'nginx::commons_script' +build_essential 'install compilation tools' src_filepath = "#{Chef::Config['file_cache_path']}/nginx-#{node['nginx']['source']['version']}.tar.gz" # install prereqs package value_for_platform_family( - %w(rhel fedora amazon) => %w(pcre-devel openssl-devel tar), + %w(rhel fedora amazon) => %w(pcre-devel openssl-devel tar zlib-devel), %w(suse) => %w(pcre-devel libopenssl-devel tar), - %w(debian) => %w(libpcre3 libpcre3-dev libssl-dev tar) + %w(debian) => %w(libpcre3 libpcre3-dev libssl-dev tar zlib1g-dev) ) remote_file 'nginx source' do @@ -60,7 +61,7 @@ node.run_state['nginx_configure_flags'] = node['nginx']['source']['default_configure_flags'] | node['nginx']['configure_flags'] node.run_state['nginx_source_env'] = {} -include_recipe 'chef_nginx::commons_conf' +include_recipe 'nginx::commons_conf' cookbook_file "#{node['nginx']['dir']}/mime.types" do source 'mime.types' @@ -102,7 +103,7 @@ bash 'compile_nginx_source' do end notifies :restart, 'service[nginx]' - notifies :reload, 'ohai[reload_nginx]', :immediately + notifies :reload, 'ohai[reload_nginx]', :immediately if node['nginx']['ohai_plugin_enabled'] end case node['nginx']['init_style'] diff --git a/cookbooks/chef_nginx/recipes/syslog_module.rb b/cookbooks/nginx/recipes/syslog_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/syslog_module.rb rename to cookbooks/nginx/recipes/syslog_module.rb diff --git a/cookbooks/chef_nginx/recipes/upload_progress_module.rb b/cookbooks/nginx/recipes/upload_progress_module.rb similarity index 100% rename from cookbooks/chef_nginx/recipes/upload_progress_module.rb rename to cookbooks/nginx/recipes/upload_progress_module.rb diff --git a/cookbooks/nginx/resources/cleanup_runit.rb b/cookbooks/nginx/resources/cleanup_runit.rb new file mode 100644 index 0000000..cb75b63 --- /dev/null +++ b/cookbooks/nginx/resources/cleanup_runit.rb @@ -0,0 +1,36 @@ +# +# Copyright:: 20017-2018, Chef Software, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +action :cleanup do + # remove old init script link + file 'remove symlinked runit init script' do + path '/etc/init.d/nginx' + manage_symlink_source false # nuke the link not the runit binary + action :delete + only_if { ::File.exist?('/etc/init.d/nginx') && ::File.symlink?('/etc/init.d/nginx') && ::File.realpath('/etc/init.d/nginx') == '/usr/bin/sv' } + end + + execute 'kill old nginx process' do + command 'pkill nginx' + returns [0, 1] # ignores failures + not_if { !::File.exist?('/etc/sv/nginx/supervise/pid') || ::File.zero?('/etc/sv/nginx/supervise/pid') } + end + + # remove the old service configs + directory '/etc/sv/nginx' do + recursive true + action :delete + end +end diff --git a/cookbooks/chef_nginx/resources/site.rb b/cookbooks/nginx/resources/site.rb similarity index 85% rename from cookbooks/chef_nginx/resources/site.rb rename to cookbooks/nginx/resources/site.rb index b597036..65c8e0a 100644 --- a/cookbooks/chef_nginx/resources/site.rb +++ b/cookbooks/nginx/resources/site.rb @@ -20,9 +20,7 @@ # limitations under the License. # -provides :nginx_site - -property :name, String, name_property: true +property :site_name, String, name_property: true property :variables, Hash, default: {} property :cookbook, String property :template, [String, Array] @@ -41,7 +39,7 @@ action :enable do if new_resource.template # use declare_resource so we can have a property also named template - declare_resource(:template, "#{node['nginx']['dir']}/sites-available/#{new_resource.name}") do + declare_resource(:template, "#{node['nginx']['dir']}/sites-available/#{new_resource.site_name}") do source new_resource.template cookbook new_resource.cookbook variables(new_resource.variables) @@ -49,29 +47,29 @@ action :enable do end end - execute "nxensite #{new_resource.name}" do - command "#{node['nginx']['script_dir']}/nxensite #{new_resource.name}" + execute "nxensite #{new_resource.site_name}" do + command "#{node['nginx']['script_dir']}/nxensite #{new_resource.site_name}" notifies :reload, 'service[nginx]' not_if do - ::File.symlink?("#{node['nginx']['dir']}/sites-enabled/#{new_resource.name}") || - ::File.symlink?("#{node['nginx']['dir']}/sites-enabled/000-#{new_resource.name}") + ::File.symlink?("#{node['nginx']['dir']}/sites-enabled/#{new_resource.site_name}") || + ::File.symlink?("#{node['nginx']['dir']}/sites-enabled/000-#{new_resource.site_name}") end end end action :disable do - execute "nxdissite #{new_resource.name}" do - command "#{node['nginx']['script_dir']}/nxdissite #{new_resource.name}" + execute "nxdissite #{new_resource.site_name}" do + command "#{node['nginx']['script_dir']}/nxdissite #{new_resource.site_name}" notifies :reload, 'service[nginx]' only_if do - ::File.symlink?("#{node['nginx']['dir']}/sites-enabled/#{new_resource.name}") || - ::File.symlink?("#{node['nginx']['dir']}/sites-enabled/000-#{new_resource.name}") + ::File.symlink?("#{node['nginx']['dir']}/sites-enabled/#{new_resource.site_name}") || + ::File.symlink?("#{node['nginx']['dir']}/sites-enabled/000-#{new_resource.site_name}") end end # The nginx.org packages store the default site at /etc/nginx/conf.d/default.conf and our # normal script doesn't disable these. - if new_resource.name == 'default' && ::File.exist?('/etc/nginx/conf.d/default.conf') # ~FC023 + if new_resource.site_name == 'default' && ::File.exist?('/etc/nginx/conf.d/default.conf') # ~FC023 execute 'Move nginx.org package default site config to sites-available' do command "mv /etc/nginx/conf.d/default.conf #{node['nginx']['dir']}/sites-available/default" user 'root' diff --git a/cookbooks/nginx/resources/stream.rb b/cookbooks/nginx/resources/stream.rb new file mode 100644 index 0000000..06ab35c --- /dev/null +++ b/cookbooks/nginx/resources/stream.rb @@ -0,0 +1,65 @@ +# +# Cookbook:: nginx +# Resource:: stream +# +# Copyright:: 2017-2018, David Sieciński +# +# 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. +# + +property :stream_name, String, name_property: true +property :variables, Hash, default: {} +property :cookbook, String +property :template, [String, Array] + +action :enable do + if new_resource.template + # use declare_resource so we can have a property also named template + declare_resource(:template, "#{node['nginx']['dir']}/streams-available/#{new_resource.stream_name}") do + source new_resource.template + cookbook new_resource.cookbook + variables(new_resource.variables) + notifies :reload, 'service[nginx]' + end + end + + execute "nxenstream #{new_resource.stream_name}" do + command "#{node['nginx']['script_dir']}/nxenstream #{new_resource.stream_name}" + notifies :reload, 'service[nginx]' + not_if do + ::File.symlink?("#{node['nginx']['dir']}/streams-enabled/#{new_resource.stream_name}") || + ::File.symlink?("#{node['nginx']['dir']}/streams-enabled/000-#{new_resource.stream_name}") + end + end +end + +action :disable do + execute "nxdisstream #{new_resource.stream_name}" do + command "#{node['nginx']['script_dir']}/nxdisstream #{new_resource.stream_name}" + notifies :reload, 'service[nginx]' + only_if do + ::File.symlink?("#{node['nginx']['dir']}/streams-enabled/#{new_resource.stream_name}") || + ::File.symlink?("#{node['nginx']['dir']}/streams-enabled/000-#{new_resource.stream_name}") + end + end + + # The nginx.org packages store the default stream at /etc/nginx/conf.d/default.conf and our + # normal script doesn't disable these. + if new_resource.stream_name == 'default' && ::File.exist?('/etc/nginx/conf.d/default.conf') # ~FC023 + execute 'Move nginx.org package default stream config to streams-available' do + command "mv /etc/nginx/conf.d/default.conf #{node['nginx']['dir']}/streams-available/default" + user 'root' + notifies :reload, 'service[nginx]' + end + end +end diff --git a/cookbooks/chef_nginx/templates/debian/nginx.init.erb b/cookbooks/nginx/templates/debian/nginx.init.erb similarity index 100% rename from cookbooks/chef_nginx/templates/debian/nginx.init.erb rename to cookbooks/nginx/templates/debian/nginx.init.erb diff --git a/cookbooks/chef_nginx/templates/default/default-site.erb b/cookbooks/nginx/templates/default/default-site.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/default-site.erb rename to cookbooks/nginx/templates/default/default-site.erb diff --git a/cookbooks/chef_nginx/templates/default/modules/authorized_ip.erb b/cookbooks/nginx/templates/default/modules/authorized_ip.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/modules/authorized_ip.erb rename to cookbooks/nginx/templates/default/modules/authorized_ip.erb diff --git a/cookbooks/chef_nginx/templates/default/modules/http_geoip.conf.erb b/cookbooks/nginx/templates/default/modules/http_geoip.conf.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/modules/http_geoip.conf.erb rename to cookbooks/nginx/templates/default/modules/http_geoip.conf.erb diff --git a/cookbooks/chef_nginx/templates/default/modules/http_gzip_static.conf.erb b/cookbooks/nginx/templates/default/modules/http_gzip_static.conf.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/modules/http_gzip_static.conf.erb rename to cookbooks/nginx/templates/default/modules/http_gzip_static.conf.erb diff --git a/cookbooks/chef_nginx/templates/default/modules/http_realip.conf.erb b/cookbooks/nginx/templates/default/modules/http_realip.conf.erb similarity index 72% rename from cookbooks/chef_nginx/templates/default/modules/http_realip.conf.erb rename to cookbooks/nginx/templates/default/modules/http_realip.conf.erb index 032fc8c..0979fd4 100644 --- a/cookbooks/chef_nginx/templates/default/modules/http_realip.conf.erb +++ b/cookbooks/nginx/templates/default/modules/http_realip.conf.erb @@ -2,6 +2,4 @@ set_real_ip_from <%= address %>; <% end -%> real_ip_header <%= node['nginx']['realip']['header'] %>; -<% if NginxVersion.new(node['nginx']['version']) >= NginxVersion.new('1.2') -%> real_ip_recursive <%= node['nginx']['realip']['real_ip_recursive'] %>; -<% end -%> diff --git a/cookbooks/chef_nginx/templates/default/modules/nginx_status.erb b/cookbooks/nginx/templates/default/modules/nginx_status.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/modules/nginx_status.erb rename to cookbooks/nginx/templates/default/modules/nginx_status.erb diff --git a/cookbooks/chef_nginx/templates/default/modules/passenger.conf.erb b/cookbooks/nginx/templates/default/modules/passenger.conf.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/modules/passenger.conf.erb rename to cookbooks/nginx/templates/default/modules/passenger.conf.erb diff --git a/cookbooks/chef_nginx/templates/default/modules/socketproxy.conf.erb b/cookbooks/nginx/templates/default/modules/socketproxy.conf.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/modules/socketproxy.conf.erb rename to cookbooks/nginx/templates/default/modules/socketproxy.conf.erb diff --git a/cookbooks/chef_nginx/templates/default/modules/upload_progress.erb b/cookbooks/nginx/templates/default/modules/upload_progress.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/modules/upload_progress.erb rename to cookbooks/nginx/templates/default/modules/upload_progress.erb diff --git a/cookbooks/chef_nginx/templates/default/nginx-upstart.conf.erb b/cookbooks/nginx/templates/default/nginx-upstart.conf.erb similarity index 91% rename from cookbooks/chef_nginx/templates/default/nginx-upstart.conf.erb rename to cookbooks/nginx/templates/default/nginx-upstart.conf.erb index fa88f24..9ebafda 100644 --- a/cookbooks/chef_nginx/templates/default/nginx-upstart.conf.erb +++ b/cookbooks/nginx/templates/default/nginx-upstart.conf.erb @@ -29,7 +29,7 @@ console output exec ${DAEMON} -c "${CONFIG}" -<% if node.recipe?('chef_nginx::passenger') && !node['nginx']['upstart']['foreground'] -%> +<% if node.recipe?('nginx::passenger') && !node['nginx']['upstart']['foreground'] -%> # classic example of why pidfiles should have gone away # with the advent of fork(). we missed that bus a long # time ago so hack around it. diff --git a/cookbooks/chef_nginx/templates/default/nginx.conf.erb b/cookbooks/nginx/templates/default/nginx.conf.erb similarity index 83% rename from cookbooks/chef_nginx/templates/default/nginx.conf.erb rename to cookbooks/nginx/templates/default/nginx.conf.erb index 98cb4a8..02e5b53 100644 --- a/cookbooks/chef_nginx/templates/default/nginx.conf.erb +++ b/cookbooks/nginx/templates/default/nginx.conf.erb @@ -12,6 +12,9 @@ worker_shutdown_timeout <%= node['nginx']['worker_shutdown_timeout'] %>; <% node['nginx']['load_modules'].each do |module_to_load| %> load_module <%= module_to_load %>; <% end -%> +<% if node['platform'] == 'ubuntu' && node['platform_version'].to_i >= 18 %> +include /etc/nginx/modules-enabled/*.conf; +<% end -%> error_log <%= node['nginx']['log_dir'] %>/error.log<% if node['nginx']['error_log_options'] %> <%= node['nginx']['error_log_options'] %><% end %>; pid <%= @pid_file %>; @@ -29,7 +32,7 @@ events { } http { - <% if node.recipe?('chef_nginx::naxsi_module') %> + <% if node.recipe?('nginx::naxsi_module') %> include <%= node['nginx']['dir'] %>/naxsi_core.rules; <% end %> @@ -95,6 +98,18 @@ http { <% if node['nginx']['large_client_header_buffers'] -%> large_client_header_buffers <%= node['nginx']['large_client_header_buffers'] %>; <% end -%> + <% if node['nginx']['map_hash_max_size'] -%> + map_hash_max_size <%= node['nginx']['map_hash_max_size'] %>; + <% end -%> + <% if node['nginx']['proxy_buffer_size'] -%> + proxy_buffer_size <%= node['nginx']['proxy_buffer_size'] %>; + <% end -%> + <% if node['nginx']['proxy_buffers'] -%> + proxy_buffers <%= node['nginx']['proxy_buffers'] %>; + <% end -%> + <% if node['nginx']['proxy_busy_buffers_size'] -%> + proxy_busy_buffers_size <%= node['nginx']['proxy_busy_buffers_size'] %>; + <% end -%> <% if node['nginx']['enable_rate_limiting'] -%> limit_req_zone $binary_remote_addr zone=<%= node['nginx']['rate_limiting_zone_name'] %>:<%= node['nginx']['rate_limiting_backoff'] %> rate=<%= node['nginx']['rate_limit'] %>; @@ -107,3 +122,8 @@ http { include <%= node['nginx']['dir'] %>/conf.d/*.conf; include <%= node['nginx']['dir'] %>/sites-enabled/*; } +<% if node['nginx']['install_method'] == 'source' and node['nginx']['configure_flags'].include? '--with-stream' %> +stream{ + include <%= node['nginx']['dir'] %>/streams-enabled/*; +} +<% end %> diff --git a/cookbooks/chef_nginx/templates/default/nginx.init.erb b/cookbooks/nginx/templates/default/nginx.init.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/nginx.init.erb rename to cookbooks/nginx/templates/default/nginx.init.erb diff --git a/cookbooks/chef_nginx/templates/default/nginx.service.erb b/cookbooks/nginx/templates/default/nginx.service.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/nginx.service.erb rename to cookbooks/nginx/templates/default/nginx.service.erb diff --git a/cookbooks/chef_nginx/templates/default/nginx.sysconfig.erb b/cookbooks/nginx/templates/default/nginx.sysconfig.erb similarity index 50% rename from cookbooks/chef_nginx/templates/default/nginx.sysconfig.erb rename to cookbooks/nginx/templates/default/nginx.sysconfig.erb index 3f15788..6b8834f 100644 --- a/cookbooks/chef_nginx/templates/default/nginx.sysconfig.erb +++ b/cookbooks/nginx/templates/default/nginx.sysconfig.erb @@ -1 +1,2 @@ NGINX_GLOBAL=<%= node['nginx']['global'] %> +ULIMIT="-n <%= node['nginx']['ulimit'] %>" diff --git a/cookbooks/chef_nginx/templates/default/nxdissite.erb b/cookbooks/nginx/templates/default/nxdissite.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/nxdissite.erb rename to cookbooks/nginx/templates/default/nxdissite.erb diff --git a/cookbooks/nginx/templates/default/nxdisstream.erb b/cookbooks/nginx/templates/default/nxdisstream.erb new file mode 100644 index 0000000..eb9f05f --- /dev/null +++ b/cookbooks/nginx/templates/default/nxdisstream.erb @@ -0,0 +1,29 @@ +#!/bin/sh -e + +SYSCONFDIR='<%= node['nginx']['dir'] %>' + +if [ -z $1 ]; then + echo "Which stream would you like to disable?" + echo -n "Your choices are: " + ls $SYSCONFDIR/streams-enabled/* | \ + sed -e "s,$SYSCONFDIR/streams-enabled/,,g" | xargs echo + echo -n "Stream name? " + read STREAMNAME +else + STREAMNAME=$1 +fi + +if [ $STREAMNAME = "default" ]; then + PRIORITY="000" +fi + +if ! [ -e $SYSCONFDIR/streams-enabled/$STREAMNAME -o \ + -e $SYSCONFDIR/streams-enabled/"$PRIORITY"-"$STREAMNAME" ]; then + echo "This Stream is already disabled, or does not exist!" + exit 1 +fi + +if ! rm $SYSCONFDIR/streams-enabled/$STREAMNAME 2>/dev/null; then + rm -f $SYSCONFDIR/streams-enabled/"$PRIORITY"-"$STREAMNAME" +fi +echo "Stream $STREAMNAME disabled; reload nginx to disable." diff --git a/cookbooks/chef_nginx/templates/default/nxensite.erb b/cookbooks/nginx/templates/default/nxensite.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/nxensite.erb rename to cookbooks/nginx/templates/default/nxensite.erb diff --git a/cookbooks/nginx/templates/default/nxenstream.erb b/cookbooks/nginx/templates/default/nxenstream.erb new file mode 100644 index 0000000..03ee044 --- /dev/null +++ b/cookbooks/nginx/templates/default/nxenstream.erb @@ -0,0 +1,38 @@ +#!/bin/sh -e + +SYSCONFDIR='<%= node['nginx']['dir'] %>' + +if [ -z $1 ]; then + echo "Which stream would you like to enable?" + echo -n "Your choices are: " + ls $SYSCONFDIR/streams-available/* | \ + sed -e "s,$SYSCONFDIR/streams-available/,,g" | xargs echo + echo -n "Stream name? " + read STREAMNAME +else + STREAMNAME=$1 +fi + +if [ $STREAMNAME = "default" ]; then + PRIORITY="000" +fi + +if [ -e $SYSCONFDIR/streams-enabled/$STREAMNAME -o \ + -e $SYSCONFDIR/streams-enabled/"$PRIORITY"-"$STREAMNAME" ]; then + echo "This stream is already enabled!" + exit 0 +fi + +if ! [ -e $SYSCONFDIR/streams-available/$STREAMNAME ]; then + echo "This stream does not exist!" + exit 1 +fi + +if [ $STREAMNAME = "default" ]; then + ln -sf $SYSCONFDIR/streams-available/$STREAMNAME \ + $SYSCONFDIR/streams-enabled/"$PRIORITY"-"$STREAMNAME" +else + ln -sf $SYSCONFDIR/streams-available/$STREAMNAME $SYSCONFDIR/streams-enabled/$STREAMNAME +fi + +echo "Stream $STREAMNAME installed; reload nginx to enable." diff --git a/cookbooks/chef_nginx/templates/default/plugins/ohai-nginx.rb.erb b/cookbooks/nginx/templates/default/plugins/ohai-nginx.rb.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/plugins/ohai-nginx.rb.erb rename to cookbooks/nginx/templates/default/plugins/ohai-nginx.rb.erb diff --git a/cookbooks/chef_nginx/templates/default/sv-nginx-log-run.erb b/cookbooks/nginx/templates/default/sv-nginx-log-run.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/sv-nginx-log-run.erb rename to cookbooks/nginx/templates/default/sv-nginx-log-run.erb diff --git a/cookbooks/chef_nginx/templates/default/sv-nginx-run.erb b/cookbooks/nginx/templates/default/sv-nginx-run.erb similarity index 100% rename from cookbooks/chef_nginx/templates/default/sv-nginx-run.erb rename to cookbooks/nginx/templates/default/sv-nginx-run.erb diff --git a/cookbooks/chef_nginx/templates/ubuntu/nginx.init.erb b/cookbooks/nginx/templates/ubuntu/nginx.init.erb similarity index 100% rename from cookbooks/chef_nginx/templates/ubuntu/nginx.init.erb rename to cookbooks/nginx/templates/ubuntu/nginx.init.erb diff --git a/cookbooks/tar/.foodcritic b/cookbooks/tar/.foodcritic deleted file mode 100644 index b9f8767..0000000 --- a/cookbooks/tar/.foodcritic +++ /dev/null @@ -1 +0,0 @@ -~FC016 diff --git a/cookbooks/tar/CHANGELOG.md b/cookbooks/tar/CHANGELOG.md index 7a0fc5f..4cdd05a 100644 --- a/cookbooks/tar/CHANGELOG.md +++ b/cookbooks/tar/CHANGELOG.md @@ -2,6 +2,22 @@ This file is used to list changes made in each version of the tar cookbook. +## 2.2.0 (2018-07-24) + +- Enable FC016 again +- Use dokken and swap opensuse 13 testing for debian 9 +- GH-42 Fix opensuse image name in .kitchen.yml +- GH-42 Add freebsd 10 and 11 to tested platforms +- GH-42 Skip tar package install on freebsd +- GH-42 Fix default group name in tar_extract +- GH-42 Ensure src_dir exists in tar_package +- GH-42 Use short options for make command +- GH-42 Use latest nano for testing purposes +- GH-42 Add freebsd to supported platforms list +- Update creates parameter to reflect what gets extracted by resource. +- Remove chefspec matchers that are autogenerated +- Use build_essential resource instead of the recipe + ## 2.1.1 (2017-06-13) - Fix metadata source and issues links. diff --git a/cookbooks/tar/MAINTAINERS.md b/cookbooks/tar/MAINTAINERS.md deleted file mode 100644 index 645ed14..0000000 --- a/cookbooks/tar/MAINTAINERS.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# Maintainers - -This file lists how this cookbook project is maintained. When making changes to the system, this file tells you who needs to review your patch - you need a review from an existing maintainer for the cookbook to provide a :+1: on your pull request. Additionally, you need to not receive a veto from a Lieutenant or the Project Lead. - -Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) for details on the process and how to become a maintainer or the project lead. - -# Project Maintainer -* [Tim Smith](https://github.com/tas50) - -# Maintainers -* [Jennifer Davis](https://github.com/sigje) -* [Tim Smith](https://github.com/tas50) -* [Thom May](https://github.com/thommay) diff --git a/cookbooks/tar/README.md b/cookbooks/tar/README.md index b0d8f00..d5f9644 100644 --- a/cookbooks/tar/README.md +++ b/cookbooks/tar/README.md @@ -4,24 +4,37 @@ Installs tar and includes resources for managing remote tar files. `tar_package` handles remote source package compilation. `tar_extract` handles retrieving remote tar files and extracting them locally. +## Requirements + +### Platforms + +- Debian / Ubuntu derivatives +- RHEL and derivatives +- openSUSE / SUSE Linux Enterprises +- FreeBSD + +### Chef + +- Chef 12.7+ + ## Resources ### tar_package -A `tar_package` LWRP provides an easy way to download remote files and compile and install them. This only works for the most basic Autoconf programs that can do `./configure && make && make install`. +The `tar_package` resource provides an easy way to download remote files and compile and install them. This only works for the most basic Autoconf programs that can do `./configure && make && make install`. #### Actions -- :install: Installs the package +- `install` Installs the package #### Properties -- source: name attribute. The source remote URL. -- prefix: Directory to be used as the `--prefix` configure flag. -- source_directory: Directory to which source files are download. -- creates: A file this command creates - if the file exists, the command will not be run. -- configure_flags: Array of additional flags to be passed to `./configure`. -- archive_name: Specify a different name for the downloaded archive. Use it if the directory name inside the tar file is different than the name defined in the URL. Additionally, `tar_package` supports most `remote_file` [attributes](https://docs.chef.io/chef/resources.html#remote-file). +- `source`: name attribute. The source remote URL. +- `prefix`: Directory to be used as the `--prefix` configure flag. +- `source_directory`: Directory to which source files are downloaded. +- `creates`: prevent the command from running when the specified file already exists. +- `configure_flags`: Array of additional flags to be passed to `./configure`. +- `archive_name`: Specify a different name for the downloaded archive. Use it if the directory name inside the tar file is different than the name defined in the URL. Additionally, `tar_package` supports most `remote_file` [attributes](https://docs.chef.io/chef/resources.html#remote-file). #### Example @@ -36,23 +49,23 @@ This will download, compile, and install the package from the given URL and inst ### tar_extract -A `tar_extract` LWRP provides an easy way to download remote tar files and extract them to a local directory. +The `tar_extract` resource provides an easy way to extract tar files from downloaded or local files. #### Actions -- :extract: Extracts the tar file from a url -- :extract_local: Extracts the tar file from a local file path +- `extract` Extracts the tar file from a url +- `extract_local` Extracts the tar file from a local file path #### Properties -- source: name attribute. The source remote URL. -- target_dir: Directory to extract into, e.g. tar xzf -C (target_dir) -- download_dir: Directory to which tarball is downloaded (defaults to chef cache which requires root `group` and `user`). -- creates: A file this command creates - if the file exists, the command will not be run. -- compress_char: Flag for compression type, such as `z` for `gzip`. `man tar` for options. -- tar_flags: Array of additional flags to be passed to tar xzf command. -- group: Group name or group ID to extract the archive under. If set to non-root group, point to a `download_dir` the group has permission to access. -- user: User name or user ID to extract the archive under. If set to non-root user, point to a `download_dir` the user has permission to access. Additionally, `tar_extract` supports most `remote_file` [attributes](https://docs.chef.io/chef/resources.html#remote-file). +- `source`: name attribute. The source remote URL. +- `target_dir`: Directory to extract into, e.g. tar xzf -C (target_dir) +- `download_dir`: Directory to which tarball is downloaded (defaults to chef cache which requires root `group` and `user`). +- `creates`: prevent the command from running when the specified file already exists. +- `compress_char`: Flag for compression type, such as `z` for `gzip`. `man tar` for options. +- `tar_flags`: Array of additional flags to be passed to tar xzf command. +- `group`: Group name or group ID to extract the archive under. If set to non-root group, point to a `download_dir` the group has permission to access. +- `user`: User name or user ID to extract the archive under. If set to non-root user, point to a `download_dir` the user has permission to access. Additionally, `tar_extract` supports most `remote_file` [attributes](https://docs.chef.io/chef/resources.html#remote-file). #### Example @@ -76,20 +89,27 @@ end This will extract the contents of /tmp/mycode-1.2.3.tar.gz to /opt/myapp/mycode and use the file '/opt/myapp/mycode/lib' to determine idempotency. -## ChefSpec Matchers - -ChefSpec matchers are defined for tar_package and tar_extract. - ## LICENSE AND AUTHOR -Author:: Nathan L Smith ([nathan@cramerdev.com](mailto:nathan@cramerdev.com)) Author:: George Miranda ([gmiranda@chef.io](mailto:gmiranda@chef.io)) Author:: Mark Van de Vyver ([mark@@taqtiqa.com](mailto:mark@@taqtiqa.com)) +- **Author:** Nathan L Smith ([nathan@cramerdev.com](mailto:nathan@cramerdev.com)) +- **Author:** George Miranda ([gmiranda@chef.io](mailto:gmiranda@chef.io)) +- **Author:** Mark Van de Vyver ([mark@@taqtiqa.com](mailto:mark@taqtiqa.com)) -Copyright 2011, Cramer Development, Inc. Copyright 2011, Opscode, Inc. Copyright 2013, TAQTIQA LLC. +```text -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 +Copyright: 2011, Cramer Development, Inc. +Copyright: 2013, TAQTIQA LLC. +Copyright: 2011-2017, Chef Software, Inc +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. ``` -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/cookbooks/tar/libraries/matchers.rb b/cookbooks/tar/libraries/matchers.rb deleted file mode 100644 index ac9904c..0000000 --- a/cookbooks/tar/libraries/matchers.rb +++ /dev/null @@ -1,16 +0,0 @@ -if defined?(ChefSpec) - ChefSpec.define_matcher :tar_package - ChefSpec.define_matcher :tar_extract - - def install_tar_package(source) - ChefSpec::Matchers::ResourceMatcher.new(:tar_package, :install, source) - end - - def extract_tar_extract(source) - ChefSpec::Matchers::ResourceMatcher.new(:tar_extract, :extract, source) - end - - def extract_local_tar_extract(source) - ChefSpec::Matchers::ResourceMatcher.new(:tar_extract, :extract_local, source) - end -end diff --git a/cookbooks/tar/metadata.json b/cookbooks/tar/metadata.json index 21c367e..50de2cd 100644 --- a/cookbooks/tar/metadata.json +++ b/cookbooks/tar/metadata.json @@ -1 +1 @@ -{"name":"tar","version":"2.1.1","description":"Installs tar and two resources to manage remote tar packages","long_description":"# tar Cookbook\n\n[![Build Status](https://travis-ci.org/chef-cookbooks/tar.svg?branch=master)](https://travis-ci.org/chef-cookbooks/tar) [![Cookbook Version](https://img.shields.io/cookbook/v/tar.svg)](https://supermarket.chef.io/cookbooks/tar)\n\nInstalls tar and includes resources for managing remote tar files. `tar_package` handles remote source package compilation. `tar_extract` handles retrieving remote tar files and extracting them locally.\n\n## Resources\n\n### tar_package\n\nA `tar_package` LWRP provides an easy way to download remote files and compile and install them. This only works for the most basic Autoconf programs that can do `./configure && make && make install`.\n\n#### Actions\n\n- :install: Installs the package\n\n#### Properties\n\n- source: name attribute. The source remote URL.\n- prefix: Directory to be used as the `--prefix` configure flag.\n- source_directory: Directory to which source files are download.\n- creates: A file this command creates - if the file exists, the command will not be run.\n- configure_flags: Array of additional flags to be passed to `./configure`.\n- archive_name: Specify a different name for the downloaded archive. Use it if the directory name inside the tar file is different than the name defined in the URL. Additionally, `tar_package` supports most `remote_file` [attributes](https://docs.chef.io/chef/resources.html#remote-file).\n\n#### Example\n\n```\ntar_package 'http://pgfoundry.org/frs/download.php/1446/pgpool-3.4.1.tar.gz' do\n prefix '/usr/local'\n creates '/usr/local/bin/pgpool'\nend\n```\n\nThis will download, compile, and install the package from the given URL and install it into /usr/local.\n\n### tar_extract\n\nA `tar_extract` LWRP provides an easy way to download remote tar files and extract them to a local directory.\n\n#### Actions\n\n- :extract: Extracts the tar file from a url\n- :extract_local: Extracts the tar file from a local file path\n\n#### Properties\n\n- source: name attribute. The source remote URL.\n- target_dir: Directory to extract into, e.g. tar xzf -C (target_dir)\n- download_dir: Directory to which tarball is downloaded (defaults to chef cache which requires root `group` and `user`).\n- creates: A file this command creates - if the file exists, the command will not be run.\n- compress_char: Flag for compression type, such as `z` for `gzip`. `man tar` for options.\n- tar_flags: Array of additional flags to be passed to tar xzf command.\n- group: Group name or group ID to extract the archive under. If set to non-root group, point to a `download_dir` the group has permission to access.\n- user: User name or user ID to extract the archive under. If set to non-root user, point to a `download_dir` the user has permission to access. Additionally, `tar_extract` supports most `remote_file` [attributes](https://docs.chef.io/chef/resources.html#remote-file).\n\n#### Example\n\n```\ntar_extract 'http://dev.mycoderepo.com/artifacts/mycode-1.2.3.tar.gz' do\n target_dir '/opt/myapp/mycode'\n creates '/opt/myapp/mycode/lib'\n tar_flags [ '-P', '--strip-components 1' ]\nend\n```\n\nThis will download the tarball to cache, extract the contents to /opt/myapp/mycode, use the file '/opt/myapp/mycode/lib' to determine idempotency, and pass both '-P' and '--strip-components 1' flags to the tar xzf command.\n\n```\ntar_extract '/tmp/mycode-1.2.3.tar.gz' do\n action :extract_local\n target_dir '/opt/myapp/mycode'\n creates '/opt/myapp/mycode/lib'\nend\n```\n\nThis will extract the contents of /tmp/mycode-1.2.3.tar.gz to /opt/myapp/mycode and use the file '/opt/myapp/mycode/lib' to determine idempotency.\n\n## ChefSpec Matchers\n\nChefSpec matchers are defined for tar_package and tar_extract.\n\n## LICENSE AND AUTHOR\n\nAuthor:: Nathan L Smith ([nathan@cramerdev.com](mailto:nathan@cramerdev.com)) Author:: George Miranda ([gmiranda@chef.io](mailto:gmiranda@chef.io)) Author:: Mark Van de Vyver ([mark@@taqtiqa.com](mailto:mark@@taqtiqa.com))\n\nCopyright 2011, Cramer Development, Inc. Copyright 2011, Opscode, Inc. Copyright 2013, TAQTIQA LLC.\n\nLicensed 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\n\n```\nhttp://www.apache.org/licenses/LICENSE-2.0\n```\n\nUnless 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.\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"ubuntu":">= 0.0.0","debian":">= 0.0.0","redhat":">= 0.0.0","centos":">= 0.0.0","suse":">= 0.0.0","opensuse":">= 0.0.0","opensuseleap":">= 0.0.0","scientific":">= 0.0.0","oracle":">= 0.0.0","amazon":">= 0.0.0","zlinux":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/tar","issues_url":"https://github.com/chef-cookbooks/tar/issues","chef_version":[[">= 12.7"]],"ohai_version":[]} \ No newline at end of file +{"name":"tar","version":"2.2.0","description":"Installs tar and two resources to manage remote tar packages","long_description":"# tar Cookbook\n\n[![Build Status](https://travis-ci.org/chef-cookbooks/tar.svg?branch=master)](https://travis-ci.org/chef-cookbooks/tar) [![Cookbook Version](https://img.shields.io/cookbook/v/tar.svg)](https://supermarket.chef.io/cookbooks/tar)\n\nInstalls tar and includes resources for managing remote tar files. `tar_package` handles remote source package compilation. `tar_extract` handles retrieving remote tar files and extracting them locally.\n\n## Requirements\n\n### Platforms\n\n- Debian / Ubuntu derivatives\n- RHEL and derivatives\n- openSUSE / SUSE Linux Enterprises\n- FreeBSD\n\n### Chef\n\n- Chef 12.7+\n\n## Resources\n\n### tar_package\n\nThe `tar_package` resource provides an easy way to download remote files and compile and install them. This only works for the most basic Autoconf programs that can do `./configure && make && make install`.\n\n#### Actions\n\n- `install` Installs the package\n\n#### Properties\n\n- `source`: name attribute. The source remote URL.\n- `prefix`: Directory to be used as the `--prefix` configure flag.\n- `source_directory`: Directory to which source files are downloaded.\n- `creates`: prevent the command from running when the specified file already exists.\n- `configure_flags`: Array of additional flags to be passed to `./configure`.\n- `archive_name`: Specify a different name for the downloaded archive. Use it if the directory name inside the tar file is different than the name defined in the URL. Additionally, `tar_package` supports most `remote_file` [attributes](https://docs.chef.io/chef/resources.html#remote-file).\n\n#### Example\n\n```\ntar_package 'http://pgfoundry.org/frs/download.php/1446/pgpool-3.4.1.tar.gz' do\n prefix '/usr/local'\n creates '/usr/local/bin/pgpool'\nend\n```\n\nThis will download, compile, and install the package from the given URL and install it into /usr/local.\n\n### tar_extract\n\nThe `tar_extract` resource provides an easy way to extract tar files from downloaded or local files.\n\n#### Actions\n\n- `extract` Extracts the tar file from a url\n- `extract_local` Extracts the tar file from a local file path\n\n#### Properties\n\n- `source`: name attribute. The source remote URL.\n- `target_dir`: Directory to extract into, e.g. tar xzf -C (target_dir)\n- `download_dir`: Directory to which tarball is downloaded (defaults to chef cache which requires root `group` and `user`).\n- `creates`: prevent the command from running when the specified file already exists.\n- `compress_char`: Flag for compression type, such as `z` for `gzip`. `man tar` for options.\n- `tar_flags`: Array of additional flags to be passed to tar xzf command.\n- `group`: Group name or group ID to extract the archive under. If set to non-root group, point to a `download_dir` the group has permission to access.\n- `user`: User name or user ID to extract the archive under. If set to non-root user, point to a `download_dir` the user has permission to access. Additionally, `tar_extract` supports most `remote_file` [attributes](https://docs.chef.io/chef/resources.html#remote-file).\n\n#### Example\n\n```\ntar_extract 'http://dev.mycoderepo.com/artifacts/mycode-1.2.3.tar.gz' do\n target_dir '/opt/myapp/mycode'\n creates '/opt/myapp/mycode/lib'\n tar_flags [ '-P', '--strip-components 1' ]\nend\n```\n\nThis will download the tarball to cache, extract the contents to /opt/myapp/mycode, use the file '/opt/myapp/mycode/lib' to determine idempotency, and pass both '-P' and '--strip-components 1' flags to the tar xzf command.\n\n```\ntar_extract '/tmp/mycode-1.2.3.tar.gz' do\n action :extract_local\n target_dir '/opt/myapp/mycode'\n creates '/opt/myapp/mycode/lib'\nend\n```\n\nThis will extract the contents of /tmp/mycode-1.2.3.tar.gz to /opt/myapp/mycode and use the file '/opt/myapp/mycode/lib' to determine idempotency.\n\n## LICENSE AND AUTHOR\n\n- **Author:** Nathan L Smith ([nathan@cramerdev.com](mailto:nathan@cramerdev.com))\n- **Author:** George Miranda ([gmiranda@chef.io](mailto:gmiranda@chef.io))\n- **Author:** Mark Van de Vyver ([mark@@taqtiqa.com](mailto:mark@taqtiqa.com))\n\n```text\n\nCopyright: 2011, Cramer Development, Inc.\nCopyright: 2013, TAQTIQA LLC.\nCopyright: 2011-2017, Chef Software, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"ubuntu":">= 0.0.0","debian":">= 0.0.0","redhat":">= 0.0.0","centos":">= 0.0.0","suse":">= 0.0.0","opensuse":">= 0.0.0","opensuseleap":">= 0.0.0","scientific":">= 0.0.0","oracle":">= 0.0.0","amazon":">= 0.0.0","zlinux":">= 0.0.0","freebsd":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/tar","issues_url":"https://github.com/chef-cookbooks/tar/issues","chef_version":[[">= 12.7"]],"ohai_version":[]} \ No newline at end of file diff --git a/cookbooks/tar/recipes/default.rb b/cookbooks/tar/recipes/default.rb index c80eec2..2301c4b 100644 --- a/cookbooks/tar/recipes/default.rb +++ b/cookbooks/tar/recipes/default.rb @@ -19,4 +19,4 @@ # limitations under the License. # -package 'tar' +package 'tar' unless platform_family?('freebsd') diff --git a/cookbooks/tar/resources/extract.rb b/cookbooks/tar/resources/extract.rb index aa45263..0dd27c6 100644 --- a/cookbooks/tar/resources/extract.rb +++ b/cookbooks/tar/resources/extract.rb @@ -26,7 +26,7 @@ property :source, String, name_property: true property :checksum, String property :download_dir, String, default: Chef::Config[:file_cache_path] -property :group, String, default: 'root' +property :group, String, default: node['root_group'] property :mode, String, default: '0755' property :target_dir, String property :creates, String @@ -54,7 +54,7 @@ action :extract do end remote_file basename do - source r.name + source r.source checksum r.checksum path local_archive backup false @@ -80,6 +80,7 @@ end action_class do def extract_tar(local_archive, r) + directory r.target_dir execute "extract #{local_archive}" do flags = if r.tar_flags.is_a?(String) r.tar_flags diff --git a/cookbooks/tar/resources/package.rb b/cookbooks/tar/resources/package.rb index 104d0dc..1a42a2f 100644 --- a/cookbooks/tar/resources/package.rb +++ b/cookbooks/tar/resources/package.rb @@ -39,6 +39,10 @@ action :install do dirname = basename.chomp('.tar.gz') # Assuming .tar.gz src_dir = r.source_directory + directory src_dir do + recursive true + end + remote_file basename do source r.name path "#{src_dir}/#{basename}" @@ -60,7 +64,7 @@ action :install do execute "compile & install #{dirname}" do flags = [r.prefix ? "--prefix=#{r.prefix}" : nil, *r.configure_flags].compact.join(' ') - command "./configure --quiet #{flags} && make --quiet && make --quiet install" + command "./configure --quiet #{flags} && make -s && make -s install" cwd "#{src_dir}/#{dirname}" creates r.creates end diff --git a/cookbooks/wordpress/metadata.json b/cookbooks/wordpress/metadata.json index bb0ee87..cd87efa 100644 --- a/cookbooks/wordpress/metadata.json +++ b/cookbooks/wordpress/metadata.json @@ -24,7 +24,7 @@ "build-essential": ">= 0.0.0", "iis": ">= 1.6.2", "tar": ">= 0.3.1", - "chef_nginx": ">= 0.0.0", + "nginx": ">= 0.0.0", "php-fpm": ">= 0.0.0", "selinux": "~> 0.7" }, diff --git a/cookbooks/wordpress/metadata.rb b/cookbooks/wordpress/metadata.rb index 603c779..fdcf725 100644 --- a/cookbooks/wordpress/metadata.rb +++ b/cookbooks/wordpress/metadata.rb @@ -20,7 +20,7 @@ depends "mysql2_chef_gem", ">= 1.0.1" depends "build-essential" depends "iis", ">= 1.6.2" depends "tar", ">= 0.3.1" -depends "chef_nginx" +depends "nginx" depends "php-fpm" depends 'selinux', '~> 0.7' diff --git a/cookbooks/wordpress/recipes/nginx.rb b/cookbooks/wordpress/recipes/nginx.rb index 83c32c1..7820a2b 100644 --- a/cookbooks/wordpress/recipes/nginx.rb +++ b/cookbooks/wordpress/recipes/nginx.rb @@ -37,7 +37,7 @@ end include_recipe "php::module_mysql" node.set_unless['nginx']['default_site_enabled'] = false -include_recipe "chef_nginx" +include_recipe "nginx" include_recipe "wordpress::app" diff --git a/cookbooks/zypper/CHANGELOG.md b/cookbooks/zypper/CHANGELOG.md deleted file mode 100644 index 072be23..0000000 --- a/cookbooks/zypper/CHANGELOG.md +++ /dev/null @@ -1,25 +0,0 @@ -# zypper CHANGELOG - -## 0.4.0 - -- [tas50] - Add Whyrun support -- [bluca] - Add repository priority attribute - -## 0.3.0 - -- [tas50] - Add issues_url, source_url, and chef_version to the metadata -- [tas50] - Add Chefspec matchers for the repo LWRP -- [tas50] - Add testing and metadata supports attribute for opensuseleap - -## 0.2.1 - -- [gimler] - Use --non-interactive mode when running zypper refresh - -## 0.2.0 - -- [jarosser06] - Added Key attribute to allow importing a gpg key for a new repo -- [jarosser06] - Renamed alias attribute to repo_name - -## 0.1.0 - -- [jarosser06] - Initial release of zypper diff --git a/cookbooks/zypper/README.md b/cookbooks/zypper/README.md deleted file mode 100644 index c3979ba..0000000 --- a/cookbooks/zypper/README.md +++ /dev/null @@ -1,126 +0,0 @@ -# zypper Cookbook - -Cookbook that provides a lwrp for zypper repositories and also a recipe to install and configure the smt-client for SLES. - -## Requirements - -### Platforms - -- SLES 11+ -- openSUSE 13+ -- openSUSE Leap - -### Chef - -- Chef 11+ - -### Cookbooks - -- none - -## Attributes - -### zypper::smt_client - -Key | Type | Description | Default -------------------------------- | ------ | ------------------- | ------------ -['zypper']['smt_host'] | String | uri of the SMT host | nil - -## Resource/Provider - -## zypper_repo - -### Actions - -- **add** - adds a repo -- **delete** - removes a repo - -### Attributes - -- **repo_name** - repo alias (name attribute) -- **uri** - uri of the repo -- **autorefresh** - enable autorefresh -- **key** - location of repo key to import -- **priority** - priority of the repo - -## Example Usage - -```ruby -zypper_repo 'remove_dvd_repo' do - action :remove - repo_name 'SLES11SP3-x64 DVD1 Online' -end - -zypper_repo 'add_dvd_repo' do - repo_name 'SLES11SP3-x64 DVD1 Online' - uri 'http://demeter.uni-regensburg.de/SLES11SP3-x64/DVD1/' -end - -zypper_repo 'jenkins' do - key 'http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key' - uri 'http://pkg.jenkins-ci.org/opensuse/' -end -``` - -### zypper::smt_client - -Just include `zypper::smt_client` in your node's `run_list` and set the `smt_host` attribute to your smt server: - -```json -{ - "name":"my_node", - "normal": { - "zypper": { - "smt_host": "smt.example.com" - } - }, - "run_list": [ - "recipe[zypper]" - ] -} -``` - -## Testing - -To test with test kitchen you need to have a SLES Vagrant box already on your system(checkout github.com/opscode/bento). In order to test the smt recipe with your smt server set the SMT_HOST env variable to your smt host: - -```shell -export SMT_HOST=smt.example.com -``` - -## Contributing - -1. Fork the repository on Github -2. Create a named feature branch (like `add_component_x`) -3. Write you change -4. Write tests for your change (if applicable) -5. Run the tests, ensuring they all pass -6. Submit a Pull Request using Github - -## License and Authors - -- Author:: Jim Rosser(jarosser06@gmail.com) - -```text -copyright (C) 2014-2016 Jim Rosser - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the “Software”), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of the Software, -and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -``` diff --git a/cookbooks/zypper/attributes/default.rb b/cookbooks/zypper/attributes/default.rb deleted file mode 100644 index 7c4d803..0000000 --- a/cookbooks/zypper/attributes/default.rb +++ /dev/null @@ -1 +0,0 @@ -default['zypper']['smt_host'] = nil diff --git a/cookbooks/zypper/libraries/matchers.rb b/cookbooks/zypper/libraries/matchers.rb deleted file mode 100644 index 7618d98..0000000 --- a/cookbooks/zypper/libraries/matchers.rb +++ /dev/null @@ -1,12 +0,0 @@ - -if defined?(ChefSpec) - ChefSpec.define_matcher :zypper_repo - - def add_zypper_repo(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:zypper_repo, :add, resource_name) - end - - def remove_zypper_repo(resource_name) - ChefSpec::Matchers::ResourceMatcher.new(:zypper_repo, :remove, resource_name) - end -end diff --git a/cookbooks/zypper/metadata.json b/cookbooks/zypper/metadata.json deleted file mode 100644 index b73eb46..0000000 --- a/cookbooks/zypper/metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"zypper","version":"0.4.0","description":"Provides resources for managing zypper repositories","long_description":"# zypper Cookbook\n\nCookbook that provides a lwrp for zypper repositories and also a recipe to install and configure the smt-client for SLES.\n\n## Requirements\n\n### Platforms\n\n- SLES 11+\n- openSUSE 13+\n- openSUSE Leap\n\n### Chef\n\n- Chef 11+\n\n### Cookbooks\n\n- none\n\n## Attributes\n\n### zypper::smt_client\n\nKey | Type | Description | Default\n------------------------------- | ------ | ------------------- | ------------\n['zypper']['smt_host'] | String | uri of the SMT host | nil\n\n## Resource/Provider\n\n## zypper_repo\n\n### Actions\n\n- **add** - adds a repo\n- **delete** - removes a repo\n\n### Attributes\n\n- **repo_name** - repo alias (name attribute)\n- **uri** - uri of the repo\n- **autorefresh** - enable autorefresh\n- **key** - location of repo key to import\n- **priority** - priority of the repo\n\n## Example Usage\n\n```ruby\nzypper_repo 'remove_dvd_repo' do\n action :remove\n repo_name 'SLES11SP3-x64 DVD1 Online'\nend\n\nzypper_repo 'add_dvd_repo' do\n repo_name 'SLES11SP3-x64 DVD1 Online'\n uri 'http://demeter.uni-regensburg.de/SLES11SP3-x64/DVD1/'\nend\n\nzypper_repo 'jenkins' do\n key 'http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key'\n uri 'http://pkg.jenkins-ci.org/opensuse/'\nend\n```\n\n### zypper::smt_client\n\nJust include `zypper::smt_client` in your node's `run_list` and set the `smt_host` attribute to your smt server:\n\n```json\n{\n \"name\":\"my_node\",\n \"normal\": {\n \"zypper\": {\n \"smt_host\": \"smt.example.com\"\n }\n },\n \"run_list\": [\n \"recipe[zypper]\"\n ]\n}\n```\n\n## Testing\n\nTo test with test kitchen you need to have a SLES Vagrant box already on your system(checkout github.com/opscode/bento). In order to test the smt recipe with your smt server set the SMT_HOST env variable to your smt host:\n\n```shell\nexport SMT_HOST=smt.example.com\n```\n\n## Contributing\n\n1. Fork the repository on Github\n2. Create a named feature branch (like `add_component_x`)\n3. Write you change\n4. Write tests for your change (if applicable)\n5. Run the tests, ensuring they all pass\n6. Submit a Pull Request using Github\n\n## License and Authors\n\n- Author:: Jim Rosser(jarosser06@gmail.com)\n\n```text\ncopyright (C) 2014-2016 Jim Rosser\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the “Software”), to deal in the Software without restriction,\nincluding without limitation the rights to use, copy, modify, merge,\npublish, distribute, sublicense, and/or sell copies of the Software,\nand to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n```\n","maintainer":"Jim Rosser","maintainer_email":"jarosser06@gmail.com","license":"MIT","platforms":{"suse":">= 0.0.0","opensuse":">= 0.0.0","opensuseleap":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/jarosser06/chef-zypper","issues_url":"https://github.com/jarosser06/chef-zypper/issues","chef_version":[[">= 11"]],"ohai_version":[]} \ No newline at end of file diff --git a/cookbooks/zypper/providers/repo.rb b/cookbooks/zypper/providers/repo.rb deleted file mode 100644 index 7eaf84d..0000000 --- a/cookbooks/zypper/providers/repo.rb +++ /dev/null @@ -1,68 +0,0 @@ -require 'mixlib/shellout' - -use_inline_resources - -def whyrun_supported? - true -end - -action :add do - unless repo_exist? - converge_by("add zypper repository '#{new_resource.repo_name}'") do - unless new_resource.key.nil? - install_curl - import_key - end - command = 'zypper ar' - command << ' -f' if new_resource.autorefresh - command << " #{new_resource.uri} \"#{new_resource.repo_name}\"" - shellout = Mixlib::ShellOut.new(command, user: 'root').run_command - if shellout.stderr.empty? - set_priority - else - Chef::Log.error("Error adding repo: #{shellout.stderr}") - end - end - end -end - -action :remove do - if repo_exist? - converge_by("remove zypper repository '#{new_resource.repo_name}'") do - command = "zypper rr \"#{new_resource.repo_name}\"" - shellout = Mixlib::ShellOut.new(command, user: 'root').run_command - Chef::Log.error("Error removing repo: #{shellout.stderr}") unless shellout.stderr.empty? - end - end -end - -def repo_exist? - command = "zypper repos | grep \"#{new_resource.repo_name}\"" - shellout = Mixlib::ShellOut.new(command, user: 'root').run_command - if shellout.stdout.empty? - false - else - true - end -end - -def install_curl - # Make sure curl is installed - pkg = Chef::Resource::Package.new('curl', run_context) - pkg.run_action :install -end - -def import_key - cmd = Chef::Resource::Execute.new("import key for #{new_resource.repo_name}", - run_context) - cmd.command "rpm --import #{new_resource.key}" - cmd.run_action :run -end - -def set_priority - return if new_resource.priority.nil? || new_resource.priority <= 0 - command = 'zypper mr' - command << " -p #{new_resource.priority} \"#{new_resource.repo_name}\"" - shellout = Mixlib::ShellOut.new(command, user: 'root').run_command - Chef::Log.error("Error setting repo priority: #{shellout.stderr}") unless shellout.stderr.empty? -end diff --git a/cookbooks/zypper/recipes/default.rb b/cookbooks/zypper/recipes/default.rb deleted file mode 100644 index ecead57..0000000 --- a/cookbooks/zypper/recipes/default.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Cookbook Name:: zypper -# Recipe:: default -# -# Copyright 2014 - 2016, Jim Rosser -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -execute 'zypper_refresh' do - command 'zypper --non-interactive refresh' - user 'root' -end diff --git a/cookbooks/zypper/recipes/smt_client.rb b/cookbooks/zypper/recipes/smt_client.rb deleted file mode 100644 index 75308e6..0000000 --- a/cookbooks/zypper/recipes/smt_client.rb +++ /dev/null @@ -1,50 +0,0 @@ -# -# Cookbook Name:: zypper -# Recipe:: smt_client -# -# Copyright 2014 - 2016, Jim Rosser -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -package 'smt-client' - -client_setup = "#{Chef::Config[:file_cache_path]}/clientSetup4SMT.sh" -register_log = '/root/.suse_register.log' - -remote_file client_setup do - action :create - source "http://#{node['zypper']['smt_host']}/repo/tools/clientSetup4SMT.sh" - mode 0544 - owner 'root' - not_if { ::File.exist? register_log } -end - -execute 'register_smt' do - command "yes | #{client_setup} --host #{node['zypper']['smt_host']}" - user 'root' - creates register_log - notifies :run, 'execute[initial_smt_agent]', :immediately -end - -execute 'initial_smt_agent' do - user 'root' - command 'smt-agent' - action :nothing -end diff --git a/cookbooks/zypper/resources/repo.rb b/cookbooks/zypper/resources/repo.rb deleted file mode 100644 index 2aeb372..0000000 --- a/cookbooks/zypper/resources/repo.rb +++ /dev/null @@ -1,8 +0,0 @@ -actions :add, :remove -default_action :add - -attribute :repo_name, kind_of: String, name_attribute: true -attribute :autorefresh, kind_of: [TrueClass, FalseClass] -attribute :uri, kind_of: String -attribute :key, kind_of: String, default: nil -attribute :priority, kind_of: Integer, default: nil diff --git a/site-cookbooks/kosmos-nginx/metadata.rb b/site-cookbooks/kosmos-nginx/metadata.rb index f3f01df..4f775f0 100644 --- a/site-cookbooks/kosmos-nginx/metadata.rb +++ b/site-cookbooks/kosmos-nginx/metadata.rb @@ -6,6 +6,6 @@ description 'Installs/Configures kosmos-nginx' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.2.0' -depends 'chef_nginx' +depends 'nginx' depends 'firewall' depends 'openssl' diff --git a/site-cookbooks/kosmos-nginx/recipes/default.rb b/site-cookbooks/kosmos-nginx/recipes/default.rb index 7731995..9faa21f 100644 --- a/site-cookbooks/kosmos-nginx/recipes/default.rb +++ b/site-cookbooks/kosmos-nginx/recipes/default.rb @@ -24,7 +24,7 @@ EOF node.override['nginx']['repo_source'] = 'nginx' # Install from official repo node.override['nginx']['upstream_repository'] = "http://nginx.org/packages/mainline/#{node['platform']}" -include_recipe 'chef_nginx' +include_recipe 'nginx' # Generate Strong Diffie-Hellman Group (increases security) # https://weakdh.org/sysadmin.html