jets 0.8.15 → 0.8.17

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 206368176f2661c1254edeeed935b3437f97e9e5cad9237534f97026a07f084d
4
- data.tar.gz: 95820a8b5b3f6ff80f6b0c73251857b9864b90bdc76c1ee2151496ab4496e943
3
+ metadata.gz: 1c79e90582a2e523c69fc73f18e77632854a9f2af07068520cadf3f66b087542
4
+ data.tar.gz: 1f977706cd38f61a72a921486e3e318894da5a9b54ecf5d5676250997649b033
5
5
  SHA512:
6
- metadata.gz: 9bcc9319fd7b52d8e3172c1d6f00ed29988a44517287b19d921b333a5e6be9fc6ac5c7c9b5ed5b892c17156a9111d378543698affbc75a700d19ba66f5f2cc4a
7
- data.tar.gz: 82cb32c3e29cf73c5240f3a5187449a818c39c833edaaed4188d1ecf5633d9502b0b5894a7a76e7645ae13626aafbc1b81680b704decadbad952119fc340b18c
6
+ metadata.gz: 17346b2c0a6555166ae17d7e5e8236e44cb3a8cea385f9d619d877f4899a31566a48558b57b0cf0be8c412bbe0cdd6b594a57e835ea27a46ecb47d4209fee48e
7
+ data.tar.gz: 8edf25b912614f8536d30ce1c90f6fc10bc841077db20be03a4f61fa3d5fb2fc2ca72d0b866d2284850db07a968b3009106bb64c59ab632e426c7add0918795e
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.8.17]
7
+ - fix Jets.eager_load
8
+
9
+ ## [0.8.16]
10
+ - add minimal deploy iam policy docs
11
+ - harden deploy, auto delete minimal stack in rollback_completed
12
+ - Merge pull request #38 from tongueroo/harden-deploy-rollbacks
13
+
6
14
  ## [0.8.15]
7
15
  - fix route resources macro for api mode pull request #35
8
16
  - remove pg dependency from jets and add as part of project Gemfile pull request #36
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- jets (0.8.15)
14
+ jets (0.8.17)
15
15
  actionpack (>= 5.2.1)
16
16
  actionview (>= 5.2.1)
17
17
  activerecord (>= 5.2.1)
@@ -118,7 +118,7 @@ GEM
118
118
  mini_portile2 (~> 2.3.0)
119
119
  pg (0.21.0)
120
120
  rack (2.0.5)
121
- rack-proxy (0.6.4)
121
+ rack-proxy (0.6.5)
122
122
  rack
123
123
  rack-test (1.1.0)
124
124
  rack (>= 1.0, < 3)
