{"id":19249237,"url":"https://github.com/sous-chefs/haproxy","last_synced_at":"2025-04-05T00:10:37.314Z","repository":{"id":2725686,"uuid":"3720592","full_name":"sous-chefs/haproxy","owner":"sous-chefs","description":"Development repository for the haproxy cookbook","archived":false,"fork":false,"pushed_at":"2024-02-01T10:37:46.000Z","size":995,"stargazers_count":156,"open_issues_count":6,"forks_count":251,"subscribers_count":35,"default_branch":"main","last_synced_at":"2024-04-14T11:03:41.304Z","etag":null,"topics":["chef","chef-cookbook","chef-resource","hacktoberfest","haproxy","managed-by-terraform"],"latest_commit_sha":null,"homepage":"https://supermarket.chef.io/cookbooks/haproxy","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sous-chefs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"open_collective":"sous-chefs"}},"created_at":"2012-03-14T18:14:11.000Z","updated_at":"2024-02-15T09:04:49.000Z","dependencies_parsed_at":"2023-10-28T05:31:09.929Z","dependency_job_id":"83f60776-26bb-4eca-be3e-8adb9a497875","html_url":"https://github.com/sous-chefs/haproxy","commit_stats":{"total_commits":643,"total_committers":94,"mean_commits":6.840425531914893,"dds":0.8273716951788491,"last_synced_commit":"ab22138d9c9b8ae42b264221e9598fe7a894dfcd"},"previous_names":[],"tags_count":93,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Fhaproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Fhaproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Fhaproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sous-chefs%2Fhaproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sous-chefs","download_url":"https://codeload.github.com/sous-chefs/haproxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266565,"owners_count":20910836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chef","chef-cookbook","chef-resource","hacktoberfest","haproxy","managed-by-terraform"],"created_at":"2024-11-09T18:13:23.521Z","updated_at":"2025-04-05T00:10:37.294Z","avatar_url":"https://github.com/sous-chefs.png","language":"Ruby","funding_links":["https://opencollective.com/sous-chefs"],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# haproxy Cookbook\n\n[![CI State](https://github.com/sous-chefs/haproxy/workflows/ci/badge.svg)](https://github.com/sous-chefs/haproxy/actions?query=workflow%3Aci)\n[![Cookbook Version](https://img.shields.io/cookbook/v/haproxy.svg)](https://supermarket.chef.io/cookbooks/haproxy)\n[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers)\n[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors)\n[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)\n\nInstalls and configures HAProxy.\n\n## Maintainers\n\nThis 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](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF).\n\n## Requirements\n\n* HAProxy `stable` or `LTS`\n* Chef 13.9+\n\n### Platforms\n\nThis cookbook officially supports and is tested against the following platforms:\n\n* debian: 9 \u0026 10\n* ubuntu: 20.04 \u0026 21.04\n* centos: 7 \u0026 8\n* centos-stream: 8\n* fedora: latest\n* amazonlinux: 2\n\nPRs are welcome to add support for additional platforms.\n\n### Examples\n\nPlease check for working examples in [the test cookbook](test/cookbooks/test).\n\n## Common Resource Features\n\nHAProxy has many configurable options available, this cookbook makes the most popular options available as resource properties.\n\nIf you wish to use a HAProxy property that is not listed the `extra_options` hash is available to take in any number of additional values.\n\nFor example, the ability to disable listeners is not provided out of the box. Further examples can be found in either `test/fixtures/recipes` or `spec/test/recipes`. If you have questions on how this works or would like to add more examples so it is easier to understand, please come talk to us on the [Chef Community Slack](http://community-slack.chef.io/) on the #sous-chefs channel.\n\n```ruby\nhaproxy_listen 'disabled' do\n  bind '0.0.0.0:1337'\n  mode 'http'\n  extra_options('disabled': '')\nend\n```\n\nThe `extra_options` hash is of `String =\u003e String` or `String =\u003e Array`. When an `Array` value is provided. The values are looped over mapping the key to each value in the config.\n\nFor example:\n\n```ruby\nhaproxy_listen 'default' do\n  extra_options(\n    'http-request' =\u003e [ 'set-header X-Public-User yes', 'del-header X-Bad-Header' ]\n    )\nend\n```\n\nBecomes:\n\n```haproxy\nlisten default\n  ...\n  http-request set-header X-Public-User yes\n  http-request del-header X-Bad-Header\n```\n\n## Resources\n\n* [haproxy_acl](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_acl.md)\n* [haproxy_backend](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_backend.md)\n* [haproxy_cache](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_cache.md)\n* [haproxy_config_defaults](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_config_defaults.md)\n* [haproxy_config_global](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_config_global.md)\n* [haproxy_fastcgi](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_fastcgi.md)\n* [haproxy_frontend](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_frontend.md)\n* [haproxy_install](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_install.md)\n* [haproxy_listen](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_listen.md)\n* [haproxy_mailer](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_mailer.md)\n* [haproxy_peer](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_peer.md)\n* [haproxy_resolver](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_resolver.md)\n* [haproxy_service](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_service.md)\n* [haproxy_use_backend](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_use_backend.md)\n* [haproxy_userlist](https://github.com/sous-chefs/haproxy/tree/master/documentation/haproxy_userlist.md)\n\n## Configuration Validation\n\nThe `haproxy.cfg` file has a few specific rule orderings that will generate validation errors if not loaded properly. If using any combination of the below rules, avoid the errors by loading the rules via `extra_options` to specify the top down order as noted below in config file.\n\n### frontend \u0026 listen\n\n```haproxy\n  tcp-request connection\n  tcp-request session\n  tcp-request content\n  monitor fail\n  http-request\n  reqxxx (any req excluding reqadd, e.g. reqdeny, reqallow)\n  reqadd\n  redirect\n  use_backend\n```\n\n```ruby\n  extra_options(\n    'tcp-request' =\u003e 'connection set-src src,ipmask(24)',\n    'reqdeny' =\u003e '^Host:\\ .*\\.local',\n    'reqallow' =\u003e '^Host:\\ www\\.',\n    'use_backend' =\u003e 'dynamic'\n  )\n```\n\n### backend\n\n```haproxy\n  http-request\n  reqxxx (any req excluding reqadd, e.g. reqdeny, reqallow)\n  reqadd\n  redirect\n```\n\n```ruby\n  extra_options(\n    'http-request' =\u003e 'set-path /%[hdr(host)]%[path]',\n    'reqdeny' =\u003e '^Host:\\ .*\\.local',\n    'reqallow' =\u003e '^Host:\\ www\\.',\n    'redirect' =\u003e 'dynamic'\n  )\n```\n\n## Contributors\n\nThis project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890\u0026button=false)\n\n### Backers\n\nThank you to all our backers!\n\n![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600\u0026avatarHeight=40)\n\n### Sponsors\n\nSupport this project by becoming a sponsor. Your logo will show up here with a link to your website.\n\n![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100)\n![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsous-chefs%2Fhaproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsous-chefs%2Fhaproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsous-chefs%2Fhaproxy/lists"}