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

play (4) Versions 2.0.0

Installs/Configures Play distribution binary as a service.

Berkshelf/Librarian
Policyfile
Knife
cookbook 'play', '~> 2.0.0'
cookbook 'play', '~> 2.0.0', :supermarket
knife cookbook site install play
knife cookbook site download play
README
Dependencies
Changelog
Quality

Play Cookbook

Cookbook Version Build Status

Installs Play 2.2+ standalone distribution (tar.gz, tgz, or zip) and configures it as a service.

Requirements

  • Java (must be installed outside this cookbook)
  • Chef 12+

Platforms

  • CentOS, Red Hat, Fedora
  • Debian, Ubuntu

Usage

Installs Play 2.2+ standalone distribution and configures it as a systemd or systemv service. The servicename will default to the project_name of the distribution if none is provided. The application.conf file can be created/overwritten with a template included in the distribution or by an external template from another cookbook. For Linux users, zip files do not retain Linux file permissions so when the file is expanded the start script will be set as an executable. The pid path for Linux users will default to /var/run/#{servicename}/play.pid.

Attributes

  • source - URI to archive (tar.gz, tgz, or zip) or directory path to exploded archive. Defaults to resource name.
  • checksum - The SHA-256 checksum of the file. Use to prevent resource from re-downloading remote file. Default nil.
  • project_name - Used to identify start script executable. Derives project_name from standalone distribution filename when nil. Default nil
  • servicename - Service name to run as. Defaults to project_name when nil. Default nil.
  • conf_cookbook - Cookbook containing application conf template to use. Default nil.
  • conf_local - Load application conf template from a local path. Default false.
  • conf_source - Path to configuration template. Local path can be relative, or if the template file is outside standalone distribution, absolute. Default nil.
  • conf_path - Path to application configuration file. Path can be relative, or if the config file is outside standalone distribution, absolute. Default conf/application.conf.
  • conf_variables - Hash of application configuration variables required by application conf template. Default {}.
  • args - Array of additional configuration arguments. Default [].
  • user - Creates a user using servicename when nil or uses value passed in. Default nil.
  • group - Creates a group using servicename when nil or uses value passed in. Default nil.
  • path - Path to install standalone distribution. Default /opt/play.
  • sensitive - Suppress output. Default true.

Examples

Install distribution as service and generate application.conf from template included in the distribution

play 'https://github.com/dhoer/play-java-sample/releases/download/1.0/play-java-sample-1.0.zip' do
  conf_local true 
  conf_source 'conf/application.conf.erb'
  conf_variables(
    secret: 'abcdefghijk',
    langs: %w(en fr)
  )
  args([
    '-Dhttp.port=8080',
    '-J-Xms128m',
    '-J-Xmx512m',
    '-J-server'
  ])
  action :install
end

The application configuration defined in conf_path will be created/replaced by template defined in conf_source.

Install a standalone distribution from local file as service and generate application.conf from another cookbook

play 'file:///var/chef/cache/myapp-1.0.0.zip' do
  conf_cookbook 'mycookbook'
  conf_source 'application.conf.erb'
  conf_variables(
    secret: 'abcdefghijk',
    langs: %w(en fr)
  )
  args([
    '-Dhttp.port=8080',
    '-J-Xms128m',
    '-J-Xmx512m',
    '-J-server'
  ])
  action :install
end

The application configuration defined in conf_path will be created/replaced by template defined in conf_source.

Install exploded standalone distribution as service and don't generate application.conf from template

play '/opt/myapp' do
   args([
    '-Dhttp.port=8080',
    '-J-Xms128m',
    '-J-Xmx512m',
    '-J-server'
  ])
  action :install
end

Since both conf_local false and conf_cookbook nil, the application configuration defined in conf_path will be used.

ChefSpec Matchers

This cookbook includes custom ChefSpec matchers you can use to test your own cookbooks.

Example Matcher Usage

expect(chef_run).to install_play(
  'https://github.com/dhoer/play-java-sample/releases/download/1.0/play-java-sample-1.0.zip'
).with(
  conf_local true
  conf_source 'conf/application.conf.erb'
  conf_path 'conf/application.conf'
  conf_variables: {
    secret: 'abcdefghijk'
    langs: %w(en fr)
  }
  args: [
    '-Dhttp.port=8080',
    '-J-Xms128m',
    '-J-Xmx512m',
    '-J-server' 
  ]
)

Cookbook Matchers

  • install_play(resource_name)

Getting Help

Contributing

Please refer to CONTRIBUTING.

License

MIT - see the accompanying LICENSE file for details.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Changelog

2.0.0 2016-08-15

  • Change resource_name default from servicename to source
  • Default servicename to project_name when not defined
  • Create user and group using servicename when not defined
  • Remove default recipe
  • Support systemd
  • Update upstart script
  • Update systemv script
  • Remove ark cookbook dependency

1.0.2 2016-04-01

  • Fix #2 Exploded standalone distribution results in undefined method '[]' for nil:NilClass error

1.0.1 2015-12-11

  • Suppress FC021: Resource condition in provider may not behave as expected

1.0.0 2015-12-07

  • Initial release

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 passed this metric

Foodcritic Metric
            

2.0.0 failed this metric

FC066: Ensure chef_version is set in metadata: play/metadata.rb:1
Run with Foodcritic Version 11.1.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

License Metric
            

2.0.0 passed this metric

No Binaries Metric
            

2.0.0 passed this metric

Publish Metric
            

2.0.0 passed this metric

Supported Platforms 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 passed this metric