Opsicle, an OpsWorks CLI

A gem bringing the glory of OpsWorks to your command line.

Gem Version Build Status

Installation

Add this line to your project's Gemfile:

For Ruby >=2.1.0

gem 'opsicle'
gem 'curses'

For Ruby <2.1.0, 1.9.3

gem 'opsicle'

(Alternatively, gem 'opsicle'; gem 'curses' unless RUBY_VERSION < "2.1.0")

Why the extra curses gem for Ruby 2.1.0+?
Opsicle uses curses. Ruby's library to interface with curses was removed from stdlib in Ruby 2.1.0. The new curses gem is not backwards compatible, so in an effort to keep this gem friendly with all current Ruby versions we don't list it as a dependency in Opsicle's gemspec - doing so would cause errors for Ruby 1.9.3 users. Ruby >=2.1.0 will likely be enforced sometime in 2014; certainly by February 2015.

Set up an Application to use opsicle

# your_app_root/.opsicle

staging:
  stack_id: opsworks-stack-id
  app_id: opsworks-app-id
production:
  stack_id: opsworks-stack-id
  app_id: opsworks-app-id
# ~/.fog

staging:
  aws_access_key_id: YOUR_AWS_ACCESS_KEY
  aws_secret_access_key: YOUR_AWS_SECRET_ACCESS_KEY
production:
  aws_access_key_id: YOUR_AWS_ACCESS_KEY
  aws_secret_access_key: YOUR_AWS_SECRET_ACCESS_KEY

Using Opsicle

Run opsicle help for a full list of commands and their uses.
Some common commands:

Deployments


# Run a basic deploy for the current app
opsicle deploy staging

# Run the deploy for production
opsicle deploy production

By default, deploying opens the Opsicle Stack Monitor. You may also use --browser to open the OpsWorks deployments screen instead, or --no-monitor to ignore both monitoring options

SSH

# SSH to a server instance in the given environment stack
opsicle ssh staging

# Set your user SSH key (PUBLIC KEY) for OpsWorks
opsicle ssh-key staging <key-file>

Stack Monitor

# Launch the Opsicle Stack Monitor for the given environment stack
opsicle monitor staging

Updating Custom Chef Recipes

 # Upload a cookbooks directory to S3 and update the stack's custom cookbooks
 opsicle chef-update staging --bucket-name my-opsworks-cookbooks

This command accepts a --path argument to the directory of cookbooks to upload. It defaults to 'cookbooks'. It also accepts a --bucket-name for the base s3 bucket. This flag is required.

Opsicle accepts a --verbose flag or the VERBOSE environment variable to show additional information as commands are run.

Opsicle accepts a DEBUG environment variable to show additional logging such as stack traces for failed commands.