cookbook 'play', '~> 2.0.0'
play (4) Versions 2.0.0 Follow0
Installs/Configures Play distribution binary as a service.
cookbook 'play', '~> 2.0.0', :supermarket
knife supermarket install play
knife supermarket download play
Play Cookbook
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. Defaultnil
. -
project_name
- Used to identify start script executable. Derives project_name from standalone distribution filename when nil. Defaultnil
-
servicename
- Service name to run as. Defaults to project_name when nil. Defaultnil
. -
conf_cookbook
- Cookbook containing application conf template to use. Defaultnil
. -
conf_local
- Load application conf template from a local path. Defaultfalse
. -
conf_source
- Path to configuration template. Local path can be relative, or if the template file is outside standalone distribution, absolute. Defaultnil
. -
conf_path
- Path to application configuration file. Path can be relative, or if the config file is outside standalone distribution, absolute. Defaultconf/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. Defaultnil
. -
group
- Creates a group using servicename when nil or uses value passed in. Defaultnil
. -
path
- Path to install standalone distribution. Default/opt/play
. -
sensitive
- Suppress output. Defaulttrue
.
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
- Ask specific questions on Stack Overflow.
- Report bugs and discuss potential features in Github issues.
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 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
FC066: Ensure chef_version is set in metadata: play/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
2.0.0 failed this 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
FC066: Ensure chef_version is set in metadata: play/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
2.0.0 failed this metric
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
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
2.0.0 failed this 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