rubycfn 0.5.2 → 0.5.3
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/CHANGELOG.md +5 -1
- data/Gemfile.lock +2 -2
- data/README.md +5 -6
- data/lib/rubycfn/version.rb +1 -1
- data/templates/.gitignore +4 -0
- data/templates/.rubocop.yml +3 -0
- data/templates/README.md +1 -1
- data/templates/Rakefile +3 -4
- data/templates/config.yaml +3 -0
- data/templates/lib/aws_helper/compiler.rb +1 -1
- data/templates/lib/aws_helper/dependencies.rb +11 -3
- data/templates/lib/aws_helper/upload_stack.rb +3 -10
- data/templates/lib/core/applications.rb +117 -28
- data/templates/lib/core/dependencies.rb +3 -3
- data/templates/lib/core/deploy.rb +2 -2
- data/templates/lib/core/init.rb +60 -12
- data/templates/lib/main.rb +1 -1
- data/templates/lib/shared_concerns/global_variables.rb +1 -1
- data/templates/lib/shared_concerns/shared_methods.rb +2 -2
- data/templates/lib/stacks/ecs_stack/ecs_cluster.rb +276 -276
- data/templates/lib/stacks/ecs_stack/lifecycle_hook.rb +162 -160
- data/templates/lib/stacks/ecs_stack/load_balancer.rb +52 -50
- data/templates/lib/stacks/ecs_stack/main.rb +2 -0
- data/templates/lib/stacks/ecs_stack/rollback.rb +77 -0
- metadata +4 -3
- data/templates/bootstrap/dependency_stack.rb +0 -49
@@ -1,12 +1,14 @@
|
|
1
1
|
module EcsStack
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
include Rubycfn
|
4
|
+
|
4
5
|
included do
|
5
6
|
include Concerns::GlobalVariables
|
6
7
|
include Concerns::SharedMethods
|
7
8
|
include EcsStack::EcsCluster
|
8
9
|
include EcsStack::LifecycleHook
|
9
10
|
include EcsStack::LoadBalancer
|
11
|
+
include EcsStack::Rollback
|
10
12
|
|
11
13
|
description generate_stack_description("EcsStack")
|
12
14
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module EcsStack
|
2
|
+
module Rollback
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
included do
|
5
|
+
resource :application_deployment_failure_rollback_lambda,
|
6
|
+
type: "AWS::Lambda::Function" do |r|
|
7
|
+
r.property(:code) do
|
8
|
+
{
|
9
|
+
"S3Bucket": "xebia-${AWS::Region}".fnsub,
|
10
|
+
"S3Key": "ecs-rollback-0.0.6.zip"
|
11
|
+
}
|
12
|
+
end
|
13
|
+
r.property(:handler) { "index.lambda_handler" }
|
14
|
+
r.property(:role) { :application_deployment_failure_rollback_lambda_role.ref(:arn) }
|
15
|
+
r.property(:runtime) { "ruby2.5" }
|
16
|
+
r.property(:timeout) { 500 }
|
17
|
+
end
|
18
|
+
|
19
|
+
resource :application_deployment_failure_rollback_lambda_role,
|
20
|
+
type: "AWS::IAM::Role" do |r|
|
21
|
+
r.property(:assume_role_policy_document) do
|
22
|
+
{
|
23
|
+
"Version": "2012-10-17",
|
24
|
+
"Statement": [
|
25
|
+
{
|
26
|
+
"Effect": "Allow",
|
27
|
+
"Principal": {
|
28
|
+
"Service": [
|
29
|
+
"lambda.amazonaws.com"
|
30
|
+
]
|
31
|
+
},
|
32
|
+
"Action": "sts:AssumeRole"
|
33
|
+
}
|
34
|
+
]
|
35
|
+
}
|
36
|
+
end
|
37
|
+
r.property(:role_name) { "#{environment}-EcsApplicationFailureDetectionRole" }
|
38
|
+
end
|
39
|
+
|
40
|
+
resource :application_deployment_failure_rollback_lambda_policy,
|
41
|
+
type: "AWS::IAM::Policy" do |r|
|
42
|
+
r.property(:policy_document) do
|
43
|
+
{
|
44
|
+
"Version": "2012-10-17",
|
45
|
+
"Statement": [
|
46
|
+
{
|
47
|
+
"Effect": "Allow",
|
48
|
+
"Action": %w(logs:CreateLogGroup logs:CreateLogStream logs:PutLogEvents),
|
49
|
+
"Resource": [
|
50
|
+
"arn:aws:logs:*:*:*"
|
51
|
+
]
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"Effect": "Allow",
|
55
|
+
"Action": [
|
56
|
+
"ecs:*"
|
57
|
+
],
|
58
|
+
"Resource": [
|
59
|
+
"*"
|
60
|
+
]
|
61
|
+
}
|
62
|
+
]
|
63
|
+
}
|
64
|
+
end
|
65
|
+
r.property(:policy_name) { "#{environment}-EcsApplicationFailureDetectionPolicy" }
|
66
|
+
r.property(:roles) do
|
67
|
+
[
|
68
|
+
:application_deployment_failure_rollback_lambda_role.ref
|
69
|
+
]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
output :application_deployment_failure_rollback_function_arn,
|
74
|
+
value: :application_deployment_failure_rollback_lambda.ref(:arn)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubycfn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Vink
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: neatjson
|
@@ -276,6 +276,7 @@ files:
|
|
276
276
|
- templates/.env.acceptance
|
277
277
|
- templates/.env.dependencies.rspec
|
278
278
|
- templates/.env.development
|
279
|
+
- templates/.env.private
|
279
280
|
- templates/.env.production
|
280
281
|
- templates/.env.rspec
|
281
282
|
- templates/.env.test
|
@@ -284,7 +285,6 @@ files:
|
|
284
285
|
- templates/Gemfile
|
285
286
|
- templates/README.md
|
286
287
|
- templates/Rakefile
|
287
|
-
- templates/bootstrap/dependency_stack.rb
|
288
288
|
- templates/config.yaml
|
289
289
|
- templates/lib/aws_helper/aws_sdk.rb
|
290
290
|
- templates/lib/aws_helper/compiler.rb
|
@@ -313,6 +313,7 @@ files:
|
|
313
313
|
- templates/lib/stacks/ecs_stack/lifecycle_hook.rb
|
314
314
|
- templates/lib/stacks/ecs_stack/load_balancer.rb
|
315
315
|
- templates/lib/stacks/ecs_stack/main.rb
|
316
|
+
- templates/lib/stacks/ecs_stack/rollback.rb
|
316
317
|
- templates/lib/stacks/parent_stack/main.rb
|
317
318
|
- templates/lib/stacks/parent_stack/parent.rb
|
318
319
|
- templates/lib/stacks/vpc_stack/infra_vpc.rb
|
@@ -1,49 +0,0 @@
|
|
1
|
-
description "Dependency Stack"
|
2
|
-
|
3
|
-
parameter :environment,
|
4
|
-
description: "Environment name",
|
5
|
-
type: "String"
|
6
|
-
|
7
|
-
parameter :domain_name,
|
8
|
-
description: "Domain name",
|
9
|
-
type: "String"
|
10
|
-
|
11
|
-
condition :has_environment,
|
12
|
-
[["", :environment.ref].fnequals].fnnot
|
13
|
-
|
14
|
-
condition :has_domain_name,
|
15
|
-
[["", :domain_name.ref].fnequals].fnnot
|
16
|
-
|
17
|
-
%i(
|
18
|
-
artifact_bucket
|
19
|
-
cloudformation_bucket
|
20
|
-
lambda_bucket
|
21
|
-
logging_bucket
|
22
|
-
).each do |bucket|
|
23
|
-
resource bucket,
|
24
|
-
deletion_policy: "Retain",
|
25
|
-
update_replace_policy: "Retain",
|
26
|
-
type: "AWS::S3::Bucket"
|
27
|
-
|
28
|
-
output bucket,
|
29
|
-
value: bucket.ref
|
30
|
-
end
|
31
|
-
|
32
|
-
resource :hosted_zone,
|
33
|
-
condition: "HasDomainName",
|
34
|
-
type: "AWS::Route53::HostedZone" do |r|
|
35
|
-
r.property(:hosted_zone_config) do
|
36
|
-
{
|
37
|
-
"Comment": ["Hosted zone for ", ["HasEnvironment", [:environment.ref, "."].fnjoin, ""].fnif, :domain_name.ref].fnjoin
|
38
|
-
}
|
39
|
-
end
|
40
|
-
r.property(:name) { [["HasEnvironment", [:environment.ref, "."].fnjoin, ""].fnif, :domain_name.ref].fnjoin }
|
41
|
-
end
|
42
|
-
|
43
|
-
output :hosted_zone_id,
|
44
|
-
condition: "HasDomainName",
|
45
|
-
value: :hosted_zone.ref
|
46
|
-
|
47
|
-
output :hosted_zone_name,
|
48
|
-
condition: "HasDomainName",
|
49
|
-
value: [["HasEnvironment", [:environment.ref, "."].fnjoin, ""].fnif, :domain_name.ref].fnjoin
|