Standup

Standup is an application deployment and infrastructure management tool for Rails and Amazon EC2.

Basic usage

  1. gem install standup
  2. cd path/to/your/rails/project
  3. standup init
  4. Fill in actual settings in generated file config/standup.yml
  5. standup setup
  6. standup status

Config file

It consists of 3 major parts:

Amazon Web Services credentials

aws:
  account_id: 0123-4567-8910
  access_key_id: GTFGV123P45DRDKOBBVP
  secret_access_key: jKkjhkjbb1Bhjh+MBG0GBbmuhdGh/Kgbdhzbd9sd
  keypair_name: aws
  availability_zone: us-east-1c

Here, keypair_name is keypair filename, without .pem extension. By default, Standup searches actual file under ~/.ssh directory. You can override this behavior by specifying keypair_file param.

Global script params

ec2:
  image_id: ami-480df921 # Canonical Ubuntu 10.04, EBS boot
  instance_type: m1.small
  ssh_user: ubuntu
webapp:
  name: superproject
  github_user: supercoder
  github_repo: superproject

Major part of script params can be set here. In webapp script name param is used for database name and application path.

Nodes and their script params

nodes:
  main:
    ec2:
      elastic_ip: 123.123.123.123
  testing:
  staging:

Here, under nodes section, should go actual nodes (server instances) which you want to manage. For each node, you can specify additional script params. In this example, elastic_ip param of ec2 script is set for node main.

Script params are merged in node-specific || global || script-defaults manner.

Tweaking bundled scripts

  1. standup localize <script_name>
  2. Script file config/standup/<script_name>.rb will be copied from gem.
  3. Script's own files, like configs etc. under config/standup/<script_name>, if any, will be copied from gem too.
  4. You can edit them and standup will use them instead of default.
  5. You can delete local script file or its own files, then default ones will be used.

Creating new scripts

  1. standup generate <script_name>
  2. Script file config/standup/<script_name>.rb will be created with empty script stub.
  3. Edit it as you want, it's now available for Standup.

Setup script

Setup script automates common Rails application deployment workflow.

If you want to add your script into this workflow, just set it as script param, thus overwriting default.

For example, if you want to add rescue to your configuration, you need to:

  1. Write that rescue script
  2. Change standup.yml like the following:

    nodes:
      main:
        ...
        setup:
          ec2 basics ruby postgresql passenger rescue webapp update 
    

To do

  • ? Script sequences: rework default script as script sequence
  • change shell for www-data user
  • change owner of /home/ubuntu/.irb-history

Copyright (c) 2010 Ilia Ablamonov, Cloud Castle Inc. See LICENSE for details.