capistrano-asg-rolling 0.5.1 → 0.7.0
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 +4 -4
- data/.github/workflows/test.yml +1 -1
- data/.rubocop.yml +2 -3
- data/Gemfile +0 -1
- data/Gemfile.lock +68 -58
- data/README.md +28 -1
- data/capistrano-asg-rolling.gemspec +1 -1
- data/lib/capistrano/asg/rolling/autoscale_group.rb +6 -1
- data/lib/capistrano/asg/rolling/autoscale_groups.rb +2 -2
- data/lib/capistrano/asg/rolling/exception.rb +7 -0
- data/lib/capistrano/asg/rolling/instance.rb +0 -12
- data/lib/capistrano/asg/rolling/instances.rb +2 -6
- data/lib/capistrano/asg/rolling/launch_templates.rb +2 -2
- data/lib/capistrano/asg/rolling/plugin.rb +11 -0
- data/lib/capistrano/asg/rolling/ssh.rb +26 -7
- data/lib/capistrano/asg/rolling/tags.rb +6 -1
- data/lib/capistrano/asg/rolling/version.rb +1 -1
- data/lib/capistrano/asg/tasks/rolling.rake +17 -9
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cceded2d7adcb767bc8bb432781055a91af8268303514564a4c1de86ccb2ac2e
|
|
4
|
+
data.tar.gz: 8d08579c0a00000bb2457348e9808758d10d74751a08f7071e50fa794fb1ea72
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 964743e3ab4ad9813100f3968e45b044d80fc46d6e9141a85b07686b0b4566f8c12bb79f3614fa5d473b358782d3c002d03532f72b60440b666423c4bc5e4947
|
|
7
|
+
data.tar.gz: 3366b9a2268485d777a101d1f29335aba073979122347c48e3191f318188ed3ce41eb2f3ec39861b286fa4a0148f9632af23b1d57f93f4e1d857f8f742e929b8
|
data/.github/workflows/test.yml
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
capistrano-asg-rolling (0.
|
|
4
|
+
capistrano-asg-rolling (0.7.0)
|
|
5
5
|
aws-sdk-autoscaling (~> 1, >= 1.100.0)
|
|
6
6
|
aws-sdk-ec2 (~> 1)
|
|
7
7
|
capistrano (~> 3)
|
|
@@ -10,104 +10,115 @@ PATH
|
|
|
10
10
|
GEM
|
|
11
11
|
remote: https://rubygems.org/
|
|
12
12
|
specs:
|
|
13
|
-
addressable (2.8.
|
|
14
|
-
public_suffix (>= 2.0.2, <
|
|
15
|
-
airbrussh (1.
|
|
13
|
+
addressable (2.8.8)
|
|
14
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
15
|
+
airbrussh (1.6.0)
|
|
16
16
|
sshkit (>= 1.6.1, != 1.7.0)
|
|
17
|
-
ast (2.4.
|
|
18
|
-
aws-eventstream (1.
|
|
19
|
-
aws-partitions (1.
|
|
20
|
-
aws-sdk-autoscaling (1.
|
|
21
|
-
aws-sdk-core (~> 3, >= 3.
|
|
17
|
+
ast (2.4.3)
|
|
18
|
+
aws-eventstream (1.4.0)
|
|
19
|
+
aws-partitions (1.1198.0)
|
|
20
|
+
aws-sdk-autoscaling (1.149.0)
|
|
21
|
+
aws-sdk-core (~> 3, >= 3.239.1)
|
|
22
22
|
aws-sigv4 (~> 1.5)
|
|
23
|
-
aws-sdk-core (3.
|
|
23
|
+
aws-sdk-core (3.240.0)
|
|
24
24
|
aws-eventstream (~> 1, >= 1.3.0)
|
|
25
25
|
aws-partitions (~> 1, >= 1.992.0)
|
|
26
26
|
aws-sigv4 (~> 1.9)
|
|
27
|
+
base64
|
|
28
|
+
bigdecimal
|
|
27
29
|
jmespath (~> 1, >= 1.6.1)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
logger
|
|
31
|
+
aws-sdk-ec2 (1.587.0)
|
|
32
|
+
aws-sdk-core (~> 3, >= 3.239.1)
|
|
30
33
|
aws-sigv4 (~> 1.5)
|
|
31
|
-
aws-sigv4 (1.
|
|
34
|
+
aws-sigv4 (1.12.1)
|
|
32
35
|
aws-eventstream (~> 1, >= 1.0.2)
|
|
33
|
-
base64 (0.
|
|
34
|
-
bigdecimal (
|
|
35
|
-
capistrano (3.
|
|
36
|
+
base64 (0.3.0)
|
|
37
|
+
bigdecimal (4.0.1)
|
|
38
|
+
capistrano (3.20.0)
|
|
36
39
|
airbrussh (>= 1.0.0)
|
|
37
40
|
i18n
|
|
38
41
|
rake (>= 10.0.0)
|
|
39
42
|
sshkit (>= 1.9.0)
|
|
40
|
-
concurrent-ruby (1.3.
|
|
41
|
-
crack (1.0.
|
|
43
|
+
concurrent-ruby (1.3.6)
|
|
44
|
+
crack (1.0.1)
|
|
42
45
|
bigdecimal
|
|
43
46
|
rexml
|
|
44
|
-
diff-lcs (1.
|
|
45
|
-
hashdiff (1.
|
|
46
|
-
i18n (1.14.
|
|
47
|
+
diff-lcs (1.6.2)
|
|
48
|
+
hashdiff (1.2.1)
|
|
49
|
+
i18n (1.14.8)
|
|
47
50
|
concurrent-ruby (~> 1.0)
|
|
48
51
|
jmespath (1.6.2)
|
|
49
|
-
json (2.
|
|
50
|
-
language_server-protocol (3.17.0.
|
|
51
|
-
|
|
52
|
+
json (2.18.0)
|
|
53
|
+
language_server-protocol (3.17.0.5)
|
|
54
|
+
lint_roller (1.1.0)
|
|
55
|
+
logger (1.7.0)
|
|
56
|
+
net-scp (4.1.0)
|
|
52
57
|
net-ssh (>= 2.6.5, < 8.0.0)
|
|
53
58
|
net-sftp (4.0.0)
|
|
54
59
|
net-ssh (>= 5.0.0, < 8.0.0)
|
|
55
60
|
net-ssh (7.3.0)
|
|
56
|
-
ostruct (0.6.
|
|
57
|
-
parallel (1.
|
|
58
|
-
parser (3.3.
|
|
61
|
+
ostruct (0.6.3)
|
|
62
|
+
parallel (1.27.0)
|
|
63
|
+
parser (3.3.10.0)
|
|
59
64
|
ast (~> 2.4.1)
|
|
60
65
|
racc
|
|
61
|
-
|
|
66
|
+
prism (1.7.0)
|
|
67
|
+
public_suffix (6.0.2)
|
|
62
68
|
racc (1.8.1)
|
|
63
69
|
rainbow (3.1.1)
|
|
64
|
-
rake (13.
|
|
65
|
-
regexp_parser (2.
|
|
66
|
-
rexml (3.
|
|
67
|
-
rspec (3.13.
|
|
70
|
+
rake (13.3.1)
|
|
71
|
+
regexp_parser (2.11.3)
|
|
72
|
+
rexml (3.4.4)
|
|
73
|
+
rspec (3.13.2)
|
|
68
74
|
rspec-core (~> 3.13.0)
|
|
69
75
|
rspec-expectations (~> 3.13.0)
|
|
70
76
|
rspec-mocks (~> 3.13.0)
|
|
71
|
-
rspec-core (3.13.
|
|
77
|
+
rspec-core (3.13.6)
|
|
72
78
|
rspec-support (~> 3.13.0)
|
|
73
|
-
rspec-expectations (3.13.
|
|
79
|
+
rspec-expectations (3.13.5)
|
|
74
80
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
75
81
|
rspec-support (~> 3.13.0)
|
|
76
|
-
rspec-mocks (3.13.
|
|
82
|
+
rspec-mocks (3.13.7)
|
|
77
83
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
78
84
|
rspec-support (~> 3.13.0)
|
|
79
|
-
rspec-support (3.13.
|
|
80
|
-
rubocop (1.
|
|
85
|
+
rspec-support (3.13.6)
|
|
86
|
+
rubocop (1.82.0)
|
|
81
87
|
json (~> 2.3)
|
|
82
|
-
language_server-protocol (
|
|
88
|
+
language_server-protocol (~> 3.17.0.2)
|
|
89
|
+
lint_roller (~> 1.1.0)
|
|
83
90
|
parallel (~> 1.10)
|
|
84
91
|
parser (>= 3.3.0.2)
|
|
85
92
|
rainbow (>= 2.2.2, < 4.0)
|
|
86
|
-
regexp_parser (>= 2.
|
|
87
|
-
rubocop-ast (>= 1.
|
|
93
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
94
|
+
rubocop-ast (>= 1.48.0, < 2.0)
|
|
88
95
|
ruby-progressbar (~> 1.7)
|
|
89
|
-
unicode-display_width (>= 2.4.0, <
|
|
90
|
-
rubocop-ast (1.
|
|
91
|
-
parser (>= 3.3.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
rubocop (
|
|
97
|
-
rubocop-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
97
|
+
rubocop-ast (1.48.0)
|
|
98
|
+
parser (>= 3.3.7.2)
|
|
99
|
+
prism (~> 1.4)
|
|
100
|
+
rubocop-performance (1.26.1)
|
|
101
|
+
lint_roller (~> 1.1)
|
|
102
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
103
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
104
|
+
rubocop-rake (0.7.1)
|
|
105
|
+
lint_roller (~> 1.1)
|
|
106
|
+
rubocop (>= 1.72.1)
|
|
107
|
+
rubocop-rspec (3.8.0)
|
|
108
|
+
lint_roller (~> 1.1)
|
|
109
|
+
rubocop (~> 1.81)
|
|
102
110
|
ruby-progressbar (1.13.0)
|
|
103
|
-
sshkit (1.
|
|
111
|
+
sshkit (1.25.0)
|
|
104
112
|
base64
|
|
113
|
+
logger
|
|
105
114
|
net-scp (>= 1.1.2)
|
|
106
115
|
net-sftp (>= 2.1.2)
|
|
107
116
|
net-ssh (>= 2.8.0)
|
|
108
117
|
ostruct
|
|
109
|
-
unicode-display_width (2.
|
|
110
|
-
|
|
118
|
+
unicode-display_width (3.2.0)
|
|
119
|
+
unicode-emoji (~> 4.1)
|
|
120
|
+
unicode-emoji (4.2.0)
|
|
121
|
+
webmock (3.26.1)
|
|
111
122
|
addressable (>= 2.8.0)
|
|
112
123
|
crack (>= 0.3.2)
|
|
113
124
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
@@ -124,8 +135,7 @@ DEPENDENCIES
|
|
|
124
135
|
rubocop-performance (~> 1.20)
|
|
125
136
|
rubocop-rake (~> 0.6)
|
|
126
137
|
rubocop-rspec (~> 3.0)
|
|
127
|
-
rubocop-rspec_rails (~> 2.30)
|
|
128
138
|
webmock (~> 3.11)
|
|
129
139
|
|
|
130
140
|
BUNDLED WITH
|
|
131
|
-
2.
|
|
141
|
+
2.6.7
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/capistrano-asg-rolling)
|
|
4
4
|
[](https://github.com/KentaaNL/capistrano-asg-rolling/actions)
|
|
5
|
-
[](https://github.com/KentaaNL/capistrano-asg-rolling/actions/workflows/github-code-scanning/codeql)
|
|
6
6
|
|
|
7
7
|
Capistrano plugin for performing rolling updates to AWS Auto Scaling Groups using the [instance refresh feature](https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-refresh.html).
|
|
8
8
|
|
|
@@ -106,6 +106,13 @@ set :asg_wait_for_instance_refresh, true
|
|
|
106
106
|
set :asg_instance_refresh_polling_interval, 30 # default
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
+
Enable or disable auto-rollback on instance refreshes (default: false):
|
|
110
|
+
|
|
111
|
+
```ruby
|
|
112
|
+
# config/deploy.rb
|
|
113
|
+
set :asg_instance_refresh_auto_rollback, true
|
|
114
|
+
```
|
|
115
|
+
|
|
109
116
|
## Usage
|
|
110
117
|
|
|
111
118
|
Specify the Auto Scaling Groups with the keyword `autoscale` instead of using the `server` keyword in Capistrano's stage configuration. Provide the name of the Auto Scaling Group and any properties you want to pass to the server:
|
|
@@ -174,6 +181,26 @@ autoscale 'web-autoscale-group', rolling: true, user: 'deployer'
|
|
|
174
181
|
|
|
175
182
|
With these two stages, you can run any tasks with `cap production <task name>` and rolling deployments with `cap production_rolling deploy`.
|
|
176
183
|
|
|
184
|
+
### Tags
|
|
185
|
+
|
|
186
|
+
During deployment, the following tags will be added to the AMI and snapshot containing information about the current application, stage and deployment:
|
|
187
|
+
- `capistrano-asg-rolling:application`
|
|
188
|
+
- `capistrano-asg-rolling:stage`
|
|
189
|
+
- `capistrano-asg-rolling:deployment-branch`
|
|
190
|
+
- `capistrano-asg-rolling:deployment-release`
|
|
191
|
+
- `capistrano-asg-rolling:deployment-revision`
|
|
192
|
+
- `capistrano-asg-rolling:deployment-user`
|
|
193
|
+
|
|
194
|
+
In addition to that, the tag `capistrano-asg-rolling:gem-version` will be added with the value of the current gem version.
|
|
195
|
+
This tag is also used to determine if the AMI was created by this gem, and can be deleted automatically.
|
|
196
|
+
|
|
197
|
+
You can add custom tag(s) to the AMI and snapshot by setting the property `asg_rolling_ami_tags`, for example:
|
|
198
|
+
|
|
199
|
+
```ruby
|
|
200
|
+
# config/deploy/<stage>.rb
|
|
201
|
+
set :asg_rolling_ami_tags, { 'Application' => 'My Application', 'Environment' => 'Production' }
|
|
202
|
+
```
|
|
203
|
+
|
|
177
204
|
## Useful commands
|
|
178
205
|
|
|
179
206
|
### Test deployment
|
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
|
26
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
27
27
|
spec.require_paths = ['lib']
|
|
28
28
|
|
|
29
|
-
spec.required_ruby_version = '>=
|
|
29
|
+
spec.required_ruby_version = '>= 3.1.0'
|
|
30
30
|
|
|
31
31
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
32
32
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
@@ -55,6 +55,10 @@ module Capistrano
|
|
|
55
55
|
properties.fetch(:min_healthy_percentage, nil)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
+
def auto_rollback
|
|
59
|
+
properties.fetch(:asg_instance_refresh_auto_rollback, nil)
|
|
60
|
+
end
|
|
61
|
+
|
|
58
62
|
def max_healthy_percentage
|
|
59
63
|
properties.fetch(:max_healthy_percentage, nil)
|
|
60
64
|
end
|
|
@@ -73,7 +77,8 @@ module Capistrano
|
|
|
73
77
|
instance_warmup: instance_warmup_time,
|
|
74
78
|
skip_matching: true,
|
|
75
79
|
min_healthy_percentage: min_healthy_percentage,
|
|
76
|
-
max_healthy_percentage: max_healthy_percentage
|
|
80
|
+
max_healthy_percentage: max_healthy_percentage,
|
|
81
|
+
auto_rollback: auto_rollback
|
|
77
82
|
}.compact
|
|
78
83
|
).instance_refresh_id
|
|
79
84
|
rescue Aws::AutoScaling::Errors::InstanceRefreshInProgress => e
|
|
@@ -39,6 +39,13 @@ module Capistrano
|
|
|
39
39
|
super('No instances have been launched. Are you using a configuration with rolling deployments?')
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
|
+
|
|
43
|
+
# Exception when waiting for SSH availability timed out.
|
|
44
|
+
class SSHAvailabilityTimeoutError < Capistrano::ASG::Rolling::Exception
|
|
45
|
+
def initialize(timeout)
|
|
46
|
+
super("Timed out waiting for SSH to become available after #{timeout} seconds")
|
|
47
|
+
end
|
|
48
|
+
end
|
|
42
49
|
end
|
|
43
50
|
end
|
|
44
51
|
end
|
|
@@ -65,18 +65,6 @@ module Capistrano
|
|
|
65
65
|
new(instance.instance_id, instance.private_ip_address, instance.public_ip_address, instance.image_id, autoscaling_group)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
def wait_for_ssh
|
|
69
|
-
started_at = Time.now
|
|
70
|
-
|
|
71
|
-
loop do
|
|
72
|
-
result = SSH.test?(ip_address, autoscale_group.properties[:user], Configuration.ssh_options)
|
|
73
|
-
|
|
74
|
-
break if result || Time.now - started_at > 300
|
|
75
|
-
|
|
76
|
-
sleep 1
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
68
|
def ip_address
|
|
81
69
|
Configuration.use_private_ip_address? ? private_ip_address : public_ip_address
|
|
82
70
|
end
|
|
@@ -15,8 +15,8 @@ module Capistrano
|
|
|
15
15
|
@instances << instance
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def each(&
|
|
19
|
-
instances.each(&
|
|
18
|
+
def each(&)
|
|
19
|
+
instances.each(&)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def empty?
|
|
@@ -31,10 +31,6 @@ module Capistrano
|
|
|
31
31
|
self.class.new(select { |instance| instance.image_id == image_id })
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def wait_for_ssh
|
|
35
|
-
Parallel.run(instances, &:wait_for_ssh)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
34
|
def stop
|
|
39
35
|
Parallel.run(instances, &:stop)
|
|
40
36
|
end
|
|
@@ -29,6 +29,7 @@ module Capistrano
|
|
|
29
29
|
after 'rolling:update', 'rolling:cleanup'
|
|
30
30
|
after 'rolling:create_ami', 'rolling:cleanup'
|
|
31
31
|
after 'rolling:update', 'rolling:instance_refresh_status'
|
|
32
|
+
after 'rolling:trigger_instance_refresh', 'rolling:instance_refresh_status'
|
|
32
33
|
|
|
33
34
|
# Register an exit hook to do some cleanup when Capistrano
|
|
34
35
|
# terminates without calling our after cleanup hook.
|
|
@@ -47,6 +48,16 @@ module Capistrano
|
|
|
47
48
|
Capistrano::ASG::Rolling::Configuration
|
|
48
49
|
end
|
|
49
50
|
|
|
51
|
+
# Add an instance to the Capistrano server list, with the given properties.
|
|
52
|
+
def add_instance(instance, properties)
|
|
53
|
+
server_properties = properties.merge(instance_id: instance.id)
|
|
54
|
+
|
|
55
|
+
logger.verbose "Adding server: **#{instance.ip_address}**"
|
|
56
|
+
|
|
57
|
+
server(instance.ip_address, server_properties)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Make sure any instances that were launched for rolling updates are terminated.
|
|
50
61
|
def cleanup
|
|
51
62
|
instances = config.instances.auto_terminate
|
|
52
63
|
return if instances.empty?
|
|
@@ -1,22 +1,41 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'time'
|
|
4
|
+
|
|
3
5
|
module Capistrano
|
|
4
6
|
module ASG
|
|
5
7
|
module Rolling
|
|
6
|
-
#
|
|
8
|
+
# Test the SSHKit backend for availability.
|
|
7
9
|
module SSH
|
|
8
10
|
module_function
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
WAIT_TIMEOUT = 300
|
|
13
|
+
|
|
14
|
+
def wait_for_availability(backend)
|
|
15
|
+
timeout = WAIT_TIMEOUT
|
|
16
|
+
expires_at = Time.now + timeout
|
|
17
|
+
|
|
18
|
+
loop do
|
|
19
|
+
break if available?(backend)
|
|
20
|
+
|
|
21
|
+
raise SSHAvailabilityTimeoutError, timeout if Time.now > expires_at
|
|
13
22
|
|
|
14
|
-
|
|
15
|
-
ssh.exec!('echo hello')
|
|
23
|
+
sleep 1
|
|
16
24
|
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def available?(backend)
|
|
28
|
+
backend.test('echo hello')
|
|
17
29
|
|
|
18
30
|
true
|
|
19
|
-
rescue ::Net::SSH::
|
|
31
|
+
rescue ::Net::SSH::AuthenticationFailed, ::Net::SSH::Authentication::DisallowedMethod
|
|
32
|
+
# SSH server is reachable and responding.
|
|
33
|
+
true
|
|
34
|
+
rescue ::Net::SSH::ConnectionTimeout, ::Net::SSH::Proxy::ConnectError, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ETIMEDOUT, Errno::ECONNRESET
|
|
35
|
+
# SSH server not reachable or port closed.
|
|
36
|
+
false
|
|
37
|
+
rescue ::Net::SSH::Disconnect # rubocop:disable Lint/DuplicateBranch
|
|
38
|
+
# SSH server is reachable, but the connection dropped unexpectedly.
|
|
20
39
|
false
|
|
21
40
|
end
|
|
22
41
|
end
|
|
@@ -9,7 +9,7 @@ module Capistrano
|
|
|
9
9
|
|
|
10
10
|
# The tags to add to an AMI.
|
|
11
11
|
def ami_tags
|
|
12
|
-
application_tags.merge(deployment_tags).merge(gem_tags)
|
|
12
|
+
application_tags.merge(deployment_tags).merge(gem_tags).merge(custom_tags)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
# Tags related to the current application / stage.
|
|
@@ -36,6 +36,11 @@ module Capistrano
|
|
|
36
36
|
'capistrano-asg-rolling:gem-version' => Capistrano::ASG::Rolling::VERSION
|
|
37
37
|
}
|
|
38
38
|
end
|
|
39
|
+
|
|
40
|
+
# Custom added tags.
|
|
41
|
+
def custom_tags
|
|
42
|
+
fetch(:asg_rolling_ami_tags) || {}
|
|
43
|
+
end
|
|
39
44
|
end
|
|
40
45
|
end
|
|
41
46
|
end
|
|
@@ -14,10 +14,7 @@ namespace :rolling do
|
|
|
14
14
|
logger.info "Launched Instance: **#{instance.id}**"
|
|
15
15
|
config.instances << instance
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
# Add server to the Capistrano server list.
|
|
20
|
-
server(instance.ip_address, group.properties)
|
|
17
|
+
add_instance(instance, group.properties)
|
|
21
18
|
else
|
|
22
19
|
logger.info "Auto Scaling Group: **#{group.name}**, standard deployment strategy."
|
|
23
20
|
|
|
@@ -29,17 +26,17 @@ namespace :rolling do
|
|
|
29
26
|
server_properties = group.properties
|
|
30
27
|
end
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
# Add server to the Capistrano server list.
|
|
35
|
-
server(instance.ip_address, server_properties)
|
|
29
|
+
add_instance(instance, server_properties)
|
|
36
30
|
end
|
|
37
31
|
end
|
|
38
32
|
end
|
|
39
33
|
|
|
40
34
|
unless config.instances.empty?
|
|
41
35
|
logger.info 'Waiting for SSH to be available...'
|
|
42
|
-
|
|
36
|
+
|
|
37
|
+
on roles(:all) do
|
|
38
|
+
Capistrano::ASG::Rolling::SSH.wait_for_availability(self)
|
|
39
|
+
end
|
|
43
40
|
end
|
|
44
41
|
end
|
|
45
42
|
|
|
@@ -71,6 +68,17 @@ namespace :rolling do
|
|
|
71
68
|
end
|
|
72
69
|
end
|
|
73
70
|
|
|
71
|
+
desc 'Trigger instance refresh of deployed autoscaling groups'
|
|
72
|
+
task :trigger_instance_refresh do
|
|
73
|
+
logger.info 'Triggering Instance Refresh on Auto Scaling Group(s)...'
|
|
74
|
+
config.autoscale_groups.each do |group|
|
|
75
|
+
group.start_instance_refresh(group.launch_template)
|
|
76
|
+
logger.info "Successfully started Instance Refresh on Auto Scaling Group **#{group.name}**."
|
|
77
|
+
rescue Capistrano::ASG::Rolling::StartInstanceRefreshError => e
|
|
78
|
+
logger.info "Failed to start Instance Refresh on Auto Scaling Group **#{group.name}**: #{e.message}"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
74
82
|
desc 'Clean up old Launch Template versions and AMIs and terminate instances'
|
|
75
83
|
task :cleanup do
|
|
76
84
|
unless config.launch_templates.empty?
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano-asg-rolling
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kentaa
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-12-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -181,14 +181,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
181
181
|
requirements:
|
|
182
182
|
- - ">="
|
|
183
183
|
- !ruby/object:Gem::Version
|
|
184
|
-
version:
|
|
184
|
+
version: 3.1.0
|
|
185
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
requirements:
|
|
187
187
|
- - ">="
|
|
188
188
|
- !ruby/object:Gem::Version
|
|
189
189
|
version: '0'
|
|
190
190
|
requirements: []
|
|
191
|
-
rubygems_version: 3.
|
|
191
|
+
rubygems_version: 3.3.27
|
|
192
192
|
signing_key:
|
|
193
193
|
specification_version: 4
|
|
194
194
|
summary: Capistrano plugin for performing rolling updates to AWS Auto Scaling Groups
|