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

varnish (55) Versions 5.0.13

Installs and configures varnish

Policyfile
Berkshelf
Knife
cookbook 'varnish', '= 5.0.13', :supermarket
cookbook 'varnish', '= 5.0.13'
knife supermarket install varnish
knife supermarket download varnish
README
Dependencies
Changelog
Quality 50%

varnish Cookbook

Cookbook Version
Build Status
OpenCollective
OpenCollective
License

Configures varnish.

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

chef-client

  • Requires chef-client 15.5 and above.

Platforms

  • CentOS 7+
  • Debian 9+
  • Ubuntu 18.04+

Other operating systems and Varnish versions may work, but are not explicitly tested or supported.

Global Attributes

These attributes used as defaults for both resources and the varnish::configure cookbook but can be also overridden with other attributes and resource properties described later.

  • node['varnish']['conf_path'] - location of the default file that controls the varnish init script on Debian/Ubuntu systems.
  • node['varnish']['reload_cmd'] - location of the varnish reload script used by the systemd config file. This is not used for initd currently.
  • node['varnish']['conf_source'] - template file source to use for the default varnish init config.
  • node['varnish']['conf_cookbook'] - template cookbook source to use for the default varnish init config.
  • node['varnish']['major_version'] - the major version of varnish to install. Can be any valid major release. Defaults to 7.0.

Recipes

default

This is not used currently but reserved for minimal configuration needed for all the resources/recipes to work correctly.

configure

Installs the varnish package, manages the varnish configuration file, and the init script defaults file.

Usage

You can either use include the varnish::configure recipe and configure the setup using the recipe attributes described below or use the resources directly.

If running on a Redhat derivative then you may need to include yum-epel as it provides the jemalloc dependency that varnish needs.

Configure Recipe Attributes

Common Settings

The configure recipe uses the resources below to get varnish and varnishlog installed and running from the vendor repo. The recipe will work without any additional configuration however there is a few common attributes that you may want to set.

  • node['varnish']['configure']['repo']['action'] - Affects the vendor repo resource. Can be set to :nothing to skip and use the systems package otherwise the default is to :configure it.
  • node['varnish']['configure']['package']['version'] - Specific varnish version to pass to the package resource. Default is to install the latest available version for the current node['varnish']['major_version'].
  • node['varnish']['configure']['log']['action'] - Affects the varnish_log resource. Can be set to :nothing to skip and not set up logging otherwise the default is to :configure it.
  • node['varnish']['configure']['config']['listen_port'] - Port number to listen on for requests to varnish. Defaults to 6081.
  • node['varnish']['configure']['vcl_template']['source'] - Name for default vcl template. Defaults to default.vcl.erb.
  • node['varnish']['configure']['vcl_template']['cookbook'] - Name of the cookbook for the default vcl template. Uses this varnish cookbook by default.

If you are using the default vcl_template then backend_port and backend_host are configurable through these parameters.

  • node['varnish']['configure']['vcl_template']['variables']['config']['backend_port'] - The default vcl_template backend port (default: 80).
  • node['varnish']['configure']['vcl_template']['variables']['config']['backend_host'] - The default vcl_template backend_host (default: 127.0.0.1).

Any resource property in the varnish::configure recipe can be configured. The keys under the namespace's listed below will map to the property name. Refer to the resource documentation for details on all the properties.

Resource Attribute Namespace
varnish_repo 'configure' node['varnish']['configure']['repo']
package 'varnish' node['varnish']['configure']['package']
service 'varnish' node['varnish']['configure']['service']
varnish_config 'default' node['varnish']['configure']['config']
vcl_template 'default' node['varnish']['configure']['vcl_template']
varnish_log 'default' node['varnish']['configure']['log']
varnish_log 'ncsa' node['varnish']['configure']['ncsa']

Recipe Example's

Use the systems varnish package and skip enabling the varnishlog daemon :

node.override['varnish']['configure']['repo']['action'] = :nothing
node.override['varnish']['configure']['log']['action'] = :nothing

include_recipe 'varnish::configure'

Use custom.vcl.erb template in my_cookbook and configure varnish to listen on port 80:

node.override['varnish']['configure']['config']['listen_port'] = 80
node.override['varnish']['configure']['vcl_template']['source'] = 'custom.vcl.erb'
node.override['varnish']['configure']['vcl_template']['cookbook'] = 'my_cookbook'

include_recipe 'varnish::configure'

Resources

The following resources are provided:

  • [varnish_config](documentation/varnish_config.md)
  • [varnish_log](documentation/varnish_log.md)
  • [varnish_repo](documentation/varnish_repo.md)
  • [vcl_file](documentation/vcl_file.md)
  • [vcl_template](documentation/vcl_template.md)

Resource Recipe Example

Install and configure varnish 6.6 using vcl config default.vcl in the current cookbook as well as a backend.vcl template.

include_recipe 'varnish::default'

varnish_repo 'configure' do
  major_version 6.6
end

package 'varnish'

service 'varnish' do
  action [:enable, :start]
end

