ufo 4.1.10 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +19 -19
- data/docs/_docs/faq.md +1 -1
- data/docs/_docs/redirection-support.md +28 -0
- data/docs/_docs/route53-support.md +1 -1
- data/docs/_includes/subnav.html +1 -0
- data/lib/ufo.rb +3 -3
- data/lib/ufo/apps.rb +3 -3
- data/lib/ufo/base.rb +1 -1
- data/lib/ufo/core.rb +3 -3
- data/lib/ufo/current.rb +1 -1
- data/lib/ufo/destroy.rb +5 -5
- data/lib/ufo/docker/builder.rb +4 -4
- data/lib/ufo/docker/cleaner.rb +2 -2
- data/lib/ufo/docker/dockerfile.rb +2 -2
- data/lib/ufo/docker/pusher.rb +3 -3
- data/lib/ufo/dsl.rb +2 -2
- data/lib/ufo/dsl/outputter.rb +1 -1
- data/lib/ufo/dsl/task_definition.rb +2 -2
- data/lib/ufo/info.rb +1 -1
- data/lib/ufo/log_group.rb +1 -1
- data/lib/ufo/network/fetch.rb +1 -1
- data/lib/ufo/param.rb +1 -1
- data/lib/ufo/ps.rb +3 -3
- data/lib/ufo/scale.rb +2 -2
- data/lib/ufo/sequence.rb +0 -1
- data/lib/ufo/setting/profile.rb +1 -1
- data/lib/ufo/ship.rb +2 -4
- data/lib/ufo/stack.rb +4 -4
- data/lib/ufo/stack/context.rb +4 -4
- data/lib/ufo/stack/status.rb +6 -6
- data/lib/ufo/status.rb +2 -2
- data/lib/ufo/stop.rb +2 -0
- data/lib/ufo/task.rb +6 -6
- data/lib/ufo/tasks/builder.rb +1 -1
- data/lib/ufo/tasks/register.rb +2 -2
- data/lib/ufo/upgrade/upgrade3.rb +1 -1
- data/lib/ufo/upgrade/upgrade33to34.rb +1 -1
- data/lib/ufo/version.rb +1 -1
- data/spec/lib/task_spec.rb +4 -3
- data/ufo.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6edc5b0c7839270642b17d61f1b23ad78ab8f3c29be34228cebc8503f1386e87
|
4
|
+
data.tar.gz: 3f79906f22704189336494d25f3c5ae584aa4ef6fc77c23cbe1975c20c1d3fbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c6ae47253e375f211303d6a0047c335c41786257858b8047875297c05442bba99f510edeae42ff5a7923ed0a0b58cadd14b618e6d1b954644fc3e4b7287f08a
|
7
|
+
data.tar.gz: 5855da3c8c1b88ae90de2c6a8aee1433ea846e5c3a7d3caffdc6016a6faf5e14684332b2e06f5252e53fae9711b8af490656e0e71e7f92b49c79c8df681a8a4f
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [4.2.0]
|
7
|
+
- dont stop tasks on very first deploy, removes edge case error
|
8
|
+
- update docs: redirection support
|
9
|
+
- use rainbow gem for terminal colors
|
10
|
+
|
6
11
|
## [4.1.10]
|
7
12
|
- print out failure reason
|
8
13
|
|
data/Gemfile.lock
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ufo (4.
|
4
|
+
ufo (4.2.0)
|
5
5
|
aws-sdk-cloudformation
|
6
6
|
aws-sdk-cloudwatchlogs
|
7
7
|
aws-sdk-ec2
|
8
8
|
aws-sdk-ecr
|
9
9
|
aws-sdk-ecs
|
10
10
|
aws-sdk-elasticloadbalancingv2
|
11
|
-
colorize
|
12
11
|
deep_merge
|
13
12
|
memoist
|
14
13
|
plissken
|
14
|
+
rainbow
|
15
15
|
render_me_pretty
|
16
16
|
text-table
|
17
17
|
thor
|
@@ -19,34 +19,34 @@ PATH
|
|
19
19
|
GEM
|
20
20
|
remote: https://rubygems.org/
|
21
21
|
specs:
|
22
|
-
activesupport (5.2.
|
22
|
+
activesupport (5.2.2)
|
23
23
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
24
|
i18n (>= 0.7, < 2)
|
25
25
|
minitest (~> 5.1)
|
26
26
|
tzinfo (~> 1.1)
|
27
27
|
aws-eventstream (1.0.1)
|
28
|
-
aws-partitions (1.
|
29
|
-
aws-sdk-cloudformation (1.
|
28
|
+
aws-partitions (1.135.0)
|
29
|
+
aws-sdk-cloudformation (1.14.0)
|
30
30
|
aws-sdk-core (~> 3, >= 3.39.0)
|
31
31
|
aws-sigv4 (~> 1.0)
|
32
|
-
aws-sdk-cloudwatchlogs (1.
|
32
|
+
aws-sdk-cloudwatchlogs (1.13.0)
|
33
33
|
aws-sdk-core (~> 3, >= 3.39.0)
|
34
34
|
aws-sigv4 (~> 1.0)
|
35
|
-
aws-sdk-core (3.
|
35
|
+
aws-sdk-core (3.46.0)
|
36
36
|
aws-eventstream (~> 1.0)
|
37
37
|
aws-partitions (~> 1.0)
|
38
38
|
aws-sigv4 (~> 1.0)
|
39
39
|
jmespath (~> 1.0)
|
40
|
-
aws-sdk-ec2 (1.
|
40
|
+
aws-sdk-ec2 (1.67.0)
|
41
41
|
aws-sdk-core (~> 3, >= 3.39.0)
|
42
42
|
aws-sigv4 (~> 1.0)
|
43
|
-
aws-sdk-ecr (1.
|
43
|
+
aws-sdk-ecr (1.11.0)
|
44
44
|
aws-sdk-core (~> 3, >= 3.39.0)
|
45
45
|
aws-sigv4 (~> 1.0)
|
46
|
-
aws-sdk-ecs (1.
|
46
|
+
aws-sdk-ecs (1.28.0)
|
47
47
|
aws-sdk-core (~> 3, >= 3.39.0)
|
48
48
|
aws-sigv4 (~> 1.0)
|
49
|
-
aws-sdk-elasticloadbalancingv2 (1.
|
49
|
+
aws-sdk-elasticloadbalancingv2 (1.20.0)
|
50
50
|
aws-sdk-core (~> 3, >= 3.39.0)
|
51
51
|
aws-sigv4 (~> 1.0)
|
52
52
|
aws-sigv4 (1.0.3)
|
@@ -54,22 +54,22 @@ GEM
|
|
54
54
|
cli_markdown (0.1.0)
|
55
55
|
codeclimate-test-reporter (1.0.9)
|
56
56
|
simplecov (<= 0.13)
|
57
|
-
|
58
|
-
concurrent-ruby (1.1.3)
|
57
|
+
concurrent-ruby (1.1.4)
|
59
58
|
deep_merge (1.2.1)
|
60
59
|
diff-lcs (1.3)
|
61
60
|
docile (1.1.5)
|
62
|
-
i18n (1.
|
61
|
+
i18n (1.5.3)
|
63
62
|
concurrent-ruby (~> 1.0)
|
64
63
|
jmespath (1.4.0)
|
65
64
|
json (2.1.0)
|
66
65
|
memoist (0.16.0)
|
67
66
|
minitest (5.11.3)
|
68
|
-
plissken (1.
|
69
|
-
|
70
|
-
|
67
|
+
plissken (1.3.0)
|
68
|
+
rainbow (3.0.0)
|
69
|
+
rake (12.3.2)
|
70
|
+
render_me_pretty (0.8.2)
|
71
71
|
activesupport
|
72
|
-
|
72
|
+
rainbow
|
73
73
|
tilt
|
74
74
|
rspec (3.8.0)
|
75
75
|
rspec-core (~> 3.8.0)
|
@@ -109,4 +109,4 @@ DEPENDENCIES
|
|
109
109
|
ufo!
|
110
110
|
|
111
111
|
BUNDLED WITH
|
112
|
-
1.17.
|
112
|
+
1.17.2
|
data/docs/_docs/faq.md
CHANGED
@@ -96,6 +96,6 @@ Also, you might have to enable the log driver by adding the ECS_AVAILABLE_LOGGIN
|
|
96
96
|
|
97
97
|
Hope that helps.
|
98
98
|
|
99
|
-
<a id="prev" class="btn btn-basic" href="{% link _docs/
|
99
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/redirection-support.md %}">Back</a>
|
100
100
|
<a id="next" class="btn btn-primary" href="{% link _docs/why-cloudformation.md %}">Next Step</a>
|
101
101
|
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
title: Redirection Support
|
3
|
+
---
|
4
|
+
|
5
|
+
## Application Load Balancers
|
6
|
+
|
7
|
+
If you are using an Application Load Balancer you can configure redirection by editing the default actions of the regular listener that is set up by ufo. This assumes you have set up [SSL Support]({% link _docs/ssl-support.md %}). Here's an example that redirects http to https with a 302 http status code:
|
8
|
+
|
9
|
+
```
|
10
|
+
listener:
|
11
|
+
port: 80
|
12
|
+
# ...
|
13
|
+
default_actions:
|
14
|
+
- type: redirect
|
15
|
+
redirect_config:
|
16
|
+
protocol: HTTPS
|
17
|
+
status_code: HTTP_302 # HTTP_301 and HTTP_302 are valid
|
18
|
+
port: 443
|
19
|
+
```
|
20
|
+
|
21
|
+
|
22
|
+
## Network Load Balancers
|
23
|
+
|
24
|
+
Network Load Balancers work at layer 4, so they do not support redirection. Instead you need to handle redirection within your app.
|
25
|
+
|
26
|
+
<a id="prev" class="btn btn-basic" href="{% link _docs/route53-support.md %}">Back</a>
|
27
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/faq.md %}">Next Step</a>
|
28
|
+
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
@@ -24,5 +24,5 @@ Results in:
|
|
24
24
|
aws route53 list-hosted-zones
|
25
25
|
|
26
26
|
<a id="prev" class="btn btn-basic" href="{% link _docs/ssl-support.md %}">Back</a>
|
27
|
-
<a id="next" class="btn btn-primary" href="{% link _docs/
|
27
|
+
<a id="next" class="btn btn-primary" href="{% link _docs/redirection-support.md %}">Next Step</a>
|
28
28
|
<p class="keyboard-tip">Pro tip: Use the <- and -> arrow keys to move back and forward.</p>
|
data/docs/_includes/subnav.html
CHANGED
@@ -30,6 +30,7 @@
|
|
30
30
|
<li><a href="{% link _docs/ecs-network-mode.md %}">ECS Network Mode</a></li>
|
31
31
|
<li><a href="{% link _docs/ssl-support.md %}">SSL Support</a></li>
|
32
32
|
<li><a href="{% link _docs/route53-support.md %}">Route53 Support</a></li>
|
33
|
+
<li><a href="{% link _docs/redirection-support.md %}">Redirection Support</a></li>
|
33
34
|
<li><a href="{% link _docs/faq.md %}">FAQ</a></li>
|
34
35
|
</ul>
|
35
36
|
<li>More
|
data/lib/ufo.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
$:.unshift(File.expand_path('../', __FILE__))
|
2
|
-
require 'ufo/version'
|
3
2
|
require 'deep_merge'
|
4
|
-
require 'colorize'
|
5
3
|
require 'fileutils'
|
6
|
-
require 'render_me_pretty'
|
7
4
|
require 'memoist'
|
5
|
+
require 'rainbow/ext/string'
|
6
|
+
require 'render_me_pretty'
|
7
|
+
require 'ufo/version'
|
8
8
|
|
9
9
|
module Ufo
|
10
10
|
autoload :Apps, 'ufo/apps'
|
data/lib/ufo/apps.rb
CHANGED
@@ -17,14 +17,14 @@ module Ufo
|
|
17
17
|
begin
|
18
18
|
resp = ecs.list_services(cluster: @cluster)
|
19
19
|
rescue Aws::ECS::Errors::ClusterNotFoundException => e
|
20
|
-
puts "ECS cluster #{@cluster.
|
20
|
+
puts "ECS cluster #{@cluster.color(:green)} not found."
|
21
21
|
exit 1
|
22
22
|
end
|
23
23
|
arns = resp.service_arns.sort
|
24
24
|
|
25
|
-
puts "Listing ECS services in the #{@cluster.
|
25
|
+
puts "Listing ECS services in the #{@cluster.color(:green)} cluster."
|
26
26
|
if arns.empty?
|
27
|
-
puts "No ECS services found in the #{@cluster.
|
27
|
+
puts "No ECS services found in the #{@cluster.color(:green)} cluster."
|
28
28
|
return
|
29
29
|
end
|
30
30
|
|
data/lib/ufo/base.rb
CHANGED
data/lib/ufo/core.rb
CHANGED
@@ -8,8 +8,8 @@ module Ufo
|
|
8
8
|
def check_task_definition!(task_definition)
|
9
9
|
task_definition_path = "#{Ufo.root}/.ufo/output/#{task_definition}.json"
|
10
10
|
unless File.exist?(task_definition_path)
|
11
|
-
puts "ERROR: Unable to find the task definition at #{task_definition_path}.".
|
12
|
-
puts "Are you sure you have defined it in ufo/template_definitions.rb and it has been generated correctly in .ufo/output?".
|
11
|
+
puts "ERROR: Unable to find the task definition at #{task_definition_path}.".color(:red)
|
12
|
+
puts "Are you sure you have defined it in ufo/template_definitions.rb and it has been generated correctly in .ufo/output?".color(:red)
|
13
13
|
puts "If you are calling `ufo deploy` directly, you might want to generate the task definition first with `ufo tasks build`."
|
14
14
|
exit
|
15
15
|
end
|
@@ -51,7 +51,7 @@ module Ufo
|
|
51
51
|
def check_ufo_project!
|
52
52
|
check_path = "#{Ufo.root}/.ufo/settings.yml"
|
53
53
|
unless File.exist?(check_path)
|
54
|
-
puts "ERROR: No settings file at #{check_path}. Are you sure you are in a project with ufo setup?".
|
54
|
+
puts "ERROR: No settings file at #{check_path}. Are you sure you are in a project with ufo setup?".color(:red)
|
55
55
|
puts "Current directory: #{Dir.pwd}"
|
56
56
|
puts "If you want to set up ufo for this prjoect, please create a settings file via: ufo init"
|
57
57
|
exit 1 unless ENV['TEST']
|
data/lib/ufo/current.rb
CHANGED
data/lib/ufo/destroy.rb
CHANGED
@@ -8,13 +8,13 @@ module Ufo
|
|
8
8
|
|
9
9
|
stack = find_stack(@stack_name)
|
10
10
|
unless stack
|
11
|
-
puts "Stack #{@stack_name.
|
11
|
+
puts "Stack #{@stack_name.color(:green)} does not exist."
|
12
12
|
exit
|
13
13
|
end
|
14
14
|
|
15
15
|
if stack.stack_status =~ /_IN_PROGRESS$/
|
16
|
-
puts "Cannot destroy service #{@pretty_service_name.
|
17
|
-
puts "Cannot delete stack #{@stack_name.
|
16
|
+
puts "Cannot destroy service #{@pretty_service_name.color(:green)}"
|
17
|
+
puts "Cannot delete stack #{@stack_name.color(:green)} in this state: #{stack.stack_status.color(:green)}"
|
18
18
|
puts "If the stack is taking a long time, you can cancel the current operation with:"
|
19
19
|
puts " ufo cancel #{@service}"
|
20
20
|
return
|
@@ -27,12 +27,12 @@ module Ufo
|
|
27
27
|
start_time = Time.now
|
28
28
|
status.wait
|
29
29
|
took = Time.now - start_time
|
30
|
-
puts "Time took for deletion: #{status.pretty_time(took).green}."
|
30
|
+
puts "Time took for deletion: #{status.pretty_time(took).color(:green)}."
|
31
31
|
end
|
32
32
|
|
33
33
|
def are_you_sure?
|
34
34
|
return true if @options[:sure]
|
35
|
-
puts "You are about to destroy #{@pretty_service_name.
|
35
|
+
puts "You are about to destroy #{@pretty_service_name.color(:green)} service on the #{@cluster.color(:green)} cluster."
|
36
36
|
print "Are you sure you want to do this? (y/n) "
|
37
37
|
answer = $stdin.gets.strip
|
38
38
|
answer =~ /^y/
|
data/lib/ufo/docker/builder.rb
CHANGED
@@ -26,8 +26,8 @@ class Ufo::Docker
|
|
26
26
|
update_auth_token
|
27
27
|
|
28
28
|
command = "docker build #{build_options}-t #{full_image_name} -f #{@dockerfile} ."
|
29
|
-
say "Building docker image with:".green
|
30
|
-
say " #{command}".green
|
29
|
+
say "Building docker image with:".color(:green)
|
30
|
+
say " #{command}".color(:green)
|
31
31
|
check_dockerfile_exists
|
32
32
|
command = "cd #{Ufo.root} && #{command}"
|
33
33
|
success = execute(command, use_system: true)
|
@@ -36,13 +36,13 @@ class Ufo::Docker
|
|
36
36
|
unless docker_version_success
|
37
37
|
docker_version_message = " Are you sure the docker daemon is available? Try running: docker version."
|
38
38
|
end
|
39
|
-
puts "ERROR: The docker image fail to build.#{docker_version_message}".
|
39
|
+
puts "ERROR: The docker image fail to build.#{docker_version_message}".color(:red)
|
40
40
|
exit 1
|
41
41
|
end
|
42
42
|
|
43
43
|
took = Time.now - start_time
|
44
44
|
say "Docker image #{full_image_name} built. "
|
45
|
-
say "Docker build took #{pretty_time(took)}.".green
|
45
|
+
say "Docker build took #{pretty_time(took)}.".color(:green)
|
46
46
|
end
|
47
47
|
|
48
48
|
def build_options
|
data/lib/ufo/docker/cleaner.rb
CHANGED
@@ -14,8 +14,8 @@ module Ufo
|
|
14
14
|
def cleanup
|
15
15
|
return if delete_list.empty?
|
16
16
|
command = "docker rmi #{delete_list}"
|
17
|
-
say "Cleaning up docker images...".green
|
18
|
-
say "=> #{"docker rmi #{delete_list}"}".green
|
17
|
+
say "Cleaning up docker images...".color(:green)
|
18
|
+
say "=> #{"docker rmi #{delete_list}"}".color(:green)
|
19
19
|
return if @options[:noop]
|
20
20
|
execute(command, use_system: false) # to use_system: false silence output
|
21
21
|
end
|
@@ -33,8 +33,8 @@ module Ufo
|
|
33
33
|
def write_new_dockerfile
|
34
34
|
IO.write(dockerfile_path, new_dockerfile)
|
35
35
|
unless @options[:mute]
|
36
|
-
puts "The Dockerfile FROM statement has been updated with the latest base image:".green
|
37
|
-
puts " #{@full_image_name}".green
|
36
|
+
puts "The Dockerfile FROM statement has been updated with the latest base image:".color(:green)
|
37
|
+
puts " #{@full_image_name}".color(:green)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
data/lib/ufo/docker/pusher.rb
CHANGED
@@ -21,15 +21,15 @@ class Ufo::Docker
|
|
21
21
|
message = "NOOP #{message}"
|
22
22
|
else
|
23
23
|
command = "docker push #{last_image_name}"
|
24
|
-
puts "=> #{command}".
|
24
|
+
puts "=> #{command}".color(:green)
|
25
25
|
success = execute(command, use_system: true)
|
26
26
|
unless success
|
27
|
-
puts "ERROR: The docker image fail to push.".
|
27
|
+
puts "ERROR: The docker image fail to push.".color(:red)
|
28
28
|
exit 1
|
29
29
|
end
|
30
30
|
end
|
31
31
|
took = Time.now - start_time
|
32
|
-
message << "\nDocker push took #{pretty_time(took)}.".green
|
32
|
+
message << "\nDocker push took #{pretty_time(took)}.".color(:green)
|
33
33
|
puts message unless @options[:mute]
|
34
34
|
end
|
35
35
|
|
data/lib/ufo/dsl.rb
CHANGED
@@ -42,7 +42,7 @@ module Ufo
|
|
42
42
|
error_info = e.backtrace.first
|
43
43
|
path, line_no, _ = error_info.split(':')
|
44
44
|
line_no = line_no.to_i
|
45
|
-
puts "Error evaluating #{path}:".
|
45
|
+
puts "Error evaluating #{path}:".color(:red)
|
46
46
|
puts e.message
|
47
47
|
puts "Here's the line in #{path} with the error:\n\n"
|
48
48
|
|
@@ -54,7 +54,7 @@ module Ufo
|
|
54
54
|
content_lines[top..bottom].each_with_index do |line_content, index|
|
55
55
|
line_number = top+index+1
|
56
56
|
if line_number == line_no
|
57
|
-
printf("%#{spacing}d %s\n".
|
57
|
+
printf("%#{spacing}d %s\n".color(:red), line_number, line_content)
|
58
58
|
else
|
59
59
|
printf("%#{spacing}d %s\n", line_number, line_content)
|
60
60
|
end
|
data/lib/ufo/dsl/outputter.rb
CHANGED
@@ -26,7 +26,7 @@ module Ufo
|
|
26
26
|
begin
|
27
27
|
JSON.parse(json)
|
28
28
|
rescue JSON::ParserError => e
|
29
|
-
puts "Invalid json. Output written to #{path} for debugging".
|
29
|
+
puts "Invalid json. Output written to #{path} for debugging".color(:red)
|
30
30
|
File.open(path, 'w') {|f| f.write(json) }
|
31
31
|
exit 1
|
32
32
|
end
|
@@ -35,12 +35,12 @@ module Ufo
|
|
35
35
|
# Provide a slightly better error message to user when the task definition
|
36
36
|
# code block is not evaluated successfully.
|
37
37
|
def build_error_info(e)
|
38
|
-
puts "ERROR: evaluating block for task_definition #{@task_definition_name}".
|
38
|
+
puts "ERROR: evaluating block for task_definition #{@task_definition_name}".color(:red)
|
39
39
|
# The first line of the backtrace has the info of the file name. Example:
|
40
40
|
# ./.ufo/task_definitions.rb:24:in `block in evaluate_template_definitions'
|
41
41
|
info = e.backtrace[0]
|
42
42
|
filename = info.split(':')[0..1].join(':')
|
43
|
-
puts "Filename: #{filename}".
|
43
|
+
puts "Filename: #{filename}".color(:red)
|
44
44
|
end
|
45
45
|
|
46
46
|
|
data/lib/ufo/info.rb
CHANGED
@@ -8,7 +8,7 @@ module Ufo
|
|
8
8
|
puts "Resources:"
|
9
9
|
stack_resources.each do |r|
|
10
10
|
# pp r
|
11
|
-
puts "#{r.logical_resource_id} - #{r.resource_type}:".
|
11
|
+
puts "#{r.logical_resource_id} - #{r.resource_type}:".color(:green)
|
12
12
|
puts " #{r.physical_resource_id}"
|
13
13
|
end
|
14
14
|
end
|
data/lib/ufo/log_group.rb
CHANGED
@@ -9,7 +9,7 @@ module Ufo
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def create
|
12
|
-
puts "Ensuring log group for #{@task_definition.
|
12
|
+
puts "Ensuring log group for #{@task_definition.color(:green)} task definition exists"
|
13
13
|
return if @options[:noop]
|
14
14
|
|
15
15
|
Ufo.check_task_definition!(@task_definition)
|
data/lib/ufo/network/fetch.rb
CHANGED
@@ -19,7 +19,7 @@ class Ufo::Network
|
|
19
19
|
if default_vpc
|
20
20
|
default_vpc.vpc_id
|
21
21
|
else
|
22
|
-
puts "A default vpc was not found in this AWS account and region.".
|
22
|
+
puts "A default vpc was not found in this AWS account and region.".color(:red)
|
23
23
|
puts "Because there is no default vpc, please specify the --vpc-id option. More info: http://ufoships.com/reference/ufo-init/"
|
24
24
|
exit 1
|
25
25
|
end
|
data/lib/ufo/param.rb
CHANGED
@@ -28,7 +28,7 @@ module Ufo
|
|
28
28
|
def upgrade_message!
|
29
29
|
return if File.exist?(@params_path)
|
30
30
|
|
31
|
-
puts "ERROR: Your project is missing the .ufo/params.yml.".
|
31
|
+
puts "ERROR: Your project is missing the .ufo/params.yml.".color(:red)
|
32
32
|
puts "This was added in ufo version 3.4"
|
33
33
|
puts "You can find more info about the params file here: http://ufoships.com/docs/params/"
|
34
34
|
puts "To upgrade run:"
|
data/lib/ufo/ps.rb
CHANGED
@@ -57,7 +57,7 @@ module Ufo
|
|
57
57
|
return unless error_event
|
58
58
|
|
59
59
|
puts "There are targets in the target group reporting unhealthy. This can cause containers to cycle. Here's the error:"
|
60
|
-
puts error_event.message.
|
60
|
+
puts error_event.message.color(:red)
|
61
61
|
puts "Check out the ECS console events tab for more info."
|
62
62
|
end
|
63
63
|
|
@@ -72,8 +72,8 @@ module Ufo
|
|
72
72
|
end
|
73
73
|
return unless error_event
|
74
74
|
|
75
|
-
puts "There is an issue scaling the #{@service.
|
76
|
-
puts error_event.message.
|
75
|
+
puts "There is an issue scaling the #{@service.color(:green)} service to #{service.desired_count}. Here's the error:"
|
76
|
+
puts error_event.message.color(:red)
|
77
77
|
if service.launch_type == "EC2"
|
78
78
|
puts "If AutoScaling is set up for the container instances, it can take a little time to add additional instances. You'll see this message until the capacity is added."
|
79
79
|
end
|
data/lib/ufo/scale.rb
CHANGED
@@ -9,7 +9,7 @@ module Ufo
|
|
9
9
|
|
10
10
|
def update
|
11
11
|
unless service_exists?
|
12
|
-
puts "Unable to find the #{@pretty_service_name.
|
12
|
+
puts "Unable to find the #{@pretty_service_name.color(:green)} service on the #{@cluster.color(:green)} cluster."
|
13
13
|
puts "Are you sure you are trying to scale the right service on the right cluster?"
|
14
14
|
exit
|
15
15
|
end
|
@@ -18,7 +18,7 @@ module Ufo
|
|
18
18
|
cluster: @cluster,
|
19
19
|
desired_count: @count
|
20
20
|
)
|
21
|
-
puts "Scale #{@pretty_service_name.
|
21
|
+
puts "Scale #{@pretty_service_name.color(:green)} service in #{@cluster.color(:green)} cluster to #{@count}" unless @options[:mute]
|
22
22
|
end
|
23
23
|
|
24
24
|
def service_exists?
|
data/lib/ufo/sequence.rb
CHANGED
data/lib/ufo/setting/profile.rb
CHANGED
data/lib/ufo/ship.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'colorize'
|
2
|
-
|
3
1
|
module Ufo
|
4
2
|
class UfoError < RuntimeError; end
|
5
3
|
class ShipmentOverridden < UfoError; end
|
@@ -18,7 +16,7 @@ module Ufo
|
|
18
16
|
puts "NOOP: #{message}"
|
19
17
|
return
|
20
18
|
else
|
21
|
-
puts message.green
|
19
|
+
puts message.color(:green)
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
@@ -79,7 +77,7 @@ module Ufo
|
|
79
77
|
IO.write(output_path, json)
|
80
78
|
|
81
79
|
file_path = "file://#{rel_path}"
|
82
|
-
puts " aws ecs #{action}-service --cli-input-json #{file_path}".
|
80
|
+
puts " aws ecs #{action}-service --cli-input-json #{file_path}".color(:green)
|
83
81
|
end
|
84
82
|
|
85
83
|
def ensure_cluster_exist
|
data/lib/ufo/stack.rb
CHANGED
@@ -62,7 +62,7 @@ module Ufo
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def perform(action)
|
65
|
-
puts "#{action[0..-2].capitalize}ing stack #{@stack_name.
|
65
|
+
puts "#{action[0..-2].capitalize}ing stack #{@stack_name.color(:green)}..."
|
66
66
|
# Example: cloudformation.send("update_stack", stack_options)
|
67
67
|
cloudformation.send("#{action}_stack", stack_options)
|
68
68
|
rescue Aws::CloudFormation::Errors::ValidationError => e
|
@@ -178,7 +178,7 @@ module Ufo
|
|
178
178
|
def exit_with_message(stack)
|
179
179
|
region = `aws configure get region`.strip rescue "us-east-1"
|
180
180
|
url = "https://console.aws.amazon.com/cloudformation/home?region=#{region}#/stacks"
|
181
|
-
puts "The stack is not in an updateable state: #{stack.stack_status.
|
181
|
+
puts "The stack is not in an updateable state: #{stack.stack_status.color(:yellow)}."
|
182
182
|
puts "Here's the CloudFormation url to check for more details #{url}"
|
183
183
|
exit 1
|
184
184
|
end
|
@@ -188,13 +188,13 @@ module Ufo
|
|
188
188
|
def handle_stack_error(e)
|
189
189
|
case e.message
|
190
190
|
when /is in ROLLBACK_COMPLETE state and can not be updated/
|
191
|
-
puts "The #{@stack_name} stack is in #{"ROLLBACK_COMPLETE".
|
191
|
+
puts "The #{@stack_name} stack is in #{"ROLLBACK_COMPLETE".color(:red)} and cannot be updated. Deleted the stack and try again."
|
192
192
|
region = `aws configure get region`.strip rescue 'us-east-1'
|
193
193
|
url = "https://console.aws.amazon.com/cloudformation/home?region=#{region}"
|
194
194
|
puts "Here's the CloudFormation console url: #{url}"
|
195
195
|
exit 1
|
196
196
|
when /No updates are to be performed/
|
197
|
-
puts "There are no updates to be performed. Exiting.".
|
197
|
+
puts "There are no updates to be performed. Exiting.".color(:yellow)
|
198
198
|
exit 1
|
199
199
|
else
|
200
200
|
raise
|
data/lib/ufo/stack/context.rb
CHANGED
@@ -34,7 +34,7 @@ class Ufo::Stack
|
|
34
34
|
default_listener_ssl_protocol: default_listener_ssl_protocol,
|
35
35
|
create_listener_ssl: create_listener_ssl?,
|
36
36
|
}
|
37
|
-
# puts "vars:".
|
37
|
+
# puts "vars:".color(:cyan)
|
38
38
|
# pp vars
|
39
39
|
scope.assign_instance_variables(vars)
|
40
40
|
scope
|
@@ -111,7 +111,7 @@ class Ufo::Stack
|
|
111
111
|
when "", nil
|
112
112
|
create_elb, elb_target_group = default_elb_options
|
113
113
|
else
|
114
|
-
puts "Invalid --elb option provided: #{@options[:elb].inspect}".
|
114
|
+
puts "Invalid --elb option provided: #{@options[:elb].inspect}".color(:red)
|
115
115
|
puts "Exiting."
|
116
116
|
exit 1
|
117
117
|
end
|
@@ -187,9 +187,9 @@ class Ufo::Stack
|
|
187
187
|
|
188
188
|
def build_subnet_mappings!(allocations)
|
189
189
|
unless allocations.size == network[:elb_subnets].size
|
190
|
-
# puts "caller:".
|
190
|
+
# puts "caller:".color(:cyan)
|
191
191
|
# puts caller
|
192
|
-
puts "ERROR: The allocation_ids must match in length to the subnets.".
|
192
|
+
puts "ERROR: The allocation_ids must match in length to the subnets.".color(:red)
|
193
193
|
puts "Please double check that .ufo/settings/network/#{settings[:network_profile]} has the same number of subnets as the eip allocation ids are you specifying."
|
194
194
|
subnets = network[:elb_subnets]
|
195
195
|
puts "Conigured subnets: #{subnets.inspect}"
|
data/lib/ufo/stack/status.rb
CHANGED
@@ -57,17 +57,17 @@ class Ufo::Stack
|
|
57
57
|
end
|
58
58
|
|
59
59
|
if last_event_status =~ /_FAILED/
|
60
|
-
puts "Stack failed: #{last_event_status}".
|
61
|
-
puts "Stack reason #{@events[0]["resource_status_reason"]}".
|
60
|
+
puts "Stack failed: #{last_event_status}".color(:red)
|
61
|
+
puts "Stack reason #{@events[0]["resource_status_reason"]}".color(:red)
|
62
62
|
elsif last_event_status =~ /_ROLLBACK_/
|
63
|
-
puts "Stack rolled back: #{last_event_status}".
|
63
|
+
puts "Stack rolled back: #{last_event_status}".color(:red)
|
64
64
|
else # success
|
65
|
-
puts "Stack success status: #{last_event_status}".
|
65
|
+
puts "Stack success status: #{last_event_status}".color(:green)
|
66
66
|
end
|
67
67
|
|
68
68
|
return if @hide_time_took
|
69
69
|
took = Time.now - start_time
|
70
|
-
puts "Time took for stack deployment: #{pretty_time(took).green}."
|
70
|
+
puts "Time took for stack deployment: #{pretty_time(took).color(:green)}."
|
71
71
|
end
|
72
72
|
|
73
73
|
def completed
|
@@ -111,7 +111,7 @@ class Ufo::Stack
|
|
111
111
|
e["logical_resource_id"],
|
112
112
|
e["resource_status_reason"]
|
113
113
|
].join(" ")
|
114
|
-
message = message.
|
114
|
+
message = message.color(:red) if e["resource_status"] =~ /_FAILED/
|
115
115
|
puts message
|
116
116
|
end
|
117
117
|
|
data/lib/ufo/status.rb
CHANGED
@@ -3,14 +3,14 @@ module Ufo
|
|
3
3
|
# used for the ufo status command
|
4
4
|
def run
|
5
5
|
unless stack_exists?(@stack_name)
|
6
|
-
puts "The stack #{@stack_name.
|
6
|
+
puts "The stack #{@stack_name.color(:green)} does not exist."
|
7
7
|
return
|
8
8
|
end
|
9
9
|
|
10
10
|
resp = cloudformation.describe_stacks(stack_name: @stack_name)
|
11
11
|
stack = resp.stacks.first
|
12
12
|
|
13
|
-
puts "The current status for the stack #{@stack_name.
|
13
|
+
puts "The current status for the stack #{@stack_name.color(:green)} is #{stack.stack_status.color(:green)}"
|
14
14
|
|
15
15
|
status_poller = Stack::Status.new(@stack_name)
|
16
16
|
|
data/lib/ufo/stop.rb
CHANGED
data/lib/ufo/task.rb
CHANGED
@@ -12,7 +12,7 @@ module Ufo
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def run
|
15
|
-
puts "Running task_definition: #{@task_definition}".
|
15
|
+
puts "Running task_definition: #{@task_definition}".color(:green) unless @options[:mute]
|
16
16
|
return if @options[:noop]
|
17
17
|
|
18
18
|
task_options = {
|
@@ -57,7 +57,7 @@ module Ufo
|
|
57
57
|
def exit_if_failures!(resp)
|
58
58
|
return if resp[:failures].nil? || resp[:failures].empty?
|
59
59
|
|
60
|
-
puts "There was a failure running the ECS task.".
|
60
|
+
puts "There was a failure running the ECS task.".color(:red)
|
61
61
|
puts "This might be happen if you have a network_mode of awsvpc and have assigned_public_ip to DISABLED."
|
62
62
|
puts "This cryptic error also shows up if the network settings have security groups and subnets that are not in the same vpc as the ECS cluster container instances. Please double check that."
|
63
63
|
puts "You can use this command to quickly reconfigure the network settings:"
|
@@ -71,7 +71,7 @@ module Ufo
|
|
71
71
|
|
72
72
|
def run_task(options)
|
73
73
|
puts "Equivalent aws cli command:"
|
74
|
-
puts " aws ecs run-task --cluster #{@cluster} --task-definition #{options[:task_definition]}".
|
74
|
+
puts " aws ecs run-task --cluster #{@cluster} --task-definition #{options[:task_definition]}".color(:green)
|
75
75
|
run_task_result = ecs.run_task(options)
|
76
76
|
if @options[:wait]
|
77
77
|
task_arn = run_task_result.tasks[0].task_arn
|
@@ -81,7 +81,7 @@ module Ufo
|
|
81
81
|
end
|
82
82
|
rescue Aws::ECS::Errors::ClientException => e
|
83
83
|
if e.message =~ /ECS was unable to assume the role/
|
84
|
-
puts "ERROR: #{e.class} #{e.message}".
|
84
|
+
puts "ERROR: #{e.class} #{e.message}".color(:red)
|
85
85
|
puts "Please double check the executionRoleArn in your task definition."
|
86
86
|
exit 1
|
87
87
|
else
|
@@ -89,7 +89,7 @@ module Ufo
|
|
89
89
|
end
|
90
90
|
rescue Aws::ECS::Errors::InvalidParameterException => e
|
91
91
|
if e.message =~ /Network Configuration must be provided when networkMode 'awsvpc' is specified/
|
92
|
-
puts "ERROR: #{e.class} #{e.message}".
|
92
|
+
puts "ERROR: #{e.class} #{e.message}".color(:red)
|
93
93
|
puts "Please double check .ufo/params.yml and make sure that network_configuration is set."
|
94
94
|
puts "Or run change the task definition template in .ufo/templates so it does not use vpcmode."
|
95
95
|
exit 1
|
@@ -211,7 +211,7 @@ module Ufo
|
|
211
211
|
container = ecs.describe_tasks(cluster: @cluster, tasks: [task_arn]).tasks[0].containers[0]
|
212
212
|
|
213
213
|
if container.exit_code.nil?
|
214
|
-
puts "Command failed!".
|
214
|
+
puts "Command failed!".color(:red)
|
215
215
|
puts "Reason: #{container.reason}"
|
216
216
|
1
|
217
217
|
else
|
data/lib/ufo/tasks/builder.rb
CHANGED
@@ -19,7 +19,7 @@ module Ufo
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def build
|
22
|
-
puts "Building Task Definitions...".green unless @options[:mute]
|
22
|
+
puts "Building Task Definitions...".color(:green) unless @options[:mute]
|
23
23
|
check_templates_definitions_path
|
24
24
|
dsl = DSL.new(template_definitions_path, @options.merge(quiet: false, mute: true))
|
25
25
|
dsl.run
|
data/lib/ufo/tasks/register.rb
CHANGED
@@ -35,7 +35,7 @@ module Ufo
|
|
35
35
|
unless @options[:mute]
|
36
36
|
puts "Equivalent aws cli command:"
|
37
37
|
file_path = "file://#{@template_definition_path.sub(/^\.\//,'')}"
|
38
|
-
puts " aws ecs register-task-definition --cli-input-json #{file_path}".
|
38
|
+
puts " aws ecs register-task-definition --cli-input-json #{file_path}".color(:green)
|
39
39
|
puts message
|
40
40
|
end
|
41
41
|
end
|
@@ -49,7 +49,7 @@ module Ufo
|
|
49
49
|
ecs.register_task_definition(data)
|
50
50
|
rescue Aws::ECS::Errors::ClientException => e
|
51
51
|
if e.message =~ /No Fargate configuration exists for given values/
|
52
|
-
puts "ERROR: #{e.message}".
|
52
|
+
puts "ERROR: #{e.message}".color(:red)
|
53
53
|
puts "Configured values are: cpu #{data[:cpu]} memory #{data[:memory]}"
|
54
54
|
puts "Check that the cpu and memory values are a supported combination by Fargate."
|
55
55
|
puts "More info: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-cpu-memory-error.html"
|
data/lib/ufo/upgrade/upgrade3.rb
CHANGED
@@ -97,7 +97,7 @@ class Ufo::Upgrade
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def new_env_info
|
100
|
-
puts <<-EOL.
|
100
|
+
puts <<-EOL.color(:yellow)
|
101
101
|
INFO: The UFO_ENV default environment is now development.
|
102
102
|
The short env names have been mapped over to their longer names.
|
103
103
|
Examples:
|
@@ -21,7 +21,7 @@ class Ufo::Upgrade
|
|
21
21
|
src = File.expand_path("./upgrade/params.yml", File.dirname(__FILE__))
|
22
22
|
dest = "#{Ufo.root}/.ufo/params.yml"
|
23
23
|
FileUtils.cp(src, dest)
|
24
|
-
puts "File .ufo/params.yml created.".
|
24
|
+
puts "File .ufo/params.yml created.".color(:green)
|
25
25
|
puts "Please check it out and adjust it to your needs."
|
26
26
|
end
|
27
27
|
|
data/lib/ufo/version.rb
CHANGED
data/spec/lib/task_spec.rb
CHANGED
@@ -45,9 +45,10 @@ describe Ufo::Task do
|
|
45
45
|
def task option_overwrites = {}
|
46
46
|
@task ||=
|
47
47
|
begin
|
48
|
-
|
49
|
-
allow(
|
50
|
-
|
48
|
+
task = Ufo::Task.new(task_definition, options.merge(option_overwrites))
|
49
|
+
allow(task).to receive(:ensure_log_group_exist) # stub not so not called
|
50
|
+
allow(task).to receive(:ecs).and_return(ecs_client)
|
51
|
+
task
|
51
52
|
end
|
52
53
|
end
|
53
54
|
end
|
data/ufo.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency "aws-sdk-ecr"
|
25
25
|
spec.add_dependency "aws-sdk-ecs"
|
26
26
|
spec.add_dependency "aws-sdk-elasticloadbalancingv2"
|
27
|
-
spec.add_dependency "
|
27
|
+
spec.add_dependency "rainbow"
|
28
28
|
spec.add_dependency "deep_merge"
|
29
29
|
spec.add_dependency "memoist"
|
30
30
|
spec.add_dependency "plissken"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ufo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-cloudformation
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rainbow
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -302,6 +302,7 @@ files:
|
|
302
302
|
- docs/_docs/migrations.md
|
303
303
|
- docs/_docs/next-steps.md
|
304
304
|
- docs/_docs/params.md
|
305
|
+
- docs/_docs/redirection-support.md
|
305
306
|
- docs/_docs/route53-support.md
|
306
307
|
- docs/_docs/run-in-pieces.md
|
307
308
|
- docs/_docs/security-groups.md
|