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

application_php (6) Versions 2.0.0

Deploys and configures PHP-based applications

Policyfile
Berkshelf
Knife
cookbook 'application_php', '~> 2.0.0', :supermarket
cookbook 'application_php', '~> 2.0.0'
knife supermarket install application_php
knife supermarket download application_php
README
Dependencies
Quality 18%

Description

This cookbook is designed to be able to describe and deploy PHP web applications. Currently supported:

  • PHP
  • Apache2 with mod_php

Note that this cookbook provides the PHP-specific bindings for the application cookbook; you will find general documentation in that cookbook.

Other application stacks may be supported at a later date.

Requirements

Chef 0.10.0 or higher required (for Chef environment use).

The following Opscode cookbooks are dependencies:

  • application
  • apache2
  • php

Resources/Providers

The LWRPs provided by this cookbook are not meant to be used by themselves; make sure you are familiar with the application cookbook before proceeding.

php

The php sub-resource LWRP deals with deploying PHP webapps from an SCM repository. It uses the deploy_revision LWRP to perform the bulk of its tasks, and many concepts and parameters map directly to it. Check the documentation for deploy_revision for more information.

PHP applications have no standard convention for database configuration; your application cookbook must provide a template if needed.

Attribute Parameters

  • packages: an Array of PEAR packages to install
  • database_master_role: if a role name is provided, a Chef search will be run to find a node with than role in the same environment as the current role. If a node is found, its IP address will be used when rendering the context file, but see the "Database block parameters" section below
  • local_settings_file: the name of the local settings file to be generated by template. Defaults to "LocalSettings.php"
  • settings_template: the name of template that will be rendered to create the local settings file. Defaults to "#{local_settings_file}.erb"
  • database: a block containing additional parameters for configuring the database connection (see below)
  • app_root: path where the application can be found in relative from path. Default value is "/"

Database block parameters

The database block can accept any method, which will result in an entry being created in the @database Hash which is passed to the context template. See the examples below for more information.

mod_php_apache2

The mod_php_apache2 sub-resource LWRP configures Apache and mod_php to run the application by creating a virtual host.

Attribute Parameters

  • server_aliases: an Array of server aliases
  • webapp_template: the template to render to create the virtual host configuration. Defaults to "php.conf.erb"

Usage

A sample application that needs a database connection:

application "phpvirtualbox" do
  path "/usr/local/www/sites/phpvirtualbox"
  owner node[:apache][:user]
  group node[:apache][:user]
  repository "..."
  deploy_key "..."
  revision "4_0_7"
  packages ["php-soap"]

  php do
    database_master_role "database_master"
    local_settings_file "config.php"
  end

  mod_php_apache2
end

This will result in a config.php file getting created from a config.php.erb template that must exist in your application cookbook.

You can invoke any method on the database block:

application "my-app" do
  path "/usr/local/my-app"
  repository "..."
  revision "..."

  php do
    database_master_role "database_master"
    database do
      database 'name'
      quorum 2
      replicas %w[Huey Dewey Louie]
    end
  end
end

The corresponding entries will be passed to the context template:

<%= @database['quorum']
<%= @database['replicas'].join(',') %>

License and Author

Author:: Adam Jacob (adam@opscode.com)
Author:: Andrea Campi (andrea.campi@zephirworks.com.com)
Author:: Joshua Timberman (joshua@opscode.com)
Author:: Seth Chisamore (schisamo@opscode.com)

Copyright 2009-2012, Opscode, 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.

Collaborator Number Metric
            

2.0.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

2.0.0 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

Foodcritic Metric
            

2.0.0 failed this metric

FC016: LWRP does not declare a default action: application_php/resources/cakephp.rb:1
FC016: LWRP does not declare a default action: application_php/resources/codeigniter.rb:1
FC016: LWRP does not declare a default action: application_php/resources/laravel.rb:1
FC016: LWRP does not declare a default action: application_php/resources/mod_php_apache2.rb:1
FC016: LWRP does not declare a default action: application_php/resources/php.rb:1
FC016: LWRP does not declare a default action: application_php/resources/symfony.rb:1
FC064: Ensure issues_url is set in metadata: application_php/metadata.rb:1
FC065: Ensure source_url is set in metadata: application_php/metadata.rb:1
FC066: Ensure chef_version is set in metadata: application_php/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: application_php/metadata.rb:1
FC069: Ensure standardized license defined in metadata: application_php/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

2.0.0 passed this metric

Testing File Metric
            

2.0.0 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
            

2.0.0 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

You must be signed in to follow a cookbook.