jets 3.1.0 → 3.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2aa7cee0958dbdb8e631abc755587de924e101c25b5f64d2f1c4b31ec1abf3d9
4
- data.tar.gz: bd4aaa8264304a61a780140f1f0f33d0e68658d57c6be55487f27faa090fdf57
3
+ metadata.gz: 726e7d682375020dc0217d8680724f3c782471fc1a1c76b9af233b07cb390f76
4
+ data.tar.gz: 5bb27fa6daebd4be2f9f90406b304b9ae8565c8437f9dee5e635b2faf9fa1a08
5
5
  SHA512:
6
- metadata.gz: 0a0b34e96bb206743a192297848e70f03ef07ed587633e81bd1731881dcca2fb2a9232c374194c795b1e48eb537b690b882650c9f9173e5c77faca4cb1a9a83d
7
- data.tar.gz: 2270fd363dc73f508e662ba4a115a71d54db9f298f5db17738328b88ec62284a544a41668a93b18bcbc094009d6bf178cc82c65e37a751f2af3036c8cb00a680
6
+ metadata.gz: bf32cc71500b183d01beed8cbdb5b130a24e617a0fc3ecb71e3b3658dde36e1ff5251c0d669fa8741bcc95bdc66f2fe95f1ba80c5dd7896d55f87939599b93a6
7
+ data.tar.gz: 3a636a67e7dc792840b61c54e3469745fdabcdacd61fc7eca143b41a8db7d03ff5cfa381b9759a84ddf3c1e34d232b6df03837053abc64c94a55fa971e1c24a9
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
+ ## [3.1.3] - 2022-06-29
7
+ - [#626](https://github.com/boltops-tools/jets/pull/626) aws options to better handle rate limit for base path mapping
8
+
9
+ ## [3.1.2] - 2022-04-24
10
+ - [#618](https://github.com/boltops-tools/jets/pull/618) Jets Console accepts environment cli argument
11
+ - [#621](https://github.com/boltops-tools/jets/pull/621) Add SQS and SNS event helpers for jobs
12
+ - [#624](https://github.com/boltops-tools/jets/pull/624) Add lambda.function.ephemeral_storage function property support
13
+
14
+ ## [3.1.1] - 2022-01-18
15
+ - [#615](https://github.com/boltops-tools/jets/pull/615) adjust required_ruby_version
16
+
6
17
  ## [3.1.0] - 2022-01-08
7
18
  - [#614](https://github.com/boltops-tools/jets/pull/614) support zeitwerk 2.5
8
19
  - clean command alias -y for --yes option
data/jets.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://rubyonjets.com"
15
15
  spec.license = "MIT"
16
16
 
17
- spec.required_ruby_version = '~> 2.5'
17
+ spec.required_ruby_version = ['>= 2.5.0', '< 3.0.0']
18
18
  spec.rdoc_options += Jets::Rdoc.options
19
19
 
20
20
  vendor_files = Dir.glob("vendor/**/*")
@@ -59,6 +59,7 @@ class Jets::Application
59
59
  # default memory setting based on:
60
60
  # https://medium.com/epsagon/how-to-make-lambda-faster-memory-performance-benchmark-be6ebc41f0fc
61
61
  config.function.memory_size = 1536
62
+ config.function.ephemeral_storage = { size: 512 } # megabytes
62
63
 
63
64
  config.prewarm = ActiveSupport::OrderedOptions.new
64
65
  config.prewarm.enable = true
data/lib/jets/cli.rb CHANGED
@@ -63,7 +63,8 @@ class Jets::CLI
63
63
  # Pretty tricky, we need to use the raw @given_args as thor_args eventually calls Commands::Base#eager_load!
64
64
  # which uses Jets.env before we get a chance to override ENV['JETS_ENV']
65
65
  command, env = @given_args[0..1]
66
- return unless %w[deploy delete].include?(command)
66
+
67
+ return unless %w[deploy delete console c].include?(command)
67
68
  env = nil if env&.starts_with?('-')
68
69
  return unless env
69
70
  ENV['JETS_ENV'] = env ? env : 'development'
@@ -1,5 +1,11 @@
1
1
  class Jets::Commands::Console
2
- def self.run
2
+ attr_reader :environment
3
+
4
+ def initialize(environment)
5
+ @environment = environment
6
+ end
7
+
8
+ def run
3
9
  puts Jets::Booter.message
4
10
 
5
11
  # Thanks: https://mutelight.org/bin-console
@@ -61,10 +61,13 @@ module Jets::Commands
61
61
  Jets::Router.validate_routes!
62
62
  end
63
63
 
64
- desc "console", "REPL console with Jets environment loaded"
64
+ desc "console [environment]", "REPL console with Jets environment loaded"
65
65
  long_desc Help.text(:console)
66
- def console
67
- Console.run
66
+ # Note the environment is here to trick the Thor parser to allowing an
67
+ # environment parameter. It is not actually set here. It is set earlier
68
+ # in cli.rb: set_jets_env_from_cli_arg!
69
+ def console(environment=nil)
70
+ Console.new(options).run
68
71
  end
69
72
 
70
73
  desc "runner", "Run Ruby code in the context of Jets app non-interactively"
@@ -35,6 +35,7 @@ Jets.application.configure do
35
35
  # security_group_ids: %w[sg-1 sg-2],
36
36
  # subnet_ids: %w[subnet-1 subnet-2],
37
37
  # }
38
+ # config.function.ephemeral_storage = { size: 1536 }
38
39
  # The config.function settings to the CloudFormation Lambda Function properties.
39
40
  # http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html
40
41
  # Underscored format can be used for keys to make it look more ruby-ish.
@@ -91,10 +91,22 @@ class BasePathMapping
91
91
  end
92
92
 
93
93
  def apigateway
94
- @apigateway ||= Aws::APIGateway::Client.new
94
+ @apigateway ||= Aws::APIGateway::Client.new(aws_options)
95
95
  end
96
96
 
97
97
  def cfn
98
- @cfn ||= Aws::CloudFormation::Client.new
98
+ @cfn ||= Aws::CloudFormation::Client.new(aws_options)
99
+ end
100
+
101
+ def aws_options
102
+ options = {
103
+ retry_limit: 7, # default: 3
104
+ retry_base_delay: 0.6, # default: 0.3
105
+ }
106
+ options.merge!(
107
+ log_level: :debug,
108
+ logger: Logger.new($stdout),
109
+ ) if ENV['JETS_DEBUG_AWS_SDK']
110
+ options
99
111
  end
100
112
  end
data/lib/jets/job/base.rb CHANGED
@@ -13,6 +13,8 @@ module Jets::Job
13
13
  include Helpers::KinesisEventHelper
14
14
  include Helpers::LogEventHelper
15
15
  include Helpers::S3EventHelper
16
+ include Helpers::SnsEventHelper
17
+ include Helpers::SqsEventHelper
16
18
 
17
19
  # Tracks bucket each time an s3_event is declared
18
20
  # Map of bucket_name => stack_name (nested part)
@@ -0,0 +1,8 @@
1
+ module Jets::Job::Helpers
2
+ module SnsEventHelper
3
+ def sns_event_payload
4
+ message = event&.dig("Records", 0, "Sns", "Message")
5
+ @sns_event_payload ||= ActiveSupport::HashWithIndifferentAccess.new(JSON.load(message))
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Jets::Job::Helpers
2
+ module SqsEventHelper
3
+ def sqs_event_payload
4
+ message = event&.dig("Records", 0, "body")
5
+ @sqs_event_payload ||= ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(message))
6
+ end
7
+ end
8
+ end
@@ -57,6 +57,7 @@ module Jets::Lambda::Dsl
57
57
  PROPERTIES = %W[
58
58
  dead_letter_config
59
59
  description
60
+ ephemeral_storage
60
61
  handler
61
62
  kms_key_arn
62
63
  memory_size
@@ -33,6 +33,7 @@ module Jets::Stack::Main::Dsl
33
33
  runtime: :ruby,
34
34
  timeout: Jets.config.function.timeout,
35
35
  memory_size: Jets.config.function.memory_size,
36
+ ephemeral_storage: Jets.config.function.ephemeral_storage,
36
37
  description: description,
37
38
  }
38
39
 
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "3.1.0"
2
+ VERSION = "3.1.3"
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: 3.1.0
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-08 00:00:00.000000000 Z
11
+ date: 2022-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -863,6 +863,8 @@ files:
863
863
  - lib/jets/job/helpers/kinesis_event_helper.rb
864
864
  - lib/jets/job/helpers/log_event_helper.rb
865
865
  - lib/jets/job/helpers/s3_event_helper.rb
866
+ - lib/jets/job/helpers/sns_event_helper.rb
867
+ - lib/jets/job/helpers/sqs_event_helper.rb
866
868
  - lib/jets/klass.rb
867
869
  - lib/jets/lambda/dsl.rb
868
870
  - lib/jets/lambda/function.rb
@@ -1086,16 +1088,19 @@ require_paths:
1086
1088
  - lib
1087
1089
  required_ruby_version: !ruby/object:Gem::Requirement
1088
1090
  requirements:
1089
- - - "~>"
1091
+ - - ">="
1092
+ - !ruby/object:Gem::Version
1093
+ version: 2.5.0
1094
+ - - "<"
1090
1095
  - !ruby/object:Gem::Version
1091
- version: '2.5'
1096
+ version: 3.0.0
1092
1097
  required_rubygems_version: !ruby/object:Gem::Requirement
1093
1098
  requirements:
1094
1099
  - - ">="
1095
1100
  - !ruby/object:Gem::Version
1096
1101
  version: '0'
1097
1102
  requirements: []
1098
- rubygems_version: 3.1.6
1103
+ rubygems_version: 3.3.10
1099
1104
  signing_key:
1100
1105
  specification_version: 4
1101
1106
  summary: Ruby Serverless Framework