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


opsworks_ruby (45) Versions 0.8.0

Set of chef recipes for OpsWorks based Ruby projects

cookbook 'opsworks_ruby', '= 0.8.0', :supermarket
cookbook 'opsworks_ruby', '= 0.8.0'
knife supermarket install opsworks_ruby
knife supermarket download opsworks_ruby
Quality 50%

opsworks_ruby Cookbook

Chef cookbook
Build Status
Coverage Status
Commitizen friendly

A chef cookbook to deploy Ruby applications to Amazon OpsWorks.

Quick Start

This cookbook is designed to "just work". So in base case scenario, all you have
to do is create a layer and application with an optional assigned RDS data source,
then add recipes to the corresponding OpsWorks actions.


  • Database
    • MariaDB
    • MySQL
    • PostgreSQL
    • Sqlite3
  • SCM
    • git
  • Framework
    • Ruby on Rails
  • App server
    • Unicorn
  • Web server
    • nginx
  • Worker
    • Null (no worker)
    • sidekiq




This cookbook was tested on the following OpsWorks platforms:

  • Amazon Linux 2016.03
  • Amazon Linux 2015.09
  • Amazon Linux 2015.03
  • Ubuntu 14.04 LTS
  • Ubuntu 12.04 LTS

In addition, all recent Debian family distrubutions are assumed to work.


Attributes format follows the guidelines of old Chef 11.x based OpsWorks stack.
So all of them, need to be placed under node['deploy'][<application_shortname>].
Attributes (and whole logic of this cookbook) are divided to six sections.
Following convention is used: app == node['deploy'][<application_shortname>]
so for example app['framework']['adapter'] actually means


  • node['applications']
    • An array of application shortnames which should be deployed to given layer. If not provided, all detected applications will be deployed.


Global parameters apply to the whole application, and can be used by any section
(framework, appserver etc.).

  • app['environment']
    • Default: production
    • Sets the "deploy environment" for all the app-related (for example RAILS_ENV in Rails) actions in the project (server, worker, etc.)


Those parameters will be passed without any alteration to the database.yml
file. Keep in mind, that if you have RDS connected to your OpsWorks application,
you don't need to use them. The chef will do all the job, and determine them
for you.

  • app['database']['adapter']
    • Supported values: mariadb, mysql, postgresql, sqlite3
    • Default: sqlite3
    • ActiveRecord adapter which will be used for database connection.
  • app['database']['username']
    • Username used to authenticate to the DB
  • app['database']['password']
    • Password used to authenticate to the DB
  • app['database']['host']
    • Database host
  • app['database']['database']
    • Database name
  • app['database'][<any other>]
    • Any other key-value pair provided here, will be passed directly to the database.yml


Those parameters can also be determined from OpsWorks application, and usually
you don't need to provide them here. Currently only git is supported.

  • app['scm']['scm_provider']
    • Supported values: git
    • Default: git
    • SCM used by the cookbook to clone the repo.
  • app['scm']['remove_scm_files']
    • Supported values: true, false
    • Default: true
    • If set to true, all SCM leftovers (like .git) will be removed.
  • app['scm']['repository']
    • Repository URL
  • app['scm']['revision']
    • Branch name/SHA1 of commit which should be use as a base of the deployment.
  • app['scm']['ssh_key']
    • A private SSH deploy key (the key itself, not the file name), used when fetching repositories via SSH.
  • app['scm']['ssh_wrapper']
    • A wrapper script, which will be used by git when fetching repository via SSH. Essentially, a value of GIT_SSH environment variable. This cookbook provides one of those scripts for you, so you shouldn't alter this variable unless you know what you're doing.
  • app['scm']['enabled_submodules']
    • If set to true, any submodules included in the repository, will also be fetched.


Pre-optimalization for specific frameworks (like migrations, cache etc.).
Currently only Rails is supported.

  • app['framework']['adapter']
    • Supported values: rails
    • Default: rails
    • Ruby framework used in project.
  • app['framework']['migrate']
    • Supported values: true, false
    • Default: true
    • If set to true, migrations will be launch during deployment.
  • app['framework']['migration_command']
    • A command which will be invoked to perform migration. This cookbook comes with predefined migration commands, well suited for the task, and usually you don't have to change this parameter.
  • app['framework']['assets_precompile']
    • Supported values: true, false
    • Default: true
  • app['framework']['assets_precompilation_command']
    • A command which will be invoked to precompile assets.