data/README.md CHANGED
@@ -139,3 +139,8 @@ For more documentation, check out the official docs: [Ruby on Jets](http://rubyo
139
139
  * [AWS Lambda Ruby Support at Native Speed with Jets](https://blog.boltops.com/2018/09/02/aws-lambda-ruby-support-at-native-speed-with-jets)
140
140
  * [Jets Tutorial An Introductory CRUD App Part 1](https://blog.boltops.com/2018/09/07/jets-tutorial-crud-app-introduction-part-1)
141
141
  * [Jets Tutorial Deploy to AWS Lambda Part 2](https://blog.boltops.com/2018/09/08/jets-tutorial-deploy-to-aws-lambda-part-2)
142
+ * [Jets Tutorial Debugging Logs Part 3](https://blog.boltops.com/2018/09/09/jets-tutorial-debugging-logs-part-3)
143
+ * [Jets Tutorial Background Jobs Part 4](https://blog.boltops.com/2018/09/10/jets-tutorial-background-jobs-part-4)
144
+ * [Jets Tutorial IAM Policies Part 5](https://blog.boltops.com/2018/09/11/jets-tutorial-iam-policies-part-5)
145
+ * [Jets Tutorial Function Properties Part 6](https://blog.boltops.com/2018/09/12/jets-tutorial-function-properties-part-6)
146
+ * [Jets Tutorial Extra Environments Part 7](https://blog.boltops.com/2018/09/13/jets-tutorial-extra-environments-part-7)
@@ -47,6 +47,7 @@ module Jets
47
47
  autoload :Logger, "jets/logger"
48
48
 
49
49
  autoload :Resource, "jets/resource"
50
+ autoload :Rdoc, "jets/rdoc"
50
51
  end
51
52
 
52
53
  require "jets/core_ext/kernel"
@@ -50,7 +50,6 @@ class Jets::Cfn
50
50
 
51
51
  def create_stack
52
52
  # parent stack template is on filesystem and child stacks templates is on s3
53
- template_body = IO.read(@template_path)
54
53
  cfn.create_stack(stack_options)
55
54
  end
56
55
  time :create_stack
@@ -60,7 +59,7 @@ class Jets::Cfn
60
59
  cfn.update_stack(stack_options)
61
60
  rescue Aws::CloudFormation::Errors::ValidationError => e
62
61
  puts "ERROR: #{e.message}".red
63
- error = true
62
+ true # error
64
63
  end
65
64
  end
66
65
  time :update_stack
@@ -125,7 +124,7 @@ class Jets::Cfn
125
124
  puts " #{command_with_iam(capabilities)}"
126
125
 
127
126
  puts "Please confirm (y/n)"
128
- confirm = $stdin.gets
127
+ $stdin.gets # confirm
129
128
  end
130
129
 
131
130
  def command_with_iam(capabilities)
@@ -1,5 +1,6 @@
1
1
  module Jets::Commands
2
2
  class Deploy
3
+ extend Memoist
3
4
  include StackInfo
4
5
  include Jets::Timing
5
6
 
@@ -16,7 +17,15 @@ module Jets::Commands
16
17
  build_code
17
18
  validate_routes!
18
19
 
19
- # first time will deploy minimal stack
20
+ # Delete existing rollback stack from previous bad minimal deploy
21
+ if minimal_rollback_complete?
22
+ puts "Existing stack is in ROLLBACK_COMPLETE state from a previous failed minimal deploy. Deleting stack and continuing."
23
+ cfn.delete_stack(stack_name: stack_name)
24
+ status.wait
25
+ status.reset
26
+ end
27
+
28
+ # Stack could be in a weird rollback state or in progress state
20
29
  exit_unless_updateable!
21
30
 
22
31
  ship(stack_type: :minimal) if first_run?
@@ -56,6 +65,44 @@ module Jets::Commands
56
65
  end
57
66
  time :ship
58
67
 
68
+ def status
69
+ Jets::Cfn::Status.new(stack_name)
70
+ end
71
+ memoize :status
72
+
73
+ def stack_name
74
+ Jets::Naming.parent_stack_name
75
+ end
76
+
77
+ # Checks for a few things before deciding to delete the parent stack
78
+ #
79
+ # * Parent stack status status is ROLLBACK_COMPLETE
80
+ # * Parent resources are in the DELETE_COMPLETE state
81
+ #
82
+ def minimal_rollback_complete?
83
+ stack = find_stack(stack_name)
84
+ return false unless stack
85
+
86
+ return false unless stack.stack_status == 'ROLLBACK_COMPLETE'
87
+
88
+ # Finally check if all the minimal resources in the parent template have been deleted
89
+ resp = cfn.describe_stack_resources(stack_name: stack_name)
90
+ resource_statuses = resp.stack_resources.map(&:resource_status).uniq
91
+ resource_statuses == ['DELETE_COMPLETE']
92
+ end
93
+
94
+ def find_stack(stack_name)
95
+ resp = cfn.describe_stacks(stack_name: stack_name)
96
+ resp.stacks.first
97
+ rescue Aws::CloudFormation::Errors::ValidationError => e
98
+ # example: Stack with id demo-dev does not exist
99
+ if e.message =~ /Stack with/ && e.message =~ /does not exist/
100
+ nil
101
+ else
102
+ raise
103
+ end
104
+ end
105
+
59
106
  # All CloudFormation states listed here: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-describing-stacks.html
60
107
  def exit_unless_updateable!
61
108
  stack_name = Jets::Naming.parent_stack_name
@@ -66,9 +113,12 @@ module Jets::Commands
66
113
  status = stack["stack_status"]
67
114
  if status =~ /^ROLLBACK_/ ||
68
115
  status =~ /_IN_PROGRESS$/
69
- puts "Parent stack associate with this '#{Jets.config.project_name}' project not in a updateable state.".colorize(:red)
70
- puts "Stack name #{stack_name} status #{stack["stack_status"]}"
71
- exit
116
+ region = `aws configure get region`.strip rescue "us-east-1"
117
+ url = "https://console.aws.amazon.com/cloudformation/home?region=#{region}#/stacks"
118
+ puts "The parent stack of the #{Jets.config.project_name.colorize(:green)} project is not in an updateable state."
119
+ puts "Stack name #{stack_name.colorize(:yellow)} status #{stack["stack_status"].colorize(:yellow)}"
120
+ puts "Here's the CloudFormation url to check for more details #{url}"
121
+ exit 1
72
122
  end
73
123
  end
74
124
  end
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "0.8.15"
2
+ VERSION = "0.8.17"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.15
4
+ version: 0.8.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-15 00:00:00.000000000 Z
11
+ date: 2018-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack