Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

nginx_resources (17) Versions 0.5.3

Cookbook to install nginx with resources

Policyfile
Berkshelf
Knife
cookbook 'nginx_resources', '~> 0.5.3', :supermarket
cookbook 'nginx_resources', '~> 0.5.3'
knife supermarket install nginx_resources
knife supermarket download nginx_resources
README
Dependencies
Changelog
Quality 17%

nginx_resources cookbook

Installs nginx and dependant modules from source in a modular fashion.

Requirements

Chef

This cookbook requires Chef 12.7 and above.

Platforms

At present, only Ubuntu < 16.04 is supported, however adding support for other distributions should be a simple matter.

Recipes

The recipes are designed to create a default nginx installation called default and will utilize the resources listed below.

Calling the standard nginx_resources::default recipe will cause the following events to occur:
- recipes/install_user is called
- The www-data user account is optionally created
- recipes/install_common is called
- The nginx_resources_instance[default] resource is created
- A few core and override configuration files are created
- The default site is created and optionally enabled
- The service files are created, but not the actual service due to timing
- recipes/install_modules is called
- We iterate through node['nginx_resources']['source']['include_recipes']
and include recipes listed to install dependencies.
- recipes/install_source is called
- Package dependencies are installed
- The nginx_resources_build[default] resources is created
- recipes/install_service is called
- The service is created and optionally started

Usage

  1. Within your cookbook, define an optional attribute file to customize the nginx_resources attributes to your liking. Each and every configuration parameter used by this cookbook is attribute driven.
  2. Include the nginx_resources::default recipe in your run_list.
  3. Customize the nginx_resources_site[default] resource.

Example

r = resources('nginx_resources_site[default]')
r.root '/var/www/backofficev2/current/public'
r.listen [80, '443 ssl']
r.locations [
{ 'uri' => '/',
'try_files' => '$uri @proxy'
},
{ 'uri' => '/admin/',
'configs' => {
'rewrite' => '^/admin/assets(/?.*)$ /assets$1 last'
},
'try_files' => '$uri @proxy'
},
{ 'uri' => '~\.php',
'configs' => {
'proxy_send_timeout' => 600,
'proxy_read_timeout' => 600
},
'fastcgi_pass' => '127.0.0.1:9000'
},
{ 'uri' => '@proxy',
'configs' => {
'proxy_send_timeout' => 600,
'proxy_read_timeout' => 600
},
'fastcgi_pass' => '127.0.0.1:9000'
}
]
r.includes << 'include.d/fastcgi.conf'
r.includes << 'include.d/stub_status.conf'
r.includes << 'include.d/health.conf'
r.enabled true

Custom Resources

A deployment of nginx is comprised of a number of different resources. First, an nginx_resources_instance is created to define the basic folder structure. Then, any number of nginx_resources_module and nginx_resources_config are created to further customize the deployment. Lastly, a nginx_resources_build resource is created to compile and install nginx.

nginx_resources_instance

This resource builds out the folder structure for a specific deployment of nginx and it's dependant configuration files as well as creates the main configuration file.

Most of the properties have default values which lazilly load node attributes and should not generally need to be modified. Should you need modify them, however, refer to the [source](resources/instance.rb) for more information.

With the default settings, the following structure will be created:

./var
./var/1.10.1
./var/1.10.1/logs
./var/1.10.1/logs/error.log
./var/1.10.1/html
./var/1.10.1/html/50x.html
./var/1.10.1/html/index.html
./var/1.10.1/modules
./var/1.10.1/modules/ndk_http_module.so
./etc
./etc/include.d
./etc/include.d/stub_status.conf
./etc/include.d/fastcgi.conf
./etc/include.d/health.conf
./etc/site.d
./etc/site.d/20-default
./etc/uwsgi_params
./etc/koi-utf
./etc/conf.d
./etc/conf.d/50-ssl_map.conf
./etc/conf.d/50-ssl.conf
./etc/conf.d/50-realip.conf
./etc/conf.d/50-gzip.conf
./etc/conf.d/20-mime_types.conf
./etc/conf.d/90-custom.conf
./etc/conf.d/20-core.conf
./etc/scgi_params
./etc/fastcgi.conf
./etc/nginx.conf
./etc/module.d
./etc/module.d/20-module_ndk.conf
./etc/fastcgi_params
./etc/mime.types
./etc/koi-win
./etc/win-utf
./sbin
./sbin/nginx

nginx_resources_module

This resource downloads an external dependency (ex.: the [lua module](recipes/module_lua.rb)), unpacks it, creates a configuration file for it, and adds the module to the node attributes for the next compile phase. It does so by wrapping nginx_resources_source and nginx_resources_config.

The following properties are required and have no defaults:
- instance: the nginx_resources_instance name this module belongs to
- version: the version of this module
- checksum: the checksum of the tarball to download
- source: the url where the tarball is downloaded from

Once downloaded, the resource will inject the module in the global module configure argument attributes found in node['nginx_resources']['source']['external_modules'].

Further properties, with defaults, may be modified and are referenced in the [source](resources/module.rb) file.

nginx_resources_source

This resource downloads an external dependency (ex.: the [lua module](recipes/module_lua.rb)) and unpacks it.

The following properties are required and have no defaults:
- version: the version of this module
- checksum: the checksum of the tarball to download
- source: the url where the tarball is downloaded from

