Class: Broadside::Deploy

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/broadside/deploy.rb

Direct Known Subclasses

EcsDeploy

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#config, #debug, #error, #exception, #info, #warn

Constructor Details

#initialize(opts) ⇒ Deploy

Returns a new instance of Deploy.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/broadside/deploy.rb', line 7

def initialize(opts)
  @deploy_config = Broadside.config.deploy.dup
  @deploy_config.tag = opts[:tag]           || @deploy_config.tag
  @deploy_config.target = opts[:target]     || @deploy_config.target
  @deploy_config.verify(:target, :targets)
  @deploy_config.load_target!

  @deploy_config.scale = opts[:scale]       || @deploy_config.scale
  @deploy_config.rollback = opts[:rollback] || @deploy_config.rollback
  @deploy_config.instance = opts[:instance] || @deploy_config.instance
  @deploy_config.command = opts[:command]   || @deploy_config.command
end

Instance Attribute Details

#deploy_configObject

Returns the value of attribute deploy_config.



5
6
7
# File 'lib/broadside/deploy.rb', line 5

def deploy_config
  @deploy_config
end

Instance Method Details

#bashObject



79
80
81
82
# File 'lib/broadside/deploy.rb', line 79

def bash
  @deploy_config.verify(:instance)
  yield
end

#deployObject



29
30
31
32
33
34
# File 'lib/broadside/deploy.rb', line 29

def deploy
  @deploy_config.verify(:tag)
  info "Deploying #{image_tag} to #{family}..."
  yield
  info 'Deployment complete.'
end

#fullObject



24
25
26
27
# File 'lib/broadside/deploy.rb', line 24

def full
  run_predeploy
  deploy
end

#logtailObject



69
70
71
72
# File 'lib/broadside/deploy.rb', line 69

def logtail
  @deploy_config.verify(:instance)
  yield
end

#rollback(count = @deploy_config.rollback) ⇒ Object



36
37
38
39
40
41
# File 'lib/broadside/deploy.rb', line 36

def rollback(count = @deploy_config.rollback)
  @deploy_config.verify(:rollback)
  info "Rolling back #{@deploy_config.rollback} release for #{family}..."
  yield
  info 'Rollback complete.'
end

#runObject



49
50
51
52
53
54
# File 'lib/broadside/deploy.rb', line 49

def run
  @deploy_config.verify(:tag, :ssh, :command)
  info "Running command [#{@deploy_config.command}] for #{family}..."
  yield
  info 'Complete.'
end

#run_predeployObject



56
57
58
59
60
61
# File 'lib/broadside/deploy.rb', line 56

def run_predeploy
  @deploy_config.verify(:tag, :ssh)
  info "Running predeploy commands for #{family}..."
  yield
  info 'Predeploy complete.'
end

#scaleObject



43
44
45
46
47
# File 'lib/broadside/deploy.rb', line 43

def scale
  info "Rescaling #{family} with scale=#{@deploy_config.scale}"
  yield
  info 'Rescaling complete.'
end

#shortObject



20
21
22
# File 'lib/broadside/deploy.rb', line 20

def short
  deploy
end

#sshObject



74
75
76
77
# File 'lib/broadside/deploy.rb', line 74

def ssh
  @deploy_config.verify(:instance)
  yield
end

#statusObject



63
64
65
66
67
# File 'lib/broadside/deploy.rb', line 63

def status
  info "Getting status information about #{family}"
  yield
  info 'Complete.'
end