ufo 3.5.7 → 4.0.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 +24 -0
- data/Gemfile.lock +16 -10
- data/README.md +12 -13
- data/docs/_config.yml +1 -1
- data/docs/_docs/auto-completion.md +4 -4
- data/docs/_docs/automated-cleanup.md +1 -1
- data/docs/_docs/conventions.md +7 -7
- data/docs/_docs/customize-cloudformation.md +36 -0
- data/docs/_docs/faq.md +9 -7
- data/docs/_docs/fargate.md +102 -0
- data/docs/_docs/helpers.md +3 -3
- data/docs/_docs/load-balancer.md +72 -0
- data/docs/_docs/migrations.md +2 -2
- data/docs/_docs/next-steps.md +2 -2
- data/docs/_docs/params.md +12 -41
- data/docs/_docs/route53-support.md +28 -0
- data/docs/_docs/run-in-pieces.md +2 -2
- data/docs/_docs/security-groups.md +54 -0
- data/docs/_docs/settings-cfn.md +11 -0
- data/docs/_docs/settings-network.md +34 -0
- data/docs/_docs/settings.md +18 -15
- data/docs/_docs/single-task.md +3 -3
- data/docs/_docs/ssl-support.md +42 -0
- data/docs/_docs/structure.md +5 -1
- data/docs/_docs/stuck-cloudformation.md +30 -0
- data/docs/_docs/tutorial-ufo-docker-build.md +19 -31
- data/docs/_docs/tutorial-ufo-init.md +16 -12
- data/docs/_docs/tutorial-ufo-ship.md +50 -54
- data/docs/_docs/tutorial-ufo-ships.md +9 -7
- data/docs/_docs/tutorial-ufo-tasks-build.md +26 -17
- data/docs/_docs/ufo-current.md +50 -0
- data/docs/_docs/ufo-env-extra.md +21 -0
- data/docs/_docs/ufo-env.md +6 -13
- data/docs/_docs/ufo-tasks-register.md +3 -3
- data/docs/_docs/upgrade4.md +49 -0
- data/docs/_docs/variables.md +5 -5
- data/docs/_docs/why-cloudformation.md +22 -0
- data/docs/_includes/about.html +1 -1
- data/docs/_includes/cfn-customize.md +39 -0
- data/docs/_includes/commands.html +6 -6
- data/docs/_includes/css/ufo.css +1 -0
- data/docs/_includes/example.html +13 -13
- data/docs/_includes/reference.md +1 -1
- data/docs/_includes/subnav.html +22 -5
- data/docs/_includes/ufo-ship-options.md +7 -6
- data/docs/_reference/ufo-apps.md +36 -0
- data/docs/_reference/ufo-cancel.md +24 -0
- data/docs/_reference/ufo-completion.md +1 -1
- data/docs/_reference/ufo-completion_script.md +1 -1
- data/docs/_reference/ufo-current.md +93 -0
- data/docs/_reference/ufo-deploy.md +18 -17
- data/docs/_reference/ufo-destroy.md +6 -4
- data/docs/_reference/ufo-docker-base.md +7 -7
- data/docs/_reference/ufo-docker-build.md +9 -9
- data/docs/_reference/ufo-docker-clean.md +8 -8
- data/docs/_reference/ufo-docker-name.md +4 -4
- data/docs/_reference/ufo-docker.md +4 -2
- data/docs/_reference/ufo-init.md +31 -20
- data/docs/_reference/ufo-network-help.md +15 -0
- data/docs/_reference/ufo-network-init.md +38 -0
- data/docs/_reference/ufo-network.md +26 -0
- data/docs/_reference/ufo-ps.md +53 -0
- data/docs/_reference/ufo-releases.md +40 -0
- data/docs/_reference/ufo-resources.md +44 -0
- data/docs/_reference/ufo-rollback.md +59 -0
- data/docs/_reference/ufo-scale.md +23 -3
- data/docs/_reference/ufo-ship.md +54 -27
- data/docs/_reference/ufo-ships.md +17 -26
- data/docs/_reference/ufo-stop.md +31 -0
- data/docs/_reference/ufo-task.md +15 -16
- data/docs/_reference/ufo-tasks-build.md +10 -10
- data/docs/_reference/ufo-tasks-register.md +3 -3
- data/docs/_reference/ufo-tasks.md +1 -1
- data/docs/_reference/ufo-upgrade-help.md +15 -0
- data/docs/_reference/ufo-upgrade-v2to3.md +15 -0
- data/docs/_reference/ufo-upgrade-v3_3to3_4.md +15 -0
- data/docs/_reference/ufo-upgrade-v3to4.md +27 -0
- data/docs/_reference/ufo-upgrade.md +28 -0
- data/docs/_reference/ufo-version.md +1 -1
- data/docs/articles.md +2 -2
- data/docs/docs.md +1 -1
- data/docs/img/docs/cloudformation-resources.png +0 -0
- data/docs/img/tutorials/ecs-console-task-definitions.png +0 -0
- data/docs/img/tutorials/ecs-console-ufo-ship.png +0 -0
- data/docs/img/tutorials/ecs-console-ufo-ships.png +0 -0
- data/docs/quick-start.md +21 -9
- data/docs/reference.md +10 -2
- data/exe/ufo +1 -1
- data/lib/cfn/stack.yml +259 -0
- data/lib/template/.ufo/params.yml.tt +21 -60
- data/lib/template/.ufo/settings.yml.tt +6 -1
- data/lib/template/.ufo/settings/cfn/default.yml.tt +55 -0
- data/lib/template/.ufo/settings/network/default.yml.tt +18 -0
- data/lib/template/.ufo/task_definitions.rb.tt +7 -6
- data/lib/template/.ufo/templates/fargate.json.erb +1 -1
- data/lib/template/.ufo/templates/main.json.erb +1 -0
- data/lib/template/.ufo/variables/base.rb.tt +5 -2
- data/lib/template/Dockerfile +10 -15
- data/lib/template/bin/deploy.tt +2 -2
- data/lib/ufo.rb +29 -20
- data/lib/ufo/apps.rb +49 -0
- data/lib/ufo/apps/cfn_map.rb +70 -0
- data/lib/ufo/apps/service.rb +56 -0
- data/lib/ufo/aws_service.rb +15 -6
- data/lib/ufo/base.rb +32 -0
- data/lib/ufo/cancel.rb +23 -0
- data/lib/ufo/cli.rb +91 -27
- data/lib/ufo/core.rb +35 -3
- data/lib/ufo/current.rb +104 -0
- data/lib/ufo/destroy.rb +10 -41
- data/lib/ufo/docker/builder.rb +5 -4
- data/lib/ufo/docker/cleaner.rb +1 -1
- data/lib/ufo/docker/pusher.rb +2 -2
- data/lib/ufo/ecr/cleaner.rb +1 -1
- data/lib/ufo/help/apps.md +12 -0
- data/lib/ufo/help/balancer.md +3 -0
- data/lib/ufo/help/current.md +65 -0
- data/lib/ufo/help/deploy.md +4 -4
- data/lib/ufo/help/destroy.md +3 -3
- data/lib/ufo/help/docker.md +3 -1
- data/lib/ufo/help/docker/base.md +7 -7
- data/lib/ufo/help/docker/build.md +9 -9
- data/lib/ufo/help/docker/clean.md +8 -8
- data/lib/ufo/help/docker/name.md +4 -4
- data/lib/ufo/help/help.md +5 -0
- data/lib/ufo/help/init.md +24 -16
- data/lib/ufo/help/network/init.md +13 -0
- data/lib/ufo/help/ps.md +27 -0
- data/lib/ufo/help/releases.md +16 -0
- data/lib/ufo/help/resources.md +20 -0
- data/lib/ufo/help/rollback.md +35 -0
- data/lib/ufo/help/scale.md +22 -2
- data/lib/ufo/help/ship.md +40 -14
- data/lib/ufo/help/ships.md +4 -13
- data/lib/ufo/help/stop.md +7 -0
- data/lib/ufo/help/task.md +9 -9
- data/lib/ufo/help/tasks/build.md +10 -10
- data/lib/ufo/help/tasks/register.md +3 -3
- data/lib/ufo/help/upgrade/v3to4.md +3 -0
- data/lib/ufo/info.rb +62 -0
- data/lib/ufo/init.rb +36 -23
- data/lib/ufo/log_group.rb +2 -1
- data/lib/ufo/network.rb +24 -0
- data/lib/ufo/network/fetch.rb +41 -0
- data/lib/ufo/network/helper.rb +23 -0
- data/lib/ufo/network/init.rb +26 -0
- data/lib/ufo/param.rb +5 -5
- data/lib/ufo/ps.rb +102 -0
- data/lib/ufo/ps/task.rb +78 -0
- data/lib/ufo/releases.rb +14 -0
- data/lib/ufo/rollback.rb +53 -0
- data/lib/ufo/scale.rb +6 -12
- data/lib/ufo/sequence.rb +7 -0
- data/lib/ufo/setting.rb +7 -6
- data/lib/ufo/setting/profile.rb +24 -0
- data/lib/ufo/ship.rb +35 -326
- data/lib/ufo/stack.rb +203 -0
- data/lib/ufo/stack/context.rb +242 -0
- data/lib/ufo/stack/helper.rb +28 -0
- data/lib/ufo/stack/status.rb +195 -0
- data/lib/ufo/stop.rb +47 -0
- data/lib/ufo/task.rb +96 -15
- data/lib/ufo/tasks/register.rb +1 -1
- data/lib/ufo/template_scope.rb +81 -7
- data/lib/ufo/upgrade.rb +32 -0
- data/lib/ufo/{upgrade3.rb → upgrade/upgrade3.rb} +1 -1
- data/lib/ufo/{upgrade33_to_34.rb → upgrade/upgrade33to34.rb} +2 -2
- data/lib/ufo/upgrade/upgrade4.rb +161 -0
- data/lib/ufo/util.rb +19 -6
- data/lib/ufo/version.rb +1 -1
- data/spec/fixtures/apps/describe_services.json +96 -0
- data/spec/fixtures/cfn/stack-events-complete.json +1080 -0
- data/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
- data/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
- data/spec/fixtures/deployments.json +50 -0
- data/spec/fixtures/ps/describe_tasks.json +58 -0
- data/spec/fixtures/settings.yml +2 -0
- data/spec/lib/apps_spec.rb +20 -0
- data/spec/lib/cli_spec.rb +4 -4
- data/spec/lib/ps_spec.rb +14 -0
- data/spec/lib/setting_spec.rb +2 -1
- data/spec/lib/ship_spec.rb +6 -30
- data/spec/lib/stack/status_spec.rb +76 -0
- data/spec/lib/stop_spec.rb +13 -0
- data/spec/lib/task_spec.rb +5 -2
- data/spec/spec_helper.rb +1 -1
- data/ufo.gemspec +2 -0
- metadata +120 -6
- data/docs/_reference/ufo-upgrade3.md +0 -23
- data/docs/_reference/ufo-upgrade3_3_to_3_4.md +0 -23
@@ -1,66 +1,27 @@
|
|
1
|
-
<%%
|
2
|
-
# replace with actual values if using fargate
|
3
|
-
@subnets = ["subnet-111","subnet-222"]
|
4
|
-
@security_groups = ["sg-111"]
|
5
|
-
%>
|
6
1
|
# These params are passsed to the corresponding aws-sdk ecs client methods.
|
7
2
|
# AWS Docs example: https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/ECS/Client.html#run_task-instance_method
|
8
3
|
#
|
9
|
-
#
|
10
|
-
# Uncomment launch_type and network_configuration sections to enable fargate.
|
4
|
+
# The network helper provides access to the .ufo/settings/network/[PROFILE].yml
|
11
5
|
#
|
12
6
|
# More docs: http://ufoships.com/docs/params/
|
13
7
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# update service is provide as an example below. Though it is probably better
|
36
|
-
# to not add any options to update_service if you are using the ECS console
|
37
|
-
# to update these settings often.
|
38
|
-
update_service:
|
39
|
-
# force_new_deployment: true
|
40
|
-
# deployment_configuration:
|
41
|
-
# maximum_percent: 200
|
42
|
-
# minimum_healthy_percent: 100
|
43
|
-
# desired_count: 1
|
44
|
-
# launch_type: "FARGATE"
|
45
|
-
# network_configuration:
|
46
|
-
# awsvpc_configuration:
|
47
|
-
# subnets: <%%= @subnets.inspect %> # required
|
48
|
-
# security_groups: <%%= @security_groups.inspect %>
|
49
|
-
# assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
50
|
-
|
51
|
-
run_task:
|
52
|
-
<% if @options[:launch_type] == "fargate" -%>
|
53
|
-
launch_type: "FARGATE"
|
54
|
-
network_configuration:
|
55
|
-
awsvpc_configuration:
|
56
|
-
subnets: <%%= @subnets.inspect %> # required
|
57
|
-
security_groups: <%%= @security_groups.inspect %>
|
58
|
-
assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
59
|
-
<% else -%>
|
60
|
-
# launch_type: "FARGATE"
|
61
|
-
# network_configuration:
|
62
|
-
# awsvpc_configuration:
|
63
|
-
# subnets: <%%= @subnets.inspect %> # required
|
64
|
-
# security_groups: <%%= @security_groups.inspect %>
|
65
|
-
# assign_public_ip: "ENABLED" # accepts ENABLED, DISABLED
|
66
|
-
<% end -%>
|
8
|
+
# ufo task calls run_tasks.
|
9
|
+
#
|
10
|
+
# ufo task will assign these values appropriately based on the task
|
11
|
+
# definition being ran. So generally you should you can leave these settings
|
12
|
+
# alone.
|
13
|
+
#
|
14
|
+
# If it's a Fargate task definition, ufo task automatically adds the
|
15
|
+
# network_configuration and launch_type: FARGATE
|
16
|
+
# If it's a EC2 task definition with awsvpc network mode, ufo task
|
17
|
+
# automatically adds the network_configuration and security groups using
|
18
|
+
# the security groups from .ufo/settings/network/default.yml.
|
19
|
+
#
|
20
|
+
# run_task:
|
21
|
+
# # network_configuration is required for FARGATE
|
22
|
+
# network_configuration:
|
23
|
+
# awsvpc_configuration:
|
24
|
+
# subnets: <%%= network[:ecs_subnets].inspect %> # required
|
25
|
+
# security_groups: <%%= network[:ecs_security_groups].inspect %>
|
26
|
+
# # for fargate use: assign_public_ip: ENABLED
|
27
|
+
# # assign_public_ip: ENABLED # accepts ENABLED, DISABLED
|
@@ -6,7 +6,12 @@ base:
|
|
6
6
|
image: <%= @image %>
|
7
7
|
# clean_keep: 30
|
8
8
|
# ecr_keep: 30
|
9
|
-
|
9
|
+
network_profile: default # .ufo/settings/network/default.yml file
|
10
|
+
cfn_profile: default # .ufo/settings/cfn/default.yml file
|
11
|
+
# If you want to have prettier name set for the ECS service name
|
12
|
+
# There are some cavaets with this. Updating properties on resources that require
|
13
|
+
# replacment might not work. For example, adding and removing a load balancer.
|
14
|
+
# In these cases, you must delete the entire ecs service and recreate it.
|
10
15
|
|
11
16
|
development:
|
12
17
|
# cluster: development
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
# Options allow you to customize any resources that ufo creates with
|
3
|
+
# CloudFormation. These options are inserting into the generated template.
|
4
|
+
# More info: https://ufoships.com/docs/customize-cloudformation
|
5
|
+
|
6
|
+
elb:
|
7
|
+
scheme: internet-facing
|
8
|
+
|
9
|
+
# https://docs.aws.amazon.com/fr_fr/elasticloadbalancing/latest/APIReference/API_CreateTargetGroup.html
|
10
|
+
#
|
11
|
+
# When using SSL with network elb, the target group protocol is usually http still
|
12
|
+
# unless you also handle SSL termination at the app level.
|
13
|
+
target_group:
|
14
|
+
port: 80 # only used with ECS if awsvpc mode
|
15
|
+
# protocol: TCP # valid values - application elb: HTTP HTTPS, network elb: TCP
|
16
|
+
# ufo sets defaults in cloudformation template
|
17
|
+
# application elb: HTTP
|
18
|
+
# network elb: TCP
|
19
|
+
# so we can keep this commented out, unless we need HTTPS at the app level
|
20
|
+
target_group_attributes:
|
21
|
+
- key: deregistration_delay.timeout_seconds
|
22
|
+
value: 1
|
23
|
+
# network elb support health_check_interval_seconds of 10 or 30
|
24
|
+
# health_check_interval_seconds: 30
|
25
|
+
|
26
|
+
# health check settings are supported by application load balancer only:
|
27
|
+
# health_check_protocol: HTTP # HTTP or HTTPS
|
28
|
+
# health_check_path: /
|
29
|
+
# health_check_port: traffic-port
|
30
|
+
# unhealthy_threshold_count: 10
|
31
|
+
|
32
|
+
# https://docs.aws.amazon.com/fr_fr/elasticloadbalancing/latest/APIReference/API_CreateListener.html
|
33
|
+
#
|
34
|
+
# If HTTPS and SSL is required this is where it would normally be set. Application ELBs
|
35
|
+
# support SSL termination. Network load balancers do not.
|
36
|
+
listener:
|
37
|
+
port: 80 # required by ufo, used in cloudformation template
|
38
|
+
# For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocol is TCP.
|
39
|
+
# protocol: TCP # valid values - application elb: HTTP HTTPS, network elb: TCP
|
40
|
+
# ufo sets defaults in cloudformation template
|
41
|
+
# application elb: HTTP
|
42
|
+
# network elb: TCP
|
43
|
+
# so we can keep this commented out, unless we need HTTPS at elb level
|
44
|
+
# certificates is required if using HTTPS protocol with application
|
45
|
+
# certificates:
|
46
|
+
# - certificate: arn:aws:acm:us-east-1:111111111111:certificate/11111111-2222-3333-4444-555555555555
|
47
|
+
|
48
|
+
# Configure dns to automatically be associated with the ELB dns name.
|
49
|
+
# Note, the route53 record set for the domain name must already exist.
|
50
|
+
# The {stack_name} variable gets replaced with the name of the CloudFormation stack name.
|
51
|
+
# Example: {stack_name} => demo-web
|
52
|
+
# dns:
|
53
|
+
# name: "{stack_name}.yourdomain."
|
54
|
+
# hosted_zone_name: yourdomain. # dont forget the trailing period
|
55
|
+
# TTL: '60' # ttl has special upcase casing
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
vpc: <%= @options[:vpc_id] %>
|
3
|
+
ecs_subnets: # required: at least 2 subnets
|
4
|
+
<% @options[:ecs_subnets].each do |subnet| -%>
|
5
|
+
- <%= subnet %>
|
6
|
+
<% end -%>
|
7
|
+
elb_subnets: # defaults to same subnets as ecs_subnets when not set
|
8
|
+
<% @options[:elb_subnets].each do |subnet| -%>
|
9
|
+
- <%= subnet %>
|
10
|
+
<% end -%>
|
11
|
+
|
12
|
+
# Optional additional existing security group ids to add on top of the ones created
|
13
|
+
# by ufo.
|
14
|
+
# elb_security_groups:
|
15
|
+
# - sg-aaa
|
16
|
+
# ecs_security_groups:
|
17
|
+
# - sg-bbb
|
18
|
+
# - sg-ccc
|
@@ -11,8 +11,9 @@
|
|
11
11
|
#
|
12
12
|
# More info: http://ufoships.com/docs/helpers/
|
13
13
|
#
|
14
|
+
<% source_name = @options[:launch_type] == "fargate" ? "fargate" : "main" -%>
|
14
15
|
task_definition "<%= @app %>-web" do
|
15
|
-
source "
|
16
|
+
source "<%= source_name %>" # will use ufo/templates/<%= source_name %>.json.erb
|
16
17
|
variables(
|
17
18
|
family: task_definition_name,
|
18
19
|
name: "web",
|
@@ -26,7 +27,7 @@ task_definition "<%= @app %>-web" do
|
|
26
27
|
# prefix-name/container-name/ecs-task-id
|
27
28
|
# Here's an exmaple when you specify the prefix of "demo"
|
28
29
|
# demo/web/209e93b4-5523-4496-9a27-662fd151eb78
|
29
|
-
awslogs_group: "ecs/<%= @app %>-web",
|
30
|
+
awslogs_group: ["ecs/<%= @app %>-web", Ufo.env_extra].compact.join('-'),
|
30
31
|
awslogs_stream_prefix: "<%= @app %>",
|
31
32
|
awslogs_region: helper.current_region,
|
32
33
|
# command: ["bin/web"] # IMPORTANT: change or create a bin/web file
|
@@ -34,12 +35,12 @@ task_definition "<%= @app %>-web" do
|
|
34
35
|
end
|
35
36
|
|
36
37
|
task_definition "<%= @app %>-worker" do
|
37
|
-
source "
|
38
|
+
source "<%= source_name %>" # will use ufo/templates/<%= source_name %>.json.erb
|
38
39
|
variables(
|
39
40
|
family: task_definition_name,
|
40
41
|
name: "worker",
|
41
42
|
# Comment out awslogs_* if you do not want logs to be sent to CloudWatch.
|
42
|
-
awslogs_group: "ecs/<%= @app %>-worker",
|
43
|
+
awslogs_group: ["ecs/<%= @app %>-worker", Ufo.env_extra].compact.join('-'),
|
43
44
|
awslogs_stream_prefix: "<%= @app %>",
|
44
45
|
awslogs_region: helper.current_region,
|
45
46
|
# command: ["bin/worker"] # IMPORTANT: change or create a bin/worker file
|
@@ -47,12 +48,12 @@ task_definition "<%= @app %>-worker" do
|
|
47
48
|
end
|
48
49
|
|
49
50
|
task_definition "<%= @app %>-clock" do
|
50
|
-
source "
|
51
|
+
source "<%= source_name %>" # will use ufo/templates/<%= source_name %>.json.erb
|
51
52
|
variables(
|
52
53
|
family: task_definition_name,
|
53
54
|
name: "clock",
|
54
55
|
# Comment out awslogs_* if you do not want logs to be sent to CloudWatch.
|
55
|
-
awslogs_group: "ecs/<%= @app %>-clock",
|
56
|
+
awslogs_group: ["ecs/<%= @app %>-clock", Ufo.env_extra].compact.join('-'),
|
56
57
|
awslogs_stream_prefix: "<%= @app %>",
|
57
58
|
awslogs_region: helper.current_region,
|
58
59
|
# command: ["bin/clock"] # IMPORTANT: change or create a bin/clock file
|
@@ -2,7 +2,7 @@
|
|
2
2
|
"family": "<%= @family %>",
|
3
3
|
"requiresCompatibilities": ["FARGATE"],
|
4
4
|
"networkMode": "awsvpc",
|
5
|
-
"executionRoleArn": "<%= @execution_role_arn %>",
|
5
|
+
"executionRoleArn": "<%= @execution_role_arn || raise("@execution_role_arn needs to be set") %>",
|
6
6
|
"cpu": "<%= @cpu %>",
|
7
7
|
"memory": "<%= @memory %>",
|
8
8
|
"containerDefinitions": [
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Example ufo/variables/base.rb
|
2
2
|
# More info on how variables work: http://ufoships.com/docs/variables/
|
3
|
-
@image = helper.full_image_name # includes the git sha tongueroo/
|
3
|
+
@image = helper.full_image_name # includes the git sha tongueroo/demo-ufo:ufo-[sha].
|
4
4
|
@environment = helper.env_file(".env")
|
5
5
|
<% if @options[:launch_type] == "fargate" -%>
|
6
6
|
# Ensure that the cpu and memory values are a supported combination by Fargate.
|
@@ -8,8 +8,11 @@
|
|
8
8
|
<% end -%>
|
9
9
|
@cpu = 256
|
10
10
|
@memory = 512
|
11
|
-
@memory_reservation =
|
11
|
+
@memory_reservation = 512
|
12
12
|
|
13
13
|
<% if @execution_role_arn_input -%>
|
14
14
|
@execution_role_arn = "<%= @execution_role_arn_input %>"
|
15
|
+
<% else -%>
|
16
|
+
# required for fargate
|
17
|
+
# @execution_role_arn = "..."
|
15
18
|
<% end -%>
|
data/lib/template/Dockerfile
CHANGED
@@ -1,20 +1,15 @@
|
|
1
|
-
FROM ruby:2.5.
|
2
|
-
MAINTAINER Tung Nguyen <tongueroo@gmail.com>
|
1
|
+
FROM ruby:2.5.1
|
3
2
|
|
4
|
-
|
3
|
+
WORKDIR /app
|
4
|
+
ADD Gemfile /app/Gemfile
|
5
|
+
ADD Gemfile.lock /app/Gemfile.lock
|
6
|
+
RUN bundle install --system
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
WORKDIR /tmp
|
9
|
-
COPY Gemfile* /tmp/
|
10
|
-
RUN bundle install && rm -rf /root/.bundle/cache
|
8
|
+
ADD . /app
|
9
|
+
RUN bundle install --system
|
11
10
|
|
12
|
-
|
13
|
-
ENV HOME /root
|
14
|
-
WORKDIR /app
|
15
|
-
COPY . /app
|
16
|
-
RUN bundle install
|
17
|
-
RUN mkdir -p tmp/cache tmp/pids
|
11
|
+
EXPOSE 4567
|
18
12
|
|
19
|
-
|
13
|
+
# If you do not have a bin/web wrapper file, create one or update this command
|
14
|
+
RUN chmod a+x bin/web
|
20
15
|
CMD ["bin/web"]
|
data/lib/template/bin/deploy.tt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/bin/bash -xe
|
2
2
|
|
3
|
-
# Generated
|
4
|
-
# be overridden.
|
3
|
+
# Generated starter bin/deploy script example.
|
4
|
+
# Meant to be overridden.
|
5
5
|
|
6
6
|
# Only build one docker image and deploys it to multiple ECS services
|
7
7
|
ufo ships <%= @app %>-{web,clock,worker}
|
data/lib/ufo.rb
CHANGED
@@ -4,35 +4,44 @@ require 'deep_merge'
|
|
4
4
|
require 'colorize'
|
5
5
|
require 'fileutils'
|
6
6
|
require 'render_me_pretty'
|
7
|
+
require 'memoist'
|
7
8
|
|
8
9
|
module Ufo
|
9
|
-
autoload :
|
10
|
+
autoload :Apps, 'ufo/apps'
|
10
11
|
autoload :AwsService, 'ufo/aws_service'
|
11
|
-
autoload :
|
12
|
-
autoload :
|
13
|
-
autoload :Util, 'ufo/util'
|
14
|
-
autoload :Init, 'ufo/init'
|
15
|
-
autoload :Sequence, 'ufo/sequence'
|
12
|
+
autoload :Base, 'ufo/base'
|
13
|
+
autoload :Cancel, 'ufo/cancel'
|
16
14
|
autoload :CLI, 'ufo/cli'
|
17
|
-
autoload :
|
18
|
-
autoload :
|
19
|
-
autoload :
|
15
|
+
autoload :Command, 'ufo/command'
|
16
|
+
autoload :Completer, "ufo/completer"
|
17
|
+
autoload :Completion, "ufo/completion"
|
18
|
+
autoload :Core, 'ufo/core'
|
19
|
+
autoload :Current, 'ufo/current'
|
20
20
|
autoload :Destroy, 'ufo/destroy'
|
21
|
+
autoload :Docker, 'ufo/docker'
|
21
22
|
autoload :DSL, 'ufo/dsl'
|
22
|
-
autoload :
|
23
|
-
autoload :LogGroup, 'ufo/log_group'
|
23
|
+
autoload :Ecr, 'ufo/ecr'
|
24
24
|
autoload :ECS, 'ufo/ecs'
|
25
|
+
autoload :Help, 'ufo/help'
|
26
|
+
autoload :Info, 'ufo/info'
|
27
|
+
autoload :Init, 'ufo/init'
|
28
|
+
autoload :LogGroup, 'ufo/log_group'
|
29
|
+
autoload :Network, 'ufo/network'
|
25
30
|
autoload :Param, 'ufo/param'
|
26
|
-
autoload :
|
27
|
-
|
28
|
-
autoload :
|
29
|
-
autoload :
|
31
|
+
autoload :Ps, 'ufo/ps'
|
32
|
+
autoload :Releases, 'ufo/releases'
|
33
|
+
autoload :Rollback, 'ufo/rollback'
|
34
|
+
autoload :Scale, 'ufo/scale'
|
35
|
+
autoload :Sequence, 'ufo/sequence'
|
36
|
+
autoload :Setting, 'ufo/setting'
|
37
|
+
autoload :Ship, 'ufo/ship'
|
38
|
+
autoload :Stack, 'ufo/stack'
|
39
|
+
autoload :Stop, 'ufo/stop'
|
40
|
+
autoload :Task, 'ufo/task'
|
30
41
|
autoload :Tasks, 'ufo/tasks'
|
31
|
-
autoload :
|
32
|
-
autoload :
|
33
|
-
autoload :
|
34
|
-
autoload :Upgrade33_to_34, "ufo/upgrade33_to_34"
|
42
|
+
autoload :TemplateScope, 'ufo/template_scope'
|
43
|
+
autoload :Upgrade, "ufo/upgrade"
|
44
|
+
autoload :Util, 'ufo/util'
|
35
45
|
|
36
46
|
extend Core
|
37
47
|
end
|
38
|
-
|
data/lib/ufo/apps.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'text-table'
|
2
|
+
|
3
|
+
module Ufo
|
4
|
+
class Apps
|
5
|
+
autoload :CfnMap, "ufo/apps/cfn_map"
|
6
|
+
autoload :Service, "ufo/apps/service"
|
7
|
+
|
8
|
+
extend Memoist
|
9
|
+
include Stack::Helper
|
10
|
+
|
11
|
+
def initialize(options)
|
12
|
+
@options = options
|
13
|
+
@cluster = @options[:cluster] || default_cluster
|
14
|
+
end
|
15
|
+
|
16
|
+
def list
|
17
|
+
begin
|
18
|
+
resp = ecs.list_services(cluster: @cluster)
|
19
|
+
rescue Aws::ECS::Errors::ClusterNotFoundException => e
|
20
|
+
puts "ECS cluster #{@cluster.colorize(:green)} not found."
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
arns = resp.service_arns.sort
|
24
|
+
|
25
|
+
puts "Listing ECS services in the #{@cluster.colorize(:green)} cluster."
|
26
|
+
if arns.empty?
|
27
|
+
puts "No ECS services found in the #{@cluster.colorize(:green)} cluster."
|
28
|
+
return
|
29
|
+
end
|
30
|
+
|
31
|
+
resp = ecs.describe_services(services: arns, cluster: @cluster)
|
32
|
+
display_info(resp)
|
33
|
+
end
|
34
|
+
|
35
|
+
def display_info(resp)
|
36
|
+
table = Text::Table.new
|
37
|
+
table.head = ["Service Name", "Task Definition", "Running", "Launch type", "Ufo?"]
|
38
|
+
resp["services"].each do |s|
|
39
|
+
table.rows << service_info(s)
|
40
|
+
end
|
41
|
+
puts table unless ENV['TEST']
|
42
|
+
end
|
43
|
+
|
44
|
+
# for specs
|
45
|
+
def service_info(s)
|
46
|
+
Service.new(s, @options).to_a
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
class Ufo::Apps
|
2
|
+
class CfnMap
|
3
|
+
extend Memoist
|
4
|
+
include Ufo::Stack::Helper
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
@options = options
|
8
|
+
@cluster = @options[:cluster] || default_cluster
|
9
|
+
@map = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
# Example:
|
13
|
+
# {"development-demo-web-Ecs-1L3WUTJFFM5JV"=>"demo-web"}
|
14
|
+
def map
|
15
|
+
return @map if @populated
|
16
|
+
|
17
|
+
populate_map!
|
18
|
+
@populated = true
|
19
|
+
@map
|
20
|
+
end
|
21
|
+
|
22
|
+
def summaries
|
23
|
+
filter = %w[
|
24
|
+
UPDATE_COMPLETE
|
25
|
+
CREATE_COMPLETE
|
26
|
+
UPDATE_ROLLBACK_COMPLETE
|
27
|
+
UPDATE_IN_PROGRESS
|
28
|
+
UPDATE_COMPLETE_CLEANUP_IN_PROGRESS
|
29
|
+
UPDATE_ROLLBACK_IN_PROGRESS
|
30
|
+
UPDATE_ROLLBACK_FAILED
|
31
|
+
UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS
|
32
|
+
REVIEW_IN_PROGRESS
|
33
|
+
]
|
34
|
+
|
35
|
+
summaries = []
|
36
|
+
next_token = true
|
37
|
+
while next_token
|
38
|
+
resp = cloudformation.list_stacks(stack_status_filter: filter)
|
39
|
+
summaries += resp.stack_summaries
|
40
|
+
next_token = resp.next_token
|
41
|
+
end
|
42
|
+
|
43
|
+
# look for stacks that beling that ufo create
|
44
|
+
summaries.select do |s|
|
45
|
+
s.template_description =~ /Ufo ECS stack/
|
46
|
+
end
|
47
|
+
end
|
48
|
+
memoize :summaries
|
49
|
+
|
50
|
+
def populate_map!
|
51
|
+
threads = []
|
52
|
+
summaries.each do |summary|
|
53
|
+
threads << Thread.new do
|
54
|
+
resp = cloudformation.describe_stack_resources(stack_name: summary.stack_name)
|
55
|
+
ecs_resource = resp.stack_resources.find do |resource|
|
56
|
+
resource.logical_resource_id == "Ecs"
|
57
|
+
end
|
58
|
+
# Example: "PhysicalResourceId": "arn:aws:ecs:us-east-1:111111111111:service/dev-demo-web-Ecs-1HRL8Y9F4D1CR"
|
59
|
+
ecs_service_name = ecs_resource.physical_resource_id.split('/').last
|
60
|
+
@map[ecs_service_name] = stack_name_to_service_name(summary.stack_name)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
threads.map(&:join)
|
64
|
+
end
|
65
|
+
|
66
|
+
def stack_name_to_service_name(stack_name)
|
67
|
+
stack_name.sub("#{@cluster}-",'')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|