Further properties, with defaults, may be modified and are referenced in the [source](resources/source.rb) file.

nginx_resources_config

This resource creates a configuration file for use with nginx. Examples of this in practice may be found [here](recipes/install_common.rb).

The following properties are required and have no defaults:
- instance: the nginx_resources_instance name this module belongs to
- category: the namespace both for source and destination files

Further properties, with defaults, may be modified and are referenced in the [source](resources/config.rb) file.

nginx_resources_build

This resource builds the nginx source code for a specific nginx_resources_instance and should be smart enough not to recompile needlessly on each chef run.

The following properties are required and have no defaults:
- root_dir: The root directory containing nginx builds
- sbin_path: The --sbin-path or path to the nginx binary
- conf_path: The --conf-path or path to the main nginx configuration file
- prefix: The --prefix or directory into which to install
- service: The service resource name to notify

Further properties, with defaults, may be modified and are referenced in the [source](resources/build.rb) file.

nginx_resources_maintenance

This resource is designed to create-or-remove a file which the health check looks for when determining if it should return a 503 for maintenance mode.

The following properties are all optional:
- path: The location of the maintenance file, defaults to: node['nginx_resources']['health']['config']['maintenance_override']
- compile_time: Boolean which determins whether to run the action of manage at compile time.
- enable_only_if: A block which must return true/false determining whether maintenance mode should activated.
- disable_only_if: A block which must return true/false determining whether the maintenance mode should be activated.

Further properties, with defaults, may be modified and are referenced in the [source](resources/maintenance.rb) file.

Dependent cookbooks

build-essential ~> 6.0.0
apt >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

nginx_resources cookbook changelog

v0.5.2

  • Resolve typo in healthcheck template

v0.5.1

  • Resolve maintenance mode deletion bug

v0.5.0

  • Add maintenance mode resource

v0.4.2

  • Allow to change the FASTCGI document_root variable

v0.4.1

  • Resolve issue with friendly syslog log format

v0.4.0

  • Update proxy_fastcgi template syntax

v0.3.1

  • Add fastcgi_pass to locations handling

v0.3.0

  • Update installation recipes to split the download and build phases
  • Add ngx lua ssl patch

v0.2.6

  • Resolve issue with lua.so loading
  • Install ngx resty_core which no longer seems to be automatic

v0.2.5

  • Resolve logging syntax issue

v0.2.4

  • Bugfix rubocop errors

v0.2.3

  • Ensure glib module installs the zlib dependencies
  • Ensure health module logs to access log by default
  • Ensure error log logs to main config dir

v0.2.2

  • Update dependencies for build-essential 6

v0.2.1

  • Rubocop you HAVE FAILED ME! Bugfixes

v0.2.0

  • Bugfixes
  • Rubocop style changes
  • BREAKING CHANGE: node['nginx_resources']['source']['include_recipes'] is now a Hash of bools rather than an Array in order to better support attribute precedence mergin.

v0.1.4

  • Fix copy-paste type in user creation recipe
  • Streamline service definition

v0.1.2

  • Resolve timing issue with service templates
  • Resolve bug service notification issue due to bug in chef where it errors out if a nested resource is passed a notify resource by string rather than object

v0.1.1

  • Remove apt version pin to prevent conflict with newrelic

v0.1.0

  • Initial release

Collaborator Number Metric
            

0.5.3 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.5.3 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

0.5.3 failed this metric

FC067: Ensure at least one platform supported in metadata: nginx_resources/metadata.rb:1
FC069: Ensure standardized license defined in metadata: nginx_resources/metadata.rb:1
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/build.rb:7
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/build.rb:13
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/build.rb:20
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/build.rb:27
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/build.rb:33
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/build.rb:39
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/build.rb:47
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/build.rb:54
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/build.rb:63
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/build.rb:72
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/build.rb:80
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/build.rb:89
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/config.rb:7
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/config.rb:13
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/config.rb:26
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/config.rb:33
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/config.rb:40
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/config.rb:46
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/config.rb:52
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/config.rb:59
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/config.rb:67
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/config.rb:79
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:9
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:15
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:21
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:29
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:35
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:41
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:47
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:53
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:59
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:65
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:71
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:77
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:83
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:90
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:96
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:102
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:109
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/instance.rb:121
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/maintenance.rb:23
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/maintenance.rb:31
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/maintenance.rb:43
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/maintenance.rb:55
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/module.rb:9
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/module.rb:15
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/module.rb:22
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/module.rb:28
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/module.rb:35
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/module.rb:42
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/module.rb:59
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/module.rb:65
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/module.rb:72
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:8
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:14
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:21
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:28
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:35
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:43
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:51
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:62
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:72
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:84
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:96
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:102
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:108
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/site.rb:114
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/source.rb:7
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/source.rb:13
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/source.rb:20
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/source.rb:27
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/source.rb:34
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/source.rb:41
FC117: Do not use kind_of in custom resource properties: nginx_resources/resources/source.rb:53
FC121: Cookbook depends on cookbook made obsolete by Chef 14: nginx_resources/metadata.rb:1
FC122: Use the build_essential resource instead of the recipe: nginx_resources/recipes/install_build.rb:4
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

0.5.3 passed this metric

Testing File Metric
            

0.5.3 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

0.5.3 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number