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

RSS

lamp_role (2) Versions 0.1.0

Installs/Configures lamp_role

Berkshelf/Librarian
Policyfile
Knife
cookbook 'lamp_role', '= 0.1.0'
cookbook 'lamp_role', '= 0.1.0', :supermarket
knife cookbook site install lamp_role
knife cookbook site download lamp_role
README
Dependencies
Quality

LAMP cookbook Build Status

Role wrapper cookbook for LAMP stack.

This cookbook provides a full LAMP stack on Debian/Ubuntu platform.

Requirements

This cookbook is currently tested with the following setup:

  • Chef: 11.10.4
  • Ubuntu 12.04

This cookbook depends on the following cookbooks

On Ubuntu/Debian, use Opscode's apt cookbook to ensure the package cache is updated so Chef can install packages, or consider putting apt-get in your bootstrap process or knife bootstrap template.

This cookbook (current version) will not work with apache 2.4 and ubuntu 14.04.

Usage

Include default recipe to get a full LAMP stack.

Attributes

This cookbook rewrite some apache2 attributes to suit LAMP stack need. You will likely edit some of them. See attributes file for latest version of overridden attributes

The following attributes are added by this cookbook

Additional attributes for apache default recipe

default[:lamp][:www_browser] = 'w3m' # Name of a package which provides www-browser

Default php modules

default[:lamp][:php_modules] = %w(mysql gd apc curl)

  • node[:lamp][:www_browser] - textual browser package used to setup apache2ctl status command. Default w3m
  • node[:lamp][:php_modules] - PHP installed modules. Default %w(mysql gd apc curl)

These other attributes are used in php_application definition described below

  • node[:php_applications][:applications_bag] - reserved for future use.
  • node[:php_applications][:apps_path] - Base path where to put php applications. Default node[:apache][:docroot_dir]
  • node[:php_applications][:user] - Default owner for php applications. Default node[:apache][:user]
  • node[:php_applications][:group] - Default group for php applications. Default node[:apache][:group]
  • node[:php_applications][:mysql_admin_credentials][:host] - Database host where to create db users. Default localhost
  • node[:php_applications][:mysql_admin_credentials][:username] - Administrative database user for creating db users. Default root
  • node[:php_applications][:mysql_admin_credentials][:password] - Administrative database password for creating db users. Default node[:mysql][:server_root_password]

Recipes

Default

Install Apache2, PHP and MySQL on the target host. Apache default virtual host is overridden with this template i.e. is configured to respond with '404 Not found' on every request.

Apache status is configured to respond on virtual host only, this can be useful in order to setup monit with apache protocol.

PHP is installed with modules given in attributes and prepared for MySQL integration.

MySQL is configured using this role cookbook

Definitions

php_application

This definition can be used to setup a virtual host for a php application. It accepts some parameters to configure the application, here are the accepted configuration options and their default values:

  • basedir - This will be the path where the application is stored. Default #{node[:php_applications][:apps_path]}/#{application_name}
  • owner - Application folder owner. Default node[:php_applications][:user]
  • group - Application folder group. Application folder is configured with mode 2775, in this way any content created inside the folder can be shared with all members of this group. Default node[:php_applications][:group]
  • canonical_hostname - If given and not false the application a rewrite rule is added to vhost configuration to redirect all requests made with non canonical hostname to the same path but with canonical hostname, useful for SEO. Default application_name
  • aliases - An array of aliases for the given virtual host. Default []
  • capistrano - Prepare the virtual host for capistrano support, i.e. Point Document Root to "#{basedir}/current". Default false
  • zend_framework - Prepare the virtual host for zend framework support, i.e. Point Document Root to "#{basedir}/public". Default false
  • mysql - If hash can be used to create local users for the application (see this example. Default false
  • users - Additional system users to append to application group. Default []
  • document_root - Used to override application document root in virtual host configuration. Default nil
  • ssl - SSL support for virtual host, need some documentation. Default false

Additional parameters can be given to configure php directives in virtual host file. They are hashes of php flags or values

  • php_values - PHP values in apache config. Default {}
  • php_admin_values - PHP admin values in apache config. Default {}
  • php_flags - PHP flags in apache config. Default {}
  • php_admin_flags - PHP admin flags in apache config. Default {}

A minimal example of php_application definition is the following

# Plain php site with some features on
php_application 'php.example.com' do
 application_config aliases: ['php2.example.com'], users: %w(vagrant)
end

Full usage of this definition is shown in this recipe and its serverspec

Author

Author:: Fabio Napoleoni (f.napoleoni@gmail.com)

Dependent cookbooks

ssl >= 0.0.0
php >= 0.0.0
apache2 ~> 1.9.6
mysql_role >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Foodcritic Metric
            

0.1.0 failed this metric

FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/default.rb:3
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/default.rb:8
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/default.rb:9
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/default.rb:10
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/default.rb:11
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/default.rb:12
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/default.rb:13
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/default.rb:16
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/default.rb:19
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/default.rb:22
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/default.rb:25
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/default.rb:26
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/php_applications.rb:2
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/php_applications.rb:4
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/php_applications.rb:7
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/php_applications.rb:8
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/php_applications.rb:11
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/php_applications.rb:12
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/attributes/php_applications.rb:13
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/definitions/php_application.rb:13
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/definitions/php_application.rb:14
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/definitions/php_application.rb:15
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/definitions/php_application.rb:44
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/definitions/php_application.rb:45
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/definitions/php_application.rb:53
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/definitions/php_application.rb:57
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/definitions/php_application.rb:68
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/definitions/php_application.rb:96
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/recipes/apache2.rb:24
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/recipes/apache2.rb:27
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/recipes/apache2.rb:30
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/recipes/php_modules.rb:20
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/recipes/php_modules.rb:24
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/apache_vhost.conf.erb:25
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/apache_vhost.conf.erb:26
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/apache_vhost.conf.erb:27
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/apache_vhost.conf.erb:38
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/apache_vhost.conf.erb:39
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/apache_vhost.conf.erb:42
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/apache_vhost.conf.erb:59
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/apache_vhost.conf.erb:64
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/apache_vhost.conf.erb:65
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/apc.ini.erb:3
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/apc.ini.erb:8
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/default-site.erb:7
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/templates/default/default-site.erb:13
FC007: Ensure recipe dependencies are reflected in cookbook metadata: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/definitions/php_application.rb:51
FC015: Consider converting definition to a LWRP: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/definitions/php_application.rb:1
FC019: Access node attributes in a consistent manner: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/recipes/php_modules.rb:32
FC023: Prefer conditional attributes: /tmp/cook/bd881528b66b192e4c51fb1b/lamp_role/recipes/php_modules.rb:24