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


phpstack (17) Versions 3.0.24

Provides a full php stack

cookbook 'phpstack', '= 3.0.24', :supermarket
cookbook 'phpstack', '= 3.0.24'
knife supermarket install phpstack
knife supermarket download phpstack
Quality 0%


Supported Platforms

  • CentOS 6.5
  • Ubuntu 12.04
  • Ubuntu 14.04



  • apache2
  • application
  • application_php
  • apt
  • build-essential
  • chef-sugar
  • database
  • git
  • memcached
  • mongodb
  • mysql
  • mysql-multi -nginx
  • openssl
  • pg-multi
  • php
  • php-fpm
  • platformstack
  • rabbitmq
  • rackspace_gluster
  • redis-multi
  • varnish
  • yum
  • yum-ius
  • yum-epel



  • what it does
    • nothing
  • toggles
    • nothing


  • what it does
    • Creates sites coming from node['phpstack']['apache']['sites'] array
    • Creates monitoring check for each site if node[platformstack][cloud_monitoring]['enabled'] = true.
  • toggles
    • can be disabled by setting node['phpstack']['webserver_deployment']['enabled'] to false


  • what it does
    • installs php and some libraries
    • includes the nginx or apache recipe if node['phpstack']['webserver'] is either apache or nginx
    • if glusterfs is set up via node['rackspace_gluster']['config']['server']['glusters'] glusterfs will be set up as a client
    • deploys your apps, from attributes, depending on what node['phpstack']['webserver'] is set to
    • deploys from node['phpstack'][node['phpstack']['webserver']]['sites']
    • creates a /etc/phpstack.ini file with authentication info for the other nodes in the environment
    • only finding mysql and rabbitmq nodes right now
    • creates a backup job that backs up /var/www by default
    • only runs if node['phpstack']['rackspace_cloudbackup']['http_docroot']['enable'] is set
    • tags the node with the php_app_node tag
  • toggles
    • application deployment can be disabled via the node['phpstack']['code-deployment']['enabled'] flag


  • what it does
    • sets up glusterfs based on the node['rackspace_gluster']['config']['server']['glusters'] attribute
    • this may involve some manual setup, it is glusterfs afterall


  • what it does
    • sets up memcache
    • sets up the memcache cloud monitoring plugin if enabled


  • what it does
    • sets up mongodb from the 10gen repo


  • what it does
    • formats /dev/xvde1 and will prepare it for the mysql datadir.
    • creates the mysql user and manages the /var/lib/mysql mountpoint


  • what it does
    • sets a random root mysql password if the default password would normally be set
    • sets up mysql
    • sets up a holland user if node['holland']['enabled']
    • sets up a monitoring mysql user and monitor if node['platformstack']['cloud_monitoring']['enabled']
    • allow app nodes in the environment to attempt to connect
    • auto-generates mysql databases and assiciated users/passwords for sites installed (can be disabled)
    • installs phpstack specific databases (will autogenerate the user and password if needed still)
  • toggles
    • node['phpstack']['db-autocreate']['enabled'] controls database autocreation at a global level
    • if the site has the db_autocreate attribute, it will control database autocreation for that site
  • info
    • auto-generated databases are based on site name and port number the site is on, same for username


  • what it does
    • installs holland
    • will set up a backup job based on if you are running as a slave or not


  • what it does
    • sets up mysql master (runs the mysql_base recipe as well)
    • will allow slaves to connect (via iptables)


  • what it does
    • sets up the mysql slave (runs the mysql_base recipe as well)
    • allows the master to connect (via iptables)


  • what it does
    • sets up newrelic and the php agent for newrelic
    • sets up the following plugins (as needed)
    • memcache
    • rabbit
    • nginx


  • what it does
    • sets up the nginx vhosts as defined in node['phpstack']['nginx']['sites']
    • sets up the monitors for the for each vhost / port combo
  • toggles
    • node['phpstack']['webserver_deployment']['enabled'] controls whether this recipe runs


  • what it does
    • sets up a basic postgresql server and the associated monitoring checks (if enabled)
  • toggles
    • node['platformstack']['cloud_monitoring']['enabled'] controls the monitoring checks


  • what it does
    • sets up postgresql as a master
    • allows postgresql slaves to connect (via iptables)


  • what it does
    • sets up postgresql as a slave
    • allows the postgresql master to connect (via iptables)


  • what it does
    • allows nodes tagged as php_app_node to connect (via iptables)
    • disables guest user
    • sets up the cloud monitoring plugin
    • sets up a monitoring user for rabbit (with password)
    • sets up rabbitmq vhost/user/password combinations for each vhost and port combination


  • what it does
    • sets up redis (basic)
    • allows nodes tagged as php_app_node to connect (via iptables)
    • allows nodes tagged as phpstack-redis to connect (via iptables)


  • what it does
    • sets up redis in a master capacity


  • what it does
    • sets up redis sentinel
    • allows nodes tagged as php_app_node to connect (via iptables)
    • allows nodes tagged as phpstack-redis_sentinel to connect (via iptables)
    • allows nodes tagged as phpstack-redis to connect (via iptables)


  • what it does
    • sets up redis in a standalone capacity


  • what it does
    • sets up redis in a slave capacity


  • what it does
    • allows clients to connect to the varnish port (via iptables)
    • enables the cloud monitoring plugin for varnish
    • sets the default backend port to the first useful port it can find
    • sets up varnish if for multi backend load ballancing per vhost/port combination
  • toggles
    • node['varnish']['multi'] controls if varnish is simple or complex (multi backend or not)
    • it is also controled by if any backend nodes are found


