Module: Opsworks::Deploy

Defined in:
lib/opsworks/deploy/version.rb,
lib/opsworks/deploy/railtie.rb,
lib/opsworks/deploy/deploy.rb

Defined Under Namespace

Classes: Deployment, Railtie

Constant Summary collapse

VERSION =
"0.0.6"
DEPLOYMENT_POLL_INTERVAL =
10

Class Method Summary collapse

Class Method Details

.configure_aws!Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/opsworks/deploy/deploy.rb', line 9

def self.configure_aws!
  # First, try to pull these from the environment
  iam_key = ENV['IAM_KEY']
  iam_secret = ENV['IAM_SECRET']

  # Otherwise, we'll pull them from config
  if ( iam_key.nil? || iam_secret.nil? ) && ENV['AWS_CONFIG_FILE']
    config = File.read(ENV['AWS_CONFIG_FILE'])
    iam_key = $1 if config =~ /^aws_access_key_id=(.*)$/
    iam_secret = $1 if config =~ /^aws_secret_access_key=(.*)$/
  end

  raise ArgumentError, "Must set IAM_KEY environment variable" if iam_key.nil? || iam_key.length == 0
  raise ArgumentError, "Must set IAM_SECRET environment variable" if iam_secret.nil? || iam_secret.length == 0

  AWS.config(access_key_id: iam_key, secret_access_key: iam_secret)
end

.deploy(opts = {}) ⇒ Object



27
28
29
30
# File 'lib/opsworks/deploy/deploy.rb', line 27

def self.deploy(opts={})
  Opsworks::Deploy.configure_aws!
  Deployment.new(opts).deploy
end