jets 5.0.2 → 5.0.4
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 +11 -0
- data/jets.gemspec +1 -1
- data/lib/jets/builders/code_builder.rb +4 -3
- data/lib/jets/builders/handler_generator.rb +8 -0
- data/lib/jets/cfn/builder/parent.rb +1 -1
- data/lib/jets/cfn/builder.rb +2 -2
- data/lib/jets/cfn/params/common.rb +1 -1
- data/lib/jets/cfn/ship.rb +5 -15
- data/lib/jets/cfn/status.rb +46 -3
- data/lib/jets/cfn/upload.rb +3 -0
- data/lib/jets/commands/delete/delete_command.rb +2 -2
- data/lib/jets/commands/deploy/deploy_command.rb +4 -4
- data/lib/jets/commands/status/status_command.rb +8 -1
- data/lib/jets/core.rb +4 -0
- data/lib/jets/generators/overrides/app/templates/Gemfile.tt +4 -1
- data/lib/jets/stack/builder.rb +1 -1
- data/lib/jets/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5dfbf6918bc02ab0aa922e66411129fb177f79acbefd26f481b9d0b9e6fe046
|
4
|
+
data.tar.gz: 81bde117ec85d14328dc523c20e757123c8e73ea7de508e0ab00f368cce7a38d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7794943a90301a37af8dc14338e0504a53b0d3ff37ae6a15541c48130194e06078de0d66ef4be6b119db37284ae679c87095e7c252ef4860938aba31ff72af4
|
7
|
+
data.tar.gz: 0b768fa41186630d876fd9690003c8c3ff3f70b46ace56a3f325d931dc4ae80dd2a777d2bfe3af0c8f6b73b377a83ab4c0bb3bd2158d3baddd6afcdd7a8cacb5
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,17 @@
|
|
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/).
|
5
5
|
|
6
|
+
## [5.0.4] - 2023-12-17
|
7
|
+
- [#695](https://github.com/rubyonjets/jets/pull/695) dont run reconfigure webpacker unless using
|
8
|
+
- [#696](https://github.com/rubyonjets/jets/pull/696) improve deploy failure message by showing nested stack failure message
|
9
|
+
- update delete error messaging to stack
|
10
|
+
|
11
|
+
## [5.0.3] - 2023-12-15
|
12
|
+
- [#691](https://github.com/rubyonjets/jets/pull/691) jets deploy fix for empty project
|
13
|
+
- [#692](https://github.com/rubyonjets/jets/pull/692) fix jets deploy for empty project
|
14
|
+
- [#693](https://github.com/rubyonjets/jets/pull/693) do not include sprockets-jets in new app generator for api mode
|
15
|
+
- [#694](https://github.com/rubyonjets/jets/pull/694) fix jets deploy for empty project
|
16
|
+
|
6
17
|
## [5.0.2] - 2023-12-11
|
7
18
|
- [#688](https://github.com/rubyonjets/jets/pull/688) improve releases:info output
|
8
19
|
|
data/jets.gemspec
CHANGED
@@ -48,7 +48,7 @@ Gem::Specification.new do |spec|
|
|
48
48
|
spec.add_dependency "aws-sdk-ssm"
|
49
49
|
spec.add_dependency "cfn_camelizer", ">= 0.4.9"
|
50
50
|
spec.add_dependency "cfn_response"
|
51
|
-
spec.add_dependency "cfn-status"
|
51
|
+
spec.add_dependency "cfn-status", ">= 0.5.0"
|
52
52
|
spec.add_dependency "cli-format", ">= 0.4.0"
|
53
53
|
spec.add_dependency "dotenv"
|
54
54
|
spec.add_dependency "dsl_evaluator", ">= 0.3.0" # for DslEvaluator.print_code
|
@@ -232,7 +232,7 @@ module Jets::Builders
|
|
232
232
|
# Checking this way because when using jets standalone for Afterburner mode we don't want to run into
|
233
233
|
# bundler gem collisions. TODO: figure out the a better way to handle the collisions.
|
234
234
|
lines = IO.readlines("#{Jets.root}/Gemfile")
|
235
|
-
lines.detect { |l| l =~
|
235
|
+
lines.detect { |l| l =~ /gem ['"]#{name}/ && l !~ /^\s*?#/ }
|
236
236
|
end
|
237
237
|
|
238
238
|
# Cleans out non-cached files like code-*.zip in Jets.build_root
|
@@ -279,6 +279,7 @@ module Jets::Builders
|
|
279
279
|
# when they deploy a jets project in development mode
|
280
280
|
def reconfigure_development_webpacker
|
281
281
|
return unless Jets.env.development?
|
282
|
+
return unless gemfile_include?("jetpacker")
|
282
283
|
headline "Reconfiguring webpacker development settings for AWS Lambda."
|
283
284
|
|
284
285
|
webpacker_yml = "#{"#{stage_area}/code"}/config/webpacker.yml"
|
@@ -305,7 +306,7 @@ module Jets::Builders
|
|
305
306
|
puts "Skip packaging ruby".color(:yellow) # useful for developing handlers
|
306
307
|
return
|
307
308
|
end
|
308
|
-
return
|
309
|
+
return unless Jets.gem_layer?
|
309
310
|
|
310
311
|
check_agree
|
311
312
|
ruby_packager.install
|
@@ -322,7 +323,7 @@ module Jets::Builders
|
|
322
323
|
end
|
323
324
|
|
324
325
|
def build_lambda_layer
|
325
|
-
return
|
326
|
+
return unless Jets.gem_layer?
|
326
327
|
lambda_layer = LambdaLayer.new
|
327
328
|
lambda_layer.build
|
328
329
|
end
|
@@ -45,6 +45,14 @@ module Jets::Builders
|
|
45
45
|
generate_handler(vars)
|
46
46
|
end
|
47
47
|
end
|
48
|
+
|
49
|
+
if app_files.empty? && Jets.gem_layer?
|
50
|
+
# When there are no app files, still need to generate a shim for JetsController
|
51
|
+
lib = File.expand_path('../../..', __dir__)
|
52
|
+
path = "#{lib}/engines/internal/app/controllers/jets/public_controller.rb"
|
53
|
+
vars = Jets::Builders::ShimVars::App.new(path)
|
54
|
+
generate_handler(vars)
|
55
|
+
end
|
48
56
|
end
|
49
57
|
|
50
58
|
def generate_handler(vars)
|
@@ -44,7 +44,7 @@ class Jets::Cfn::Builder
|
|
44
44
|
add_resource(resource)
|
45
45
|
add_outputs(resource.outputs)
|
46
46
|
|
47
|
-
return
|
47
|
+
return unless Jets.gem_layer?
|
48
48
|
resource = Jets::Cfn::Resource::Lambda::GemLayer.new
|
49
49
|
add_resource(resource)
|
50
50
|
add_outputs(resource.outputs)
|
data/lib/jets/cfn/builder.rb
CHANGED
@@ -86,8 +86,8 @@ module Jets::Cfn
|
|
86
86
|
builder_class = "Jets::Cfn::Builder::#{app_class}".constantize
|
87
87
|
|
88
88
|
app_class = Jets::Klass.from_path(path)
|
89
|
-
if Jets.
|
90
|
-
return # No prewarm when there's only poly functions
|
89
|
+
if !Jets.gem_layer? && app_class == Jets::PreheatJob
|
90
|
+
return # No prewarm when there's only poly functions and no gem layer
|
91
91
|
end
|
92
92
|
|
93
93
|
# Builder class fully qualified name:
|
data/lib/jets/cfn/ship.rb
CHANGED
@@ -31,16 +31,11 @@ module Jets::Cfn
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
|
34
|
+
# waits for /(_COMPLETE|_FAILED)$/ status
|
35
|
+
cfn_status = Jets::Cfn::Status.new
|
36
|
+
success = cfn_status.wait
|
35
37
|
unless success
|
36
|
-
|
37
|
-
The Jets application failed to deploy. Jets creates a few CloudFormation stacks to deploy your application.
|
38
|
-
The logs above show the CloudFormation parent stack events and points to the stack with the error.
|
39
|
-
Please go to the CloudFormation console and look for the specific stack with the error.
|
40
|
-
The specific child stack usually shows more detailed information and can be used to resolve the issue.
|
41
|
-
Example of checking the CloudFormation console: https://rubyonjets.com/docs/debugging/cloudformation/
|
42
|
-
EOL
|
43
|
-
exit 1
|
38
|
+
cfn_status.failure_message!
|
44
39
|
end
|
45
40
|
|
46
41
|
save_apigw_state
|
@@ -100,11 +95,6 @@ module Jets::Cfn
|
|
100
95
|
@template ||= Template.new(Jets::Names.parent_template_path, @options)
|
101
96
|
end
|
102
97
|
|
103
|
-
# check for /(_COMPLETE|_FAILED)$/ status
|
104
|
-
def wait_for_stack
|
105
|
-
Jets::Cfn::Status.new(@options).wait
|
106
|
-
end
|
107
|
-
|
108
98
|
def save_apigw_state
|
109
99
|
Jets::Router::State.save_apigw_state
|
110
100
|
end
|
@@ -116,7 +106,7 @@ module Jets::Cfn
|
|
116
106
|
end
|
117
107
|
return unless @options[:stack_type] == :full # s3 bucket is available
|
118
108
|
return unless Jets.config.prewarm.enable
|
119
|
-
return
|
109
|
+
return unless Jets.gem_layer?
|
120
110
|
|
121
111
|
puts "Prewarming application."
|
122
112
|
Jets::PreheatJob.prewarm!
|
data/lib/jets/cfn/status.rb
CHANGED
@@ -2,9 +2,52 @@ require 'cfn_status'
|
|
2
2
|
|
3
3
|
module Jets::Cfn
|
4
4
|
class Status < CfnStatus
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
extend Memoist
|
6
|
+
|
7
|
+
def initialize(stack_name = Jets::Names.parent_stack_name, options={})
|
8
|
+
super(stack_name, options)
|
9
|
+
end
|
10
|
+
|
11
|
+
def failure_message!
|
12
|
+
puts <<~EOL
|
13
|
+
The Jets application failed to deploy. Jets creates a few CloudFormation stacks
|
14
|
+
to deploy your application. The logs above show the CloudFormation parent stack
|
15
|
+
events. You can go to the CloudFormation console and look for the nested stack
|
16
|
+
with the error. The specific nested stack usually shows more detailed information
|
17
|
+
and can be used to resolve the issue.
|
18
|
+
Example of checking the CloudFormation console:
|
19
|
+
|
20
|
+
https://rubyonjets.com/docs/debugging/cloudformation/
|
21
|
+
|
22
|
+
EOL
|
23
|
+
|
24
|
+
show_nested_stack_error
|
25
|
+
|
26
|
+
exit 1
|
27
|
+
end
|
28
|
+
|
29
|
+
def show_nested_stack_error
|
30
|
+
event = find_failed_event
|
31
|
+
return unless event
|
32
|
+
puts "-" * 80
|
33
|
+
puts "Here's the nested stack error details: #{event.resource_status_reason}"
|
34
|
+
self.class.new(event.physical_resource_id, start_index_before_delete: true).run
|
35
|
+
|
36
|
+
region = Jets.aws.region
|
37
|
+
puts <<~EOL
|
38
|
+
Here's also the AWS Console link to the failed nested stack:
|
39
|
+
|
40
|
+
https://#{region}.console.aws.amazon.com/cloudformation/home?region=#{region}#/stacks/events?filteringText=&filteringStatus=active&viewNested=true&stackId=#{event.physical_resource_id}
|
41
|
+
|
42
|
+
EOL
|
43
|
+
end
|
44
|
+
|
45
|
+
def find_failed_event
|
46
|
+
cfn_status = self.class.new # fresh instance to get the refreshed events
|
47
|
+
cfn_status.refresh_events
|
48
|
+
i = cfn_status.start_index
|
49
|
+
events = cfn_status.events[0..i].reverse # events are in reverse chronological order
|
50
|
+
events.find { |e| e.resource_status =~ /FAILED/ } # first failed event
|
8
51
|
end
|
9
52
|
end
|
10
53
|
end
|
data/lib/jets/cfn/upload.rb
CHANGED
@@ -138,6 +138,9 @@ module Jets::Cfn
|
|
138
138
|
# If only max_age is provided, then we'll generate a cache_control header.
|
139
139
|
# Using max_age is the shorter and simply way of setting the cache_control header.
|
140
140
|
def cache_control
|
141
|
+
# default when sprockets-jets not installed
|
142
|
+
return "public, max-age=3600" unless Jets.config.respond_to?(:assets)
|
143
|
+
|
141
144
|
cache_control = Jets.config.assets.cache_control
|
142
145
|
unless cache_control
|
143
146
|
max_age = Jets.config.assets.max_age # defaults to 3600 in jets/application.rb
|
@@ -44,7 +44,7 @@ module Jets::Command
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def wait_for_stack
|
47
|
-
status = Jets::Cfn::Status.new
|
47
|
+
status = Jets::Cfn::Status.new
|
48
48
|
start_time = Time.now
|
49
49
|
status.wait
|
50
50
|
took = Time.now - start_time
|
@@ -60,7 +60,7 @@ module Jets::Command
|
|
60
60
|
def confirm_project_exists
|
61
61
|
stack = find_stack(parent_stack_name)
|
62
62
|
return if stack
|
63
|
-
puts "ERROR:
|
63
|
+
puts "ERROR: Stack #{parent_stack_name} does not exist".color(:red)
|
64
64
|
exit 1
|
65
65
|
end
|
66
66
|
|
@@ -44,8 +44,8 @@ module Jets::Command
|
|
44
44
|
def delete_minimal_stack
|
45
45
|
puts "Existing stack is in ROLLBACK_COMPLETE state from a previous failed minimal deploy. Deleting stack and continuing."
|
46
46
|
cfn.delete_stack(stack_name: stack_name)
|
47
|
-
|
48
|
-
|
47
|
+
cfn_status.wait
|
48
|
+
cfn_status.reset
|
49
49
|
end
|
50
50
|
|
51
51
|
def check_dev_mode
|
@@ -69,8 +69,8 @@ module Jets::Command
|
|
69
69
|
Jets::Cfn::Ship.new(options).run
|
70
70
|
end
|
71
71
|
|
72
|
-
def
|
73
|
-
@
|
72
|
+
def cfn_status
|
73
|
+
@cfn_status ||= Jets::Cfn::Status.new(stack_name)
|
74
74
|
end
|
75
75
|
|
76
76
|
def stack_name
|
@@ -1,9 +1,16 @@
|
|
1
1
|
module Jets::Command
|
2
2
|
class StatusCommand < Base
|
3
|
+
include Jets::AwsServices
|
4
|
+
|
3
5
|
desc "status", "Shows the current status of the Jets app"
|
4
6
|
long_desc Help.text(:status)
|
5
7
|
def perform
|
6
|
-
Jets
|
8
|
+
Jets.boot
|
9
|
+
cfn_status = Jets::Cfn::Status.new
|
10
|
+
success = cfn_status.run
|
11
|
+
unless success
|
12
|
+
cfn_status.failure_message!
|
13
|
+
end
|
7
14
|
end
|
8
15
|
end
|
9
16
|
end
|
data/lib/jets/core.rb
CHANGED
@@ -207,6 +207,10 @@ module Jets::Core
|
|
207
207
|
Jets.config.cfn.build.controllers == "one_lambda_for_all_controllers"
|
208
208
|
end
|
209
209
|
|
210
|
+
def gem_layer?
|
211
|
+
!Jets.poly_only? || Jets.one_lambda_for_all_controllers?
|
212
|
+
end
|
213
|
+
|
210
214
|
# Do not memoize here. The JetsBucket.name does it's own special memoization.
|
211
215
|
def s3_bucket
|
212
216
|
Jets::Cfn::Resource::S3::JetsBucket.name
|
@@ -2,9 +2,12 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gem "jets", "~> <%= Jets::VERSION %>"
|
4
4
|
|
5
|
+
<%- if options[:mode] == 'html'-%>
|
6
|
+
gem "sprockets-jets"
|
7
|
+
<% end -%>
|
8
|
+
|
5
9
|
<%- if options[:mode] != 'job' && !options[:database].nil? -%>
|
6
10
|
<%= database_gemfile_entry %>
|
7
|
-
gem "sprockets-jets"
|
8
11
|
<%- end -%>
|
9
12
|
<%- if options[:mode] == 'html' -%>
|
10
13
|
gem "importmap-jets"
|
data/lib/jets/stack/builder.rb
CHANGED
data/lib/jets/version.rb
CHANGED
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: 5.0.
|
4
|
+
version: 5.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -296,14 +296,14 @@ dependencies:
|
|
296
296
|
requirements:
|
297
297
|
- - ">="
|
298
298
|
- !ruby/object:Gem::Version
|
299
|
-
version:
|
299
|
+
version: 0.5.0
|
300
300
|
type: :runtime
|
301
301
|
prerelease: false
|
302
302
|
version_requirements: !ruby/object:Gem::Requirement
|
303
303
|
requirements:
|
304
304
|
- - ">="
|
305
305
|
- !ruby/object:Gem::Version
|
306
|
-
version:
|
306
|
+
version: 0.5.0
|
307
307
|
- !ruby/object:Gem::Dependency
|
308
308
|
name: cli-format
|
309
309
|
requirement: !ruby/object:Gem::Requirement
|