No Data_Bag configured for this cookbook



  • default['phpstack']['newrelic']['application_monitoring'] = ''
    • controls if we allow newrelic to to do application monitoring
    • is set to 'true' in the newrelic recipe
  • default['phpstack']['webserver'] = 'apache'
    • sets the webserver want to use
    • you can set this to anything, but for acutally running a webserver we only support nginx and apache
    • you can set this to something like 'not_a_webserver' and then use that namespace if you still want to deploy your application
  • default['phpstack']['ini']['cookbook'] = 'phpstack'
    • sets where the /etc/phpstack.ini template is sourced from
  • default['phpstack']['mysql']['databases'] = {}
    • contains a list of databases to set up (along with users / passwords)
  • default['phpstack']['apache']['sites'] = {}
    • contains a list of ports and vhosts to set up for apache
  • default['phpstack']['nginx']['sites'] = {}
    • contains a list of ports and vhosts to set up for nginx
  • default['phpstack']['webserver_deployment']['enabled'] = true
    • allows apache and/or nginx recipes to run
  • default['phpstack']['code-deployment']['enabled'] = true
    • allows code deployment to run
  • default['phpstack']['db-autocreate']['enabled'] = true
    • controls database autocreation for each site / port combination globally


contains attributes that used in a demo site, useful as an example of what to set to deploy a site


contains attributes used in setting up gluster, node the commented out section, it helps to actually hard code these IPs


controls how cloud_monitoring is used within phpstack


  • default['nginx']['default_site_enabled'] = false
    • no need for the default site to be set up (as is default)
  • set['nginx']['init_style'] = 'upstart'
    • useful on ubuntu...
  • default['nginx']['listen_ports'] = %w(80)
    • need to set this up as a default for things like varnish
  • default['nginx']['default_root'] = '/var/www'
    • we don't want sites going into /var/www/nginx-default


  • default['php']['packages'] = []
    • list of packages needed based on platform_family


shouldn't really be messed with


  • default['phpstack']['rabbitmq']['passwords'] = {}
    • sets the admin password for rabbitmq


  • default['phpstack']['varnish']['multi'] = true
    • allows us to use more complex logic for the varnish configuration
  • default['phpstack']['varnish']['backend_nodes'] = []
    • a list of nodes to use for backends. if empty or nil, search is the default behavior


