chef-boneyard / httpd

DEPRECATED: Library cookbook with Apache httpd primitives
https://supermarket.chef.io/cookbooks/httpd
Apache License 2.0
39 stars 59 forks source link
cookbooks httpd

HTTPD Cookbook

Build Status Cookbook Version

The HTTPD Cookbook is a Library Cookbook that provides resource primitives for use in recipes. It is designed to be an example to reference for creating highly re-usable cross platform cookbooks.

DEPRECATED

This cookbook has been deprecated in favor of the traditional apache2 cookbook

Scope

This cookbook is concerned with The Apache HTTP Server, particularly those shipped with F/OSS Unix and Linux distributions. It does not address other httpd server implementations like Lighttpd, Nginx, or IIS.

Requirements

Platform Support

The following platforms have been tested with Test Kitchen:

|----------------+-----+-----|
|                | 2.2 | 2.4 |
|----------------+-----+-----|
| amazon linux   |     | X   |
|----------------+-----+-----|
| debian-8       |     | X   |
|----------------+-----+-----|
| debian-9       |     | X   |
|----------------+-----+-----|
| ubuntu-14.04   |     | X   |
|----------------+-----+-----|
| ubuntu-16.04   |     | X   |
|----------------+-----+-----|
| centos-6       | X   |     |
|----------------+-----+-----|
| centos-7       |     | X   |
|----------------+-----+-----|
| fedora         |     | X   |
|----------------+-----+-----|

Cookbook Dependencies

Usage

Place a dependency on the httpd cookbook in your cookbook's metadata.rb

depends 'httpd'

Then, in a recipe:

httpd_service 'default' do
  action [:create, :start]
end

httpd_config 'default' do
  source 'mysite.cnf.erb'
  notifies :restart, 'httpd_service[default]'
  action :create
end

Resources Overview

httpd_service

The httpd_service does minimal configuration to get the service up and running. Its parameters can select and tune the multi-processing module, along with a small selection of server-wide configuration options such as listen_ports and run_user.

The :create action handles package installation, support directories, socket files, and other operating system level concerns. The internal configuration file contains just enough to get the service up and running, then loads extra configuration from a conf.d directory. Further configurations are managed with the httpd_config resource.

The :start, :stop, :restart, and :reload actions use the appropriate provider for the platform to respectively start, stop, restart, and reload the service on the machine. You should omit the :start action in recipes designed to build containers.

httpd_service supports multiple Apache instances on a single machine, enabling advanced Apache configuration in scenarios where multiple servers need different loaded modules and global configurations.

Examples

httpd_service 'default' do
  action :create
end

httpd_service 'instance-1' do
  listen_ports ['81', '82']
  action :create
end

httpd_service 'an websites' do
  instance_name 'bob'
  servername 'www.computers.biz'
  version '2.4'
  mpm 'event'
  threadlimit '4096'
  listen_ports ['1234']
  action :create
end

Properties

Most of the parameters on the httpd_service resource map to their CamelCase equivalents found at http://httpd.apache.org/docs/2.4/mod/directives.html

httpd_module

The httpd_module resource is responsible ensuring that an Apache module is installed on the system, as well as ensuring a load configuration snippet is dropped off at the appropriate location.

Examples

httpd_module 'ssl' do
  action :create
end

httpd_module 'el dap' do
  module_name 'ldap'
  action :create
end

httpd_module 'auth_pgsql' do
  instance 'instance-2'
  action :create
end

Properties

httpd_config

The httpd_config resource is responsible for creating and deleting site specific configuration files on the system. There are slight differences in the resource implementation on platforms. The httpd_config resource is a thin wrapper around the core Chef template resource. Instead of a path parameter, httpd_config uses the instance parameter to calculate where the config is dropped off.

Check the Apache HTTP Server Project documentation for configuration specifics based on Apache version.

Examples

httpd_config 'mysite' do
  source 'mysite.erb'
  action :create
end

httpd_config 'computers dot biz ssl_config' do
  config_name 'ssl-config'
  instance 'computers_dot_biz'
  source 'ssl_config.erb'
  action :create
end

Properties

Maintainers

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. To learn more about contributing to cookbooks like this see our contributing documentation, or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the Chef Community Slack

License

Copyright: 2008-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.