Configuration parameters for the ruby application server. Currently only
Unicorn is supported.


Webserver configuration. Proxy passing to application is handled out-of-the-box.
Currently only nginx is supported.

  • app['webserver']['adapter']
    • Default: nginx
    • Supported values: nginx, null
    • Webserver in front of the instance. It runs on port 80, and receives all requests from Load Balancer/Internet. null means no webserver enabled.
  • app['webserver']['build_type']
    • Supported values: default or source
    • Default: default
    • The way the nginx cookbooks handles nginx installation. Check out the corresponding docs for more details. Never use node['nginx']['install_method'], as it will be always overwritten by this attribute.
  • app['webserver']['client_body_timeout']
    • Default: 12
  • app['webserver']['client_header_timeout']
    • Default: 12
  • app['webserver']['client_max_body_size']
    • Default: 10m
  • app['webserver']['dhparams']
    • If you wish to use custom generated DH primes, instead of common ones (which is a very good practice), put the contents (not file name) of the dhparams.pem file into this attribute. Read more here.
  • app['webserver']['extra_config']
    • Raw nginx configuration, which will be inserted into server section of the application for HTTP port.
  • app['webserver']['extra_config_ssl']
    • Raw nginx configuration, which will be inserted into server section of the application for HTTPS port. If set to true, the extra_config will be copied.
  • app['webserver']['keepalive_timeout']
    • Default: 15
  • app['webserver']['log_dir']
    • Default: /var/log/nginx
    • A place to store application-related nginx logs.
  • app['webserver']['proxy_read_timeout']
    • Default: 60
  • app['webserver']['proxy_send_timeout']
    • Default: 60
  • app['webserver']['send_timeout']
    • Default: 10
  • app['webserver']['ssl_for_legacy_browsers']
    • Supported values: true, false
    • Default: false
    • By default nginx is configured to follow strict SSL security standards, covered in this article. However, old browsers (like IE < 9 or Android < 2.2) wouldn't work with this configuration very well. If your application needs a support for those browsers, set this parameter to true.

Since this driver is basically a wrapper for nginx cookbook,
you can also configure node['nginx'] attributes
as well (notice that node['deploy'][<application_shortname>] logic doesn't
apply here.)


Configuration for ruby workers. Currenty Null (no worker) and Sidekiq
are supported. Every worker is covered by monitd daemon out-of-the-box.

  • app['worker']['adapter']
    • Default: null
    • Supported values: null, sidekiq
    • Worker used to perform background tasks. null means no worker enabled.
  • app['worker']['process_count']
    • ** Default:** 2
    • How many separate worker processes will be launched.
  • app['worker']['syslog']
    • Default: true
    • Supported values: true, false
    • Log worker output to syslog?
  • app['worker']['config']
    • Configuration parameters which will be directly passed to the worker. For example, for sidekiq they will be serialized to sidekiq.yml config file.


This cookbook provides five main recipes, which should be attached
to corresponding OpsWorks actions.

  • opsworks_ruby::setup - attach to Setup
  • opsworks_ruby::configure - attach to Configure
  • opsworks_ruby::deploy - attach to Deploy
  • opsworks_ruby::undeploy - attach to Undeploy
  • opsworks_ruby::shutdown - attach to Shutdown


for details.

Author and Contributors

Author: Igor Rzegocki <>



License: MIT

Dependent cookbooks

build-essential ~> 2.0
deployer >= 0.0.0
ruby-ng >= 0.0.0
nginx ~> 2.7

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

<a name="0.8.0"></a>

0.8.0 (2016-09-02)

Bug Fixes

  • Switched from nginx reload to nginx restart after succesful deploy/undeploy (16ab9d1), closes #36


  • Added GIT_SSH support for bundle install (232e8ac), closes #37
  • Caches bundler installs to speed up deployments (baa0f44)
  • Implemented configurable RAILS_ENV (2567b71), closes #34

