cookbook 'nginx_resources', '= 0.2.4'
nginx_resources
(17) Versions
0.2.4
-
Follow0
Cookbook to install nginx with resources
cookbook 'nginx_resources', '= 0.2.4', :supermarket
knife supermarket install nginx_resources
knife supermarket download nginx_resources
nginx_resources cookbook
Installs nginx and dependant modules from source in a modular fashion.
Status
This is an initial release of the cookbook which has been through minor non-exhaustive testing. Additional work needs to be done to test more extensively as well as to flesh out the documentation. That being said, the interfaces ought to be fairly consistent moving forward.
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
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.
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.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.2.4 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Foodcritic Metric
0.2.4 failed this metric
FC009: Resource attribute not recognised: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/recipes/install_common.rb:47
FC009: Resource attribute not recognised: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/recipes/install_service.rb:5
FC016: LWRP does not declare a default action: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/resources/build.rb:1
FC016: LWRP does not declare a default action: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/resources/config.rb:1
FC016: LWRP does not declare a default action: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/resources/instance.rb:1
FC016: LWRP does not declare a default action: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/resources/module.rb:1
FC016: LWRP does not declare a default action: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/resources/site.rb:1
FC016: LWRP does not declare a default action: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/resources/source.rb:1
0.2.4 failed this metric
0.2.4 failed this metric
FC009: Resource attribute not recognised: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/recipes/install_common.rb:47
FC009: Resource attribute not recognised: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/recipes/install_service.rb:5
FC016: LWRP does not declare a default action: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/resources/build.rb:1
FC016: LWRP does not declare a default action: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/resources/config.rb:1
FC016: LWRP does not declare a default action: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/resources/instance.rb:1
FC016: LWRP does not declare a default action: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/resources/module.rb:1
FC016: LWRP does not declare a default action: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/resources/site.rb:1
FC016: LWRP does not declare a default action: /tmp/a9ff5dbc4c0a160fef554c60/nginx_resources/resources/source.rb:1