Top Level Namespace
Defined Under Namespace
Modules: Capistrano
Instance Method Summary collapse
Instance Method Details
#autoscale(groupnames, identifier_type, *args) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/capistrano/autoscale.rb', line 15 def autoscale(groupnames, identifier_type, *args) include Capistrano::DSL include Capistrano::Autoscale::Aws::AutoscalingGroup include Capistrano::Autoscale::Aws::EC2 set :aws_autoscale_groups, groupnames if autoscale_groups instances = [] autoscale_groups.each do |autoscale_group| group_instances = autoscale_group.instances.select do |instance| instance.lifecycle_state == 'InService' end instances += group_instances end instances.each_with_index do |instance, index| host = host_by_identifier(instance, identifier_type) p "[#{groupnames}] Autoscale deploying to: #{host}" if index == 0 server(host, args.first.merge(primary: true)) else server(host, *args) end end else p "Error: No #{groupnames} autoscale group found." end end |