Skip to content
This repository has been archived by the owner on Aug 14, 2021. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


As of December 2019, Momentum is no longer in use at Artsy and so this gem is unmaintained. Deployment via Opsworks has been deprecated in favor of deployment to kubernetes with the hokusai utility.

Shared utilities for managing and deploying OpsWorks apps at Artsy.


Add this line to your application's Gemfile, probably in the :development group:

gem 'momentum', require: false

In your application's Rakefile, add this line above the load_tasks command:

  require 'momentum'  # necessary b/c tasks from gems in :development group aren't loaded automatically
  Momentum.configure do |conf|
    conf[:app_base_name] = 'your_app_name'
rescue LoadError
  # momentum should only be installed in development

If you arent's using Rails / don't have access to the load_tasks command, you can load all rake tasks by adding require 'momentum/rake' to your project's Rakefile.

Finally, execute:

$ bundle


Momentum uses Berkshelf to package application cookbooks and expects a Berksfile present in the top-level of your project.


It's assumed that stacks are named with an app name and modifier, such as todo-production. The modifier is usually an environment, but might also be a developer name or some other label, such todo-joey.

Rake Tasks

This gem adds a few useful rake tasks to your project. By default, the aws_id and aws_secret arguments are taken from AWS_ID and AWS_SECRET ENV variables. The to argument refers to the modifier mentioned above (e.g., production). It's appended to the configured app_base_name to form the stack name.


Print the custom configuration values for the given stack. E.g.:

bundle exec rake ow:config[joey]


Add the given stack's custom configuration values to the current task's ENV. Can be prepended to other rake tasks that depend on the ENV, e.g.:

bundle exec rake ow:config:from_env[production] some:migration

ow:console[to,env,aws_id,aws_secret] [env ...]

Start a rails console on the given remote OpsWorks stack. Chooses an instance of the rails layer by default, or the configured rails_console_layer if provided. E.g.:

bundle exec rake ow:console[production]

For stacks with labels not matching the Rails environment (e.g., reflection-joey), provide a 2nd argument with the desired environment:

bundle exec rake ow:console[joey,staging]

To set environment variables for the remote process, specify them after the task name like you normally would with rake tasks:

bundle exec rake ow:console[production] SOME_ENV_VARIABLE=set-remotely


Package, upload, and propagate custom cookbooks to the given stack. Or, more concisely:

bundle exec rake ow:cookbooks:update[staging]
# or just:
bundle exec rake ow:cookbooks:update:staging


Trigger an OpsWorks deploy to the given stack. By default, deploys app to all running instances of the rails layer, or the list configured in app_layers. E.g.:

bundle exec rake ow:deploy[staging]
# or just:
bundle exec rake ow:deploy:staging


Execute a tail -f (follow) command against a remote log path on the given remote OpsWorks instance and stack. The path may include wildcards. E.g.:

bundle exec rake ow:logs[staging,rails1,/home/deploy/myapp/shared/log/staging.log]


SSH to an OpsWorks instance. If the layer_or_instance argument is a layer, an online instance is chosen randomly from the layer. Otherwise, the name of an online instance is expected. E.g.:

bundle exec rake ow:ssh[staging,memcached]
# or...
bundle exec rake ow:ssh[staging,rails1]


Execute a Chef recipe on the given layer in the given stack. By default, will execute recipes on all running instances of the rails layer, or the list configured in app_layers. E.g.:

bundle exec rake ow:execute_recipe[staging,rails,restart_unicorns]
# Assuming 'restart_unicorns' is a valid Chef recipe.


  • app_base_name - Your app's name. Stacks are assumed to be named like appbasename-env (e.g., gravity-staging or reflection-joey).
  • app_layers - Array of OpsWorks layer names to which this rails app should be deployed. Default: ['rails']
  • cookbooks_install_path - Local path where berkshelf will install cookbooks. Default: tmp/cookbooks.tgz
  • custom_cookbooks_bucket - Bucket to which custom cookbooks are uploaded. Default: artsy-cookbooks
  • rails_console_layer - The OpsWorks layer used for SSH-ing and starting a rails console. Default: rails

To Do

  • git/branch helpers
  • Tests

© 2014-2016 Artsy. See LICENSE for details.


Shared utilities for managing and deploying OpsWorks apps at Artsy. [DEPRECATED]



Security policy





No packages published