varnish_config 'default' do
  listen_address '0.0.0.0'
  listen_port 80
  storage 'malloc'
  malloc_percent 33
end

vcl_template 'backends.vcl' do
  source 'backends.vcl.erb'
  variables(
      backends_ids: Array(1..16),
      env: 'live',
  )
end

vcl_file 'default.vcl'

# varnishlog
varnish_log 'default'

# varnishncsa
varnish_log 'default_ncsa' do
  log_format 'varnishncsa'
end

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website
https://opencollective.com/sous-chefs/sponsor/1/website
https://opencollective.com/sous-chefs/sponsor/2/website
https://opencollective.com/sous-chefs/sponsor/3/website
https://opencollective.com/sous-chefs/sponsor/4/website
https://opencollective.com/sous-chefs/sponsor/5/website
https://opencollective.com/sous-chefs/sponsor/6/website
https://opencollective.com/sous-chefs/sponsor/7/website
https://opencollective.com/sous-chefs/sponsor/8/website
https://opencollective.com/sous-chefs/sponsor/9/website

Dependent cookbooks

yum >= 7.2
yum-epel >= 0.0.0

Contingent cookbooks

magentostack Applicable Versions
nodestack Applicable Versions
noosfero Applicable Versions
phpstack Applicable Versions
pythonstack Applicable Versions
stack_commons Applicable Versions

Varnish Changelog

All notable changes to this project will be documented in this file.

5.0.13 - 2023-04-17

5.0.12 - 2023-04-07

Standardise files with files in sous-chefs/repo-management

5.0.11 - 2023-04-01

5.0.10 - 2023-04-01

5.0.9 - 2023-04-01

Standardise files with files in sous-chefs/repo-management

5.0.8 - 2023-03-20

Standardise files with files in sous-chefs/repo-management

5.0.7 - 2023-03-15

Standardise files with files in sous-chefs/repo-management

5.0.6 - 2023-02-27

5.0.5 - 2023-02-27

5.0.4 - 2023-02-23

5.0.3 - 2023-02-23

Standardise files with files in sous-chefs/repo-management

5.0.2 - 2023-02-15

Standardise files with files in sous-chefs/repo-management

5.0.1 - 2022-12-13

Standardise files with files in sous-chefs/repo-management

Standardise files with files in sous-chefs/repo-management

  • Standardise files with files in sous-chefs/repo-management
  • Remove delivery folder
  • Update tested platforms

5.0.0 - 2021-10-14

  • Enable unified_mode
  • Require Chef >= 15.5
  • Remove chef-sugar dependency
  • Fix support for RHEL 8
  • Add new known Varnish releases
  • Fix reload when using Varnish >= 7.0
  • Use apt pinning on Debian/Ubuntu when using vendor packages
  • Remove sysvinit support
  • Deprecate various unused parameters in varnish_config resource
  • Various cookstyle fixes
  • Update test kitchen to standard modern platforms
  • Switch to InSpec for integration testing

4.1.2 - 2021-08-30

  • Standardise files with files in sous-chefs/repo-management

4.1.1 - 2021-06-01

  • resolved cookstyle error: test/fixtures/cookbooks/disable_ipv6/metadata.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/fixtures/cookbooks/disable_ipv6/recipes/default.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/fixtures/cookbooks/disable_ipv6/recipes/disable_ipv6.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/distro/serverspec/default_spec.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/distro/serverspec/spec_helper.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/full_stack/serverspec/default_spec.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/full_stack/serverspec/spec_helper.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish3/serverspec/default_spec.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish3/serverspec/spec_helper.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish4/serverspec/default_spec.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish4/serverspec/spec_helper.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish41/serverspec/default_spec.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish41/serverspec/spec_helper.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish5/serverspec/default_spec.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish5/serverspec/spec_helper.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish51/serverspec/default_spec.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish51/serverspec/spec_helper.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish52/serverspec/default_spec.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish52/serverspec/spec_helper.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish60/serverspec/default_spec.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish60/serverspec/spec_helper.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish61/serverspec/default_spec.rb:1:1 convention: Style/Encoding
  • resolved cookstyle error: test/integration/varnish61/serverspec/spec_helper.rb:1:1 convention: Style/Encoding

4.1.0 - 2020-05-05

Added

Changed

  • Updated the yum_repository resource to use the newer baseurl property instead of the legacy url property
  • Migrated to actions
  • resolved cookstyle error: resources/config.rb:6:1 refactor: ChefStyle/TrueClassFalseClassResourceProperties
  • resolved cookstyle error: resources/log.rb:4:1 refactor: ChefStyle/TrueClassFalseClassResourceProperties
  • resolved cookstyle error: resources/varnish_repo_debian.rb:7:1 refactor: ChefStyle/TrueClassFalseClassResourceProperties
  • resolved cookstyle error: resources/varnish_repo_debian.rb:14:5 refactor: ChefRedundantCode/AptRepositoryDistributionDefault

Deprecated

Removed

4.0.2

  • Test using CircleCI

4.0.1

  • Adds support for Varnish 3 and 4.0 on CentOS 7
  • Adds support for Varnish 4.0 and 4.1 on Ubuntu 1604