useful datastructures

  • vhosts (apache here can be what you like, but to actually deploy a web server you need to set it to apache or nginx):
    "phpstack": {
    "apache": {
    "user": "apache",
    "group": "apache",
    "sites": {
    80: {
    "": {
    "template": "apache2/sites/",
    "cookbook": "phpstack",
    "server_name": "",
    "server_aliases": [
    "docroot": "/var/www/",
    "errorlog": "/var/log/apache/",
    "customlog": "/var/log/apache/ combined",
    "allow_override": [
    "loglevel": "warn",
    "server_admin": "",
    "revision": "v1.0.1",
    "repository": "",
    "deploy_key": "/root/.ssh/id_rsa"

  • applications (combine this with the vhost to deploy a full site)

    • Any option available to the application resource can be included in the "" hash. json { "phpstack": { "apache": { "user": "apache", "group": "apache", "sites": { 80: { "": { "docroot": "/var/www/", "revision": "v1.0.1", "repository": "", "deploy_key": "/root/.ssh/id_rsa" } } } } } }
  • databases
    "phpstack": {
    "mysql": {
    "example_db": {
    "user": "exampleuser",
    "password": "do_not_use_this_password"


  • single node (app and db): json { "run_list": [ "recipe[platformstack::default]", "recipe[rackops_rolebook::default]", "recipe[phpstack::mysql_base]", "recipe[phpstack::application_php]" ] }
  • app node - standalone app: json { "run_list": [ "recipe[platformstack::default]", "recipe[rackops_rolebook::default]", "recipe[phpstack::application_php]" ] }
  • MySQL DB Single Node:
    "run_list": [

  • MySQL DB Master Node:
    "run_list": [

  • MySQL DB Slave Node:
    "run_list": [

  • PostgreSQL cluster for phpstack

Ensure the following attributes are set within environment or wrapper cookbook

node['postgresql']['version'] = '9.3'
node['postgresql']['password'] = 'postgresdefault'
node['pg-multi']['replication']['password'] = 'useagudpasswd'
node['pg-multi']['master_ip'] = ''
node['pg-multi']['slave_ip'] = ['']

# Depending on OS one of the following two must be set:
node['postgresql']['enable_pdgd_yum'] = true  # (Redhat Family)
node['postgresql']['enable_pdgd_apt'] = true  # (Debian Family)
  • Master PostgreSQL node: json { "run_list": [ "recipe[platformstack::default]", "recipe[rackops_rolebook::default]", "recipe[phpstack::postgresql_master]" ] }
  • Slave PostgreSQL node: json { "run_list": [ "recipe[platformstack::default]", "recipe[rackops_rolebook::default]", "recipe[phpstack::postgresql_slave]" ] }

New Relic Monitoring

To configure New Relic, make sure the node['newrelic']['license'] attribute is set and include the platformstack cookbook in your run_list. You can also run the phpstack::newrelic recipe for some more advanced monitors.



Authors:: Matthew Thode

phpstack CHANGELOG


@jujugrrr - empty bump for new release to the supermarket


@martinb3 - Unbreak the build by stubbing postgres commands for chefspec
@prometheanfire - generalizing the instalation of php modules (through pear)


Sheppy - Enable additional application properties


[@jujugrrr] - Use stack_commons for phpstack::gluster


[@jujugrrr] - Clean memcached attributes, they are not required anymore as they are in stack_commons


[@prometheanfire] - Add support to application_php for before_migrate/before_symlink


[@jujugrrr] - Use stack_commons for phpstack::newrelic


[@jujugrrr] - Use stack_commons for phpstack::mongodb_standalone


[@jujugrrr] - Fixed default type (array->hash) #205

Foodcritic Metric

3.0.24 failed this metric

FC031: Cookbook without metadata file: /tmp/cook/bdeeb5fef4876125a564c39e/phpstack/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/bdeeb5fef4876125a564c39e/phpstack/metadata.rb:1