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_play (13) Versions 0.2.2

Installs/Configures Play framework application

Policyfile
Berkshelf
Knife
cookbook 'application_play', '= 0.2.2', :supermarket
cookbook 'application_play', '= 0.2.2'
knife supermarket install application_play
knife supermarket download application_play
README
Dependencies
Changelog
Quality 83%

application_play

A Chef cookbook to deploy Play framework applications.

Requirements

Chef 12.1 or newer is required.

Resources

application_play

The application_play resource installs a Play framework application from packaged zip tarball (created using sbt universal:packageZipTarball
task or sbt-release plugin). The application is configured as a
systemd service. This resource is using application cookbook
version 5 as a base.

The Play framework application is deployed using a pseudo-Capistrano folder structure but without using the obsolete Chef deploy resource
or deploy_resource from Supermarket. The implemented logic is way simpler than in the old deploy resource.
There are still current and releases folders but without a rollback action. Rollback is to be done by simply reverting the version to be installed. The fact that we
keep preconfigured number of releases will allow fast rollbacks in case of any error. Important thing to note is that there is no automated rollback on deployment
error (by design). Consider yourself warned if you are going to use this on a single server.

Sample usage:

application 'play_example' do
  owner 'play_example'
  group 'play_example'
  path '/home/play_example'

  play 'play_example' do
    app_env({
      'APPLICATION_SECRET' => "QCY?tAnfk?aZ?iwrNwnxIlR6CTf:G3gf:90Latabg@5241AB`R5W:1uDFN];Ik@n"
    })
    domains(%w(localhost 127.0.0.1))
    settings({
      'play.evolutions.autoApply' => 'true'
    })
    port 9000
    address '0.0.0.0'

    version '1.0-SNAPSHOT'
    source_url 'https://github.com/nstojiljkovic/application_play/raw/artifacts/play-2.6/play-scala-starter-example-1.0-SNAPSHOT.tgz'
    source_user nil
    source_password nil
    source_checksum 'ae56a1f97f32aae73de25de599d7ce45191eee46b900205e50d1082bf529b0ae'

    keep_releases 3
    force_deploy true

    autoconfigure_memory true
    xms_xmx_ratio 0.25
    xmx_ratio 1.0
    xmx_min 128
    xmx_leftover_min 256
  end

  action :deploy
end

Actions

  • :deploy – Deploy application, create, enable and start the service. (default)
  • :start – Start the service.
  • :stop – Stop the service.
  • :restart – Stop and then start the service.

Properties

  • name – Application name. (set on the parent application resource!)
  • path – Path to deploy the application to. (set on the parent application resource!)
  • group – System group to deploy the application as. (set on the parent application resource!)
  • owner – System user to deploy the application as. (set on the parent application resource!)
  • service_name – Name of the service to create. (default: name)
  • service_description – Description of the service to create. (default: "#{name} service")
  • systemd_settings – systemd service override. May include Unit, Service etc. keys as per systemd_unit resource documentation. (default: {})
  • port – Port on which the application should listen to. (default: 9000)
  • address – Address on which the application should listen to. (default: '0.0.0.0')
  • actor_system_name - Actor system name. (default: 'application')
  • actor_provider - Actor provider. (default: 'local', other supported options are 'cluster'' and 'remote'')
  • contact_points - Active contact points (including self) as a simple list of IP addresses. It is assumed that all nodes will share the same ports configuration. (default: '[]')
  • management_port - Akka management port. (default: 8558)
  • management_hostname - Akka management hostname. (default: nil)
  • remote_port - Akka remote port. (default: 2552)
  • remote_hostname - Akka remote hostname. (default: nil)
  • enable_config_discovery - Should Akka management config discovery be used. If set to false, contact_points will be configured as plain seed nodes (without requiring Akka management to be deployed with the application). (default: true)
  • required_contact_point_nr - Required contact points number. Set to 0 for auto-configuration using static quorum strategy (and contact_points length as a size of whole cluster). (default: 0)
  • enable_ssl – Enable HTTPS endpoint. All HTTP traffic will be redirected to HTTPS. (default: false)
  • ssl_cert – SSL certificate. (default: nil)
  • ssl_key – SSL private key (without password). (default: nil)
  • ssl_chain – SSL certificate chain. (default: nil)
  • jks_file – Java KeyStore (JKS) file. (default: "#{name}.jks")
  • jks_password – JKS password. (default: "#{name}")
  • https_port – HTTPS port on which the application should listen to (if enable_ssl is set to true). (default: 9443)
  • https_address – Address on which the application should listen to (HTTPS endpoint, if enable_ssl is set to true). (default: '0.0.0.0')
  • security_properties_file – Java security properties file. (default: "#{name}.security.properties")
  • security_properties – Java security properties. (default: "#{'jdk.tls.disabledAlgorithms' => 'EC keySize < 160, RSA keySize < 2048, DSA keySize < 2048', 'jdk.certpath.disabledAlgorithms' => 'MD2, MD4, MD5, EC keySize < 160, RSA keySize < 2048, DSA keySize < 2048'}")
  • domains – List of domains which should be configured as allowed hosts. (default: ['localhost'])
  • app_env – Environment variables hash. (default: {})
  • env_file – Name of the systemd EnvironmentFile file (which will be populated by default with app_env hash). (default: "#{name}.env")
  • version – Application version (release). (required)
  • source_url – Application source URL. (required)
  • source_checksum – Application source SHA-256 checksum. Setting it recommended for two purposes: verification and prevention of double downloads. (default: nil)
  • source_user – HTTP user for application source download. (default: nil)
  • source_password – HTTP password for application source download. (default: nil)
  • keep_releases – Number of releases which should be kept on the server. Allows fast rollbacks. Set to 0 to keep all. (default: 3)
  • force_deploy – Denotes if deployment should be forced: re-download and re-extract artifact even if release exist. (default: true)
  • autoconfigure_memory - Denotes if Java XMS and XMX properties should be preconfigured for the service. (default: true)
  • xmx_ratio - Percentage of system memory which should be allocated for XMX. Please note that this is affected later in the calculation by xmx_min and xmx_leftover_min. (default: 1.0)
  • xmx_min - Minimal allowed value of XMX (in MB). (default: 128)
  • xmx_leftover_min - Minimal amount of memory (in MB) which should be left for other system processes. Please note that xmx_min has priority. (default: 256)
  • xms_xmx_ratio - What amount of XMX should be set to XMS setting. (default: 0.25)
  • config_file - Name of the production application.conf file which is shared for all releases (and updated on deployment). It includes application's embedded application.conf and overrides it afterwards. (default: "#{name}.conf")
  • config_template_cookbook - Cookbook where the template config_template_source for the config_file is located. (default: application_play)
  • config_template_source - Template for the config_file. (default: application.conf.erb)
  • settings - Production configuration hash (populated in config_file). (default: {})
  • java_settings - Java settings to apply in the systemd service. (default: -J-server -Dsun.security.ssl.allowUnsafeRenegotiation=false -Djdk.tls.ephemeralDHKeySize=2048 -Djdk.tls.rejectClientInitiatedRenegotiation=true)