4.0.0

  • Adds support Varnish 6.0
  • Allow systemd platforms to set instance names. PR #157 and #153
    • Note: In some cases (instance_name is set when using systemd) this will change the varnish instance name.
  • Escape ncsa_format_string for systemd. Fixes #137
  • Don't set -n when instance_name is nil or empty on systemd

3.5.0

  • Removed ChefSpec matchers as these are autogenerated by recent releases of ChefSpec in ChefDK
  • Allow all platform families to set instance name in varnishlog
  • Removed the unused build-essential dependency
  • Require Chef 12.9 or later so we don't introduce issues with the apt cookbook
  • Set the Varnish TTL
  • Moved files and templates out of the default directories. This was a Chef 11-ism
  • Renamed the resource files to let chef auto generate the resource names properly
  • Removed the usage of kind_of in the resources since that's a LWRP-ism
  • Swapped name_attribute for name_property in the resources
  • Removed unnecessary default_action from the resources
  • Removed the name properties from the resources since Chef auto generates these for us

3.4.0

  • Adds support Varnish 5
  • Updates reload-vcl file from upstream packaging
  • Add varnish5 TravisCI tests

Known Bugs:

3.3.1

  • Remove upper bound on yum cookbook dependency. #147
  • Add repo_gpgcheck to redhat varnish repo. #145

3.3.0

3.2.0

3.1.0

  • Varnish expects the varnish instance name to be hostname by default however this is sometimes different then hostname -s which is used by ohai's hostname. This seemed to only be an issue on CentOS 7.2.
  • Use /etc/varnish/varnish.params for systemd init file. This is what the package uses and I think will remove some confusion about how settings are set. #103
  • Remove /usr/share/varnish/reload-vcl on debian. This was added to support the '-j' option in varnish 4.1 however it has been fixed upstream.
  • including yum-epel for centos
  • Removing old testing files(CircleCi, kitchen-rackspace, rake) and replacing with (TravisCI, kitchen-dokken, delivery).
  • adding integration testing in ci.

3.0.0

  • Move recipes in default to custom resources / Move recipe and lwrp defaults config to custom resource
  • Remove unused properties
  • Don't append '.vcl' to file name
  • Fix percent_of_total_mem function
  • Include default recipe in integrations tests
  • Add configure recipe
  • Don't use default recipe to install/setup varnish
  • Don't fetch the repository key over insecure HTTP

2.4.0

  • Add additional attributes to allow use of template source from a wrapper cookbook
  • Move define_systemd_daemon_reload to helpers (#97)
  • Fix Chef::Exceptions::ChecksumMismatch error
  • Set Ruby vers to 2.2.3 to satisfy ruby_dep requirements (#104)

2.3.0

  • Fix chef 12.5 compatibility. This required a bunch of workarounds we should fix later.

2.2.2

  • # 86 - Removed monkey patching of service providers

2.2.1

  • Fix a bug in the monkey patched service resource, so that the changes needed for Varnish don't affect other services. #83.
  • Update docs, Rakefile, standards. #79.
  • Add additional examples to the documentation. #74.

2.2.0

  • Fix default storage bug. Specify a default file storage location, as one is required with file backend, fixes #72. Adjust template for default configuration of varnish so that it won't do the file backend without a path, since that's illegal syntax.

  • Cause varnish reload to happen after restart. Delayed notifications are queued up in order. In this case, it makes sense for the reload to happen after the restart.

  • Switch from service restart to service reload. The varnish_default_vcl has been updated to perform a service reload instead of a service restart. This will prevent the cache from being cleared when a reload of the vcl file is enough.

2.1.1

  • Fixes #56. The apt resource may not be included, so no need to run a notification on it.

1.2.0

  • Make resource_name compatible with older Chef. Switch from passing an argument into resource_name to using the assignment operator '='. This will make resource_name compatible with older versions of Chef.

1.1.0 (2015-02-16)

  • Created libraries, to eventually replace recipe functionality, currently can be used along side recipes
  • Added CircleCI support for automated testing
  • Added logrotate support
  • Added varnish(log|nsca) support

0.9.12 (2014-03-12)

  • [COOK-4368] - Improve documentation to include all attributes

0.9.10

Bug

0.9.8

Improvement

  • COOK-3095 - Add MiniTest Chef Handler and Test Kitchen

0.9.6

Bug

  • [COOK-2892]: Varnish restarts when vcl is updated instead of reloading

0.9.4

  • [COOK-1261] - fix issues with default.vcl handling

0.9.0

  • [COOK-873] - full daemon configuration through attributes
  • [COOK-1091] - fix path for default.vcl, via COOK-873
  • [COOK-1162] - add apt_repo recipe for using official varnish repository

0.8.0

  • Current public release.

Collaborator Number Metric
            

5.0.13 passed this metric

Contributing File Metric
            

5.0.13 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

Cookstyle Metric
            

5.0.13 passed this metric

No Binaries Metric
            

5.0.13 passed this metric

Testing File Metric
            

5.0.13 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
            

5.0.13 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