elastic_beans 1.1.0 → 1.2.0.alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1304b62b8e94e71c473dbfd82c8ca925076330ee
4
- data.tar.gz: 1a0ede081f5d77071039d0591bd3a982d286c125
3
+ metadata.gz: 445b81d2f818741c42691b6e727e34da7a4646a7
4
+ data.tar.gz: ad2ed2724428345abe8caaf64a003d6724bd413e
5
5
  SHA512:
6
- metadata.gz: 1fae1a0b942fec317e9d0cf5cfde5b2ce4a70982b6965242a105ecd93009b325f1767f5685158f98a28e9b5b12e888b6fc4730917c73089b12382a41b85901c7
7
- data.tar.gz: fddb30ed342dacf0091b913480d7419dbd3e3c4caaf174d54d58a0e0e56b9912f76aa9578d3ee301f236fb75bc0ed6ce285402ccbb5992c510aba60d24654bb0
6
+ metadata.gz: a3a88cf55be625e0d26d4db87f106712c2b3dedbb871b100016d6706a00cb4071a3a1d03b92479999c524de59aad2644fd82b66ca9567103264fd7734dfb45ed
7
+ data.tar.gz: 881cd193cb819b9592167e7e88b071abb4aeb364a7a70699e5ad03e9c0dc6edf314779d89116421362124494b9961d1c613f421e869a4fc8d25576c1718e6ebb
@@ -34,8 +34,25 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
34
34
  raise EnvironmentsNotReady.new(environments: [environment])
35
35
  end
36
36
 
37
+ config = ElasticBeans::ConfigurationTemplate.new_by_type(
38
+ environment_type,
39
+ queue: queue,
40
+ application: application,
41
+ elastic_beanstalk: elastic_beanstalk,
42
+ )
43
+
37
44
  progressbar = ProgressBar.create(title: "Configuring", total: nil, output: ui.stdout)
45
+ update_configuration(config, progressbar: progressbar)
46
+ scale_environment(environment, progressbar: progressbar)
47
+
48
+ clean_up_enqueued_commands(environment: environment) if environment_type == "exec"
49
+ end
50
+
51
+ private
38
52
 
53
+ attr_reader :application, :minimum, :maximum, :queue, :elastic_beanstalk, :ui
54
+
55
+ def update_configuration(config, progressbar:)
39
56
  Signal.trap("INT") do
40
57
  puts "\nInterrupting beans"
41
58
  puts "WARNING: Configuration update is partially applied, you should run this command again"
@@ -48,12 +65,6 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
48
65
  end
49
66
 
50
67
  thread = Thread.new do
51
- config = ElasticBeans::ConfigurationTemplate.new_by_type(
52
- environment_type,
53
- queue: queue,
54
- application: application,
55
- elastic_beanstalk: elastic_beanstalk,
56
- )
57
68
  progressbar.log("Updating `#{config.name}' configuration template in #{application.name}...")
58
69
  config.upsert(min_size: minimum, max_size: maximum)
59
70
  end
@@ -65,7 +76,9 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
65
76
  end
66
77
  end
67
78
  thread.join
79
+ end
68
80
 
81
+ def scale_environment(environment, progressbar:)
69
82
  Signal.trap("INT") do
70
83
  puts "\nInterrupting beans"
71
84
  puts "Scaling still in progress, follow it in the AWS console"
@@ -92,9 +105,17 @@ Requires AWS credentials to be set in the environment, i.e. AWS_ACCESS_KEY_ID an
92
105
  thread.join
93
106
  end
94
107
 
95
- private
96
-
97
- attr_reader :application, :minimum, :maximum, :queue, :elastic_beanstalk, :ui
108
+ def clean_up_enqueued_commands(environment:)
109
+ commands = application.enqueued_commands
110
+ instance_ids = environment.instance_ids
111
+ progressbar = ProgressBar.create(title: "Cleaning up", total: commands.size, output: ui.stdout)
112
+ commands.each do |command|
113
+ if command.instance_id && !instance_ids.include?(command.instance_id)
114
+ application.deregister_command(command)
115
+ end
116
+ progressbar.increment
117
+ end
118
+ end
98
119
  end
99
120
  end
100
121
  end
@@ -1,3 +1,3 @@
1
1
  module ElasticBeans
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.2.0.alpha1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_beans
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Stegman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-05 00:00:00.000000000 Z
11
+ date: 2018-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -251,12 +251,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
251
251
  version: '0'
252
252
  required_rubygems_version: !ruby/object:Gem::Requirement
253
253
  requirements:
254
- - - ">="
254
+ - - ">"
255
255
  - !ruby/object:Gem::Version
256
- version: '0'
256
+ version: 1.3.1
257
257
  requirements: []
258
258
  rubyforge_project:
259
- rubygems_version: 2.5.1
259
+ rubygems_version: 2.6.11
260
260
  signing_key:
261
261
  specification_version: 4
262
262
  summary: Elastic Beanstalk environment orchestration for a Rails app