Recipes

OpsWorks

Cookbook has few recipes prepared for usage with AWS OpsWorks:

  • opsworks_configure
  • opsworks_deploy
  • opsworks_setup
  • opsworks_shutdown
  • opsworks_undeploy

Each of these should be configured in the run list for a corresponding OpsWorks layer lifecycle event.

OpsWorks application supports the following environment variables:

  • PLAY_APP - Signals the opsworks_deploy to deploy the application. (required)
  • APP_USER_UID - Recommended, signals the opsworks_deploy to automatically create user and group for the application. Configuring the app user uid here comes handy if you need to have the same user uid across your nodes.
  • HTTP_PORT - Port on which the application should listen to.
  • HTTP_ADDRESS - Address on which the application should listen to.
  • HTTPS_PORT - HTTPS port on which the application should listen to (if SSL is enabled).
  • HTTPS_ADDRESS - Address on which the application should listen to (HTTPS endpoint, if SSL is enabled).
  • APPLICATION_SECRET - Application secret. It is obviously recommended to configure it as protected value in OpsWorks console.

You can of course use any other environment variable, they will be exposed to your application and you can even use them in the default application.conf. That's how the secret is passed in the default application configuration file:

play.http.secret.key=${?APPLICATION_SECRET}

Don't forget to take a look at the attributes opsworks.rb file to see the default values which are passed to the application_play resource.

Dependent cookbooks

application ~> 5.2.0
java_se >= 10.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

application_play CHANGELOG

0.2.2

Upgrade java_se dependency to v11.0.1.

0.2.1

Change how autoconfiguration of required_contact_point_nr works - use static quorum strategy by default.

0.2.0

Deprecate service_settings parameter in favor of more general systemd_settings. No backwards compatibility!
Fixed default systemd settings so no warnings are logged.

0.1.6

Add support for deploying Akka cluster and remote (with or without Akka management).

0.1.5

Add service_settings parameter to the application_play resource for overriding systemd service [Settings].

0.1.4

Prevent Chef from backing up release archives as they are handled by the application_play resource.

0.1.3

Added HTTPS support.

0.1.2

Updated opsworks_deploy recipe to deploy only applications denoted by aws_opsworks_command data bag items.

0.1.1

Added testing and contributing information.

0.1.0

Initial release.

Collaborator Number Metric
            

0.2.2 failed this metric

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

Contributing File Metric
            

0.2.2 passed this metric

Foodcritic Metric
            

0.2.2 passed this metric

No Binaries Metric
            

0.2.2 passed this metric

Testing File Metric
            

0.2.2 passed this metric

Version Tag Metric
            

0.2.2 passed this metric