<a name="0.7.0"></a>

0.7.0 (2016-08-29)

Bug Fixes

  • Moved extra env files creation, later in the stack (before_restart) (8a5223f)
  • Reload monit after restarting services (eaa2aab)
  • Set the default DB adapter to sqlite3 (b4b1ee4)
  • specify bundle path on bundle install (b9d4335)


  • Added support for gems like figaro and dotenv (c989494), closes #28

<a name="0.6.0"></a>

0.6.0 (2016-08-17)


  • Removed application_ruby cookbook dependency

<a name="0.5.0"></a>

0.5.0 (2016-07-21)


  • Added configuration for isolated worker servers w/o app/webserver (56642f1)
  • Added monit compatibility with amazon linux (2ef12b9)

<a name="0.4.0"></a>

0.4.0 (2016-06-16)


  • Enables drivers to be attached to before_* and after_* deploy events (fa8e605)

<a name="0.3.1"></a>

0.3.1 (2016-06-16)

Bug Fixes

  • Change path to 500.html to be in the "current" dir (4aeac7f)
  • Support for multiple RDSes with multiple applications (a23df47)

<a name="0.3.0"></a>

0.3.0 (2016-06-08)


  • eliminate RDS requirement (daa4254)


  • Sqlite3 is no longer set as the default database adapter.

In order to use sqlite as the database adapter it must be defined
in the node.

<a name="0.2.1"></a>

0.2.1 (2016-05-11)

  • Added environment variables support for assets precompile (f24e742)
  • Added optional removal of scm files (82b25ec)
  • Added support for custom configuration in nginx (448019a)
  • Fixed deploy environment (bf843aa)
  • Fixed nginx defaults order (af560db)
  • Fixed sidekiq config builder (a32b410)

<a name="0.2.0"></a>

0.2.0 (2016-04-24)

  • Added MariaDB Driver support (197b7de)
  • Added multi-platform support (6118154)
  • Added MySQL Driver support (72d4b9f)
  • Added Sqlite Driver support (3ecb321)
  • Minor bugfixes, resolves #19 (9f8615f), closes #19

<a name="0.1.0"></a>

0.1.0 (2016-04-23)

  • configure recipe initial implementation (c57f71e)
  • Added assets precompilation support. Resolves #12 (b8d8ff5), closes #12
  • Added auto-start of nginx to setup phase. Resolves #15 (fbb07dc), closes #15
  • Added basic documentation (235519f)
  • Added code quality tools (730857f)
  • Added core_ext specs. Resolves #7 (b089eb3), closes #7
  • Added DHparams and nginx version detection support. Resolves #8 and resolves #9 (4e60594), closes #8 #9
  • Added missing specs (ff85e4f)
  • Added nginx reload after deploy. Resolves #13 (f1bc277), closes #13
  • Added ruby and bundler installation to setup phase (0182e70), closes #5 #6
  • Added symlinking defaults. Resolves #16 (4a1edd9), closes #16
  • Added travis config and coveralls support (a782a64)
  • Added undeploy recipe (aba311b)
  • Added webserver setup (nginx) (1581def)
  • Added workers support. Resolves #18 (05e3a75), closes #18
  • Appserver implemented (unicorn) (bbb79cc)
  • Basic SCM support implemented (bcab3d7)
  • Finished database support in recipes (cf955a0)
  • Fixed appserver restart sequence (9a75f9c)
  • Fixed nginx defaults. Resolves #14 and resolves #17 (8320f3b), closes #14 #17
  • Fixes on bugs detected while deploying to real OpsWorks (035363b)
  • Initial commit (d8bed5c)
  • Initial version, with simple postgresql driver introduced (5d00083)
  • Moved DB packages installation from configure to setup (e23f2d4)
  • Moved libraries to flat directory structure, because AWS chef hates us (e6aa211)
  • Rails deploy hooks implemented (79d2d64)
  • Recipes cleanup: added missing actions and shutdown recipe (9eb9bb8)
  • Reorganized appserver cookbooks, added bundle install to deploy (2e9947b)

Collaborator Number Metric

0.8.0 failed this metric

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

Foodcritic Metric

0.8.0 passed this metric