docker-armada 2.10.0 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/armada/deploy/parallel.rb +7 -4
- data/lib/armada/deploy/rolling.rb +8 -5
- data/lib/armada/deploy_dsl.rb +9 -0
- data/spec/deploy_dsl_spec.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0bc7638f849276cf9ce0ca28a8809184026e82f
|
4
|
+
data.tar.gz: 48d9abd7825dbdc77d2f8744ecc69cb6bfa8895e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 682da6b088a024e8016f7d58c313cdb981ca8057ea65d98cf0b1f809e341f36db0a76da420a28d08bc7de793435809b5285ad2a426449a73c865a8098f1b713e
|
7
|
+
data.tar.gz: eaf1fee5f6449ee42e359d6bfb45d567286a5c7d113f93e3bdd858b3aa0501bc793ae3ecd09ac65893f6a374e0b763208fd401e6db78fe2285f92930620b4fdc
|
@@ -10,11 +10,14 @@ module Armada
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def run
|
13
|
-
Armada.ui.info "Deploying the following image [#{@options[:image]}:#{@options[:tag]}]
|
13
|
+
Armada.ui.info "Deploying the following image [#{@options[:image]}:#{@options[:tag]}] in PARALLEL"
|
14
14
|
|
15
15
|
begin
|
16
16
|
@options[:hosts].each_in_parallel do |host|
|
17
|
-
|
17
|
+
docker_host_connect_string = host[:docker_host] || host
|
18
|
+
health_check_host = host[:health_check_host] || host
|
19
|
+
|
20
|
+
docker_host = Armada::Host.create(docker_host_connect_string, options)
|
18
21
|
image = docker_host.get_image @options[:image], @options[:tag], @options
|
19
22
|
image.pull
|
20
23
|
|
@@ -36,7 +39,7 @@ module Armada
|
|
36
39
|
end
|
37
40
|
|
38
41
|
health_check = Armada::Connection::HealthCheck.new(
|
39
|
-
|
42
|
+
health_check_host,
|
40
43
|
health_check_port,
|
41
44
|
@options[:health_check_endpoint],
|
42
45
|
@options[:health_check_delay],
|
@@ -45,7 +48,7 @@ module Armada
|
|
45
48
|
@options[:ssh_gateway_user]
|
46
49
|
)
|
47
50
|
|
48
|
-
raise "Health check failed! - #{
|
51
|
+
raise "Health check failed! - #{health_check_host}" unless health_check.run
|
49
52
|
end
|
50
53
|
end
|
51
54
|
rescue Exception => e
|
@@ -10,15 +10,18 @@ module Armada
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def run
|
13
|
-
Armada.ui.info "Deploying the following image [#{@options[:image]}:#{@options[:tag]}]
|
13
|
+
Armada.ui.info "Deploying the following image [#{@options[:image]}:#{@options[:tag]}]"
|
14
14
|
begin
|
15
15
|
@options[:hosts].each_in_parallel do |host|
|
16
|
-
|
16
|
+
docker_host_connect_string = host[:docker_host] || host
|
17
|
+
docker_host = Armada::Host.create(docker_host_connect_string, options)
|
17
18
|
docker_host.get_image(@options[:image], @options[:tag], @options).pull
|
18
19
|
end
|
19
20
|
|
20
21
|
@options[:hosts].each do |host|
|
21
|
-
|
22
|
+
docker_host_connect_string = host[:docker_host] || host
|
23
|
+
health_check_host = host[:health_check_host] || host
|
24
|
+
docker_host = Armada::Host.create(docker_host_connect_string, options)
|
22
25
|
image = docker_host.get_image @options[:image], @options[:tag], @options
|
23
26
|
container = Armada::Container.new(image, docker_host, @options)
|
24
27
|
container.stop
|
@@ -38,7 +41,7 @@ module Armada
|
|
38
41
|
end
|
39
42
|
|
40
43
|
health_check = Armada::Connection::HealthCheck.new(
|
41
|
-
|
44
|
+
health_check_host,
|
42
45
|
health_check_port,
|
43
46
|
@options[:health_check_endpoint],
|
44
47
|
@options[:health_check_delay],
|
@@ -47,7 +50,7 @@ module Armada
|
|
47
50
|
@options[:ssh_gateway_user]
|
48
51
|
)
|
49
52
|
|
50
|
-
raise "Health check failed! - #{
|
53
|
+
raise "Health check failed! - #{health_check_host}" unless health_check.run
|
51
54
|
end
|
52
55
|
end
|
53
56
|
rescue Exception => e
|
data/lib/armada/deploy_dsl.rb
CHANGED
@@ -81,6 +81,15 @@ module Armada::DeployDSL
|
|
81
81
|
|
82
82
|
def host(hostname)
|
83
83
|
current = fetch(:hosts, [])
|
84
|
+
|
85
|
+
if hostname.is_a? Hash
|
86
|
+
if not hostname.has_key? :docker_host or not hostname.has_key? :health_check_host
|
87
|
+
raise ArgumentError.new("Host must contain :docker_host and :health_check_host if supplied as a hash")
|
88
|
+
end
|
89
|
+
elsif not hostname.is_a? String
|
90
|
+
raise ArgumentError.new("Host must be a String or a Hash containing the :docker_host and :health_check_host keys")
|
91
|
+
end
|
92
|
+
|
84
93
|
current << hostname
|
85
94
|
set(:hosts, current)
|
86
95
|
end
|
data/spec/deploy_dsl_spec.rb
CHANGED
@@ -23,6 +23,18 @@ describe Armada::DeployDSL do
|
|
23
23
|
expect(DeployDSLTest.fetch(:hosts)).to include("host1", "host2")
|
24
24
|
end
|
25
25
|
|
26
|
+
it 'supports adding hosts via hash' do
|
27
|
+
DeployDSLTest.set(:hosts, ['my-other-host'])
|
28
|
+
DeployDSLTest.host({:docker_host => 'host1', :health_check_host => 'host2'})
|
29
|
+
expect(DeployDSLTest.fetch(:hosts)).to include('my-other-host', {:docker_host => 'host1', :health_check_host => 'host2'})
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should raise an argumenterror if the host argument is incorrect' do
|
33
|
+
expect { DeployDSLTest.host({:docker_host => 'host1'}) }.to raise_error(ArgumentError)
|
34
|
+
expect { DeployDSLTest.host({:health_check_host => 'host1'}) }.to raise_error(ArgumentError)
|
35
|
+
expect { DeployDSLTest.host(1) }.to raise_error(ArgumentError)
|
36
|
+
end
|
37
|
+
|
26
38
|
it 'adds the restart policy' do
|
27
39
|
DeployDSLTest.restart_policy({:foo => "bar"})
|
28
40
|
expect(DeployDSLTest.fetch(:restart_policy)).to eq({:foo => "bar"})
|