jets 3.1.2 → 3.1.5

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: 9bb051dfd639163f3f633fbf6573d327ee67e802647d506da22c85733244a563
4
- data.tar.gz: 4100d9d52b33f989af9fc8098a97e8214976525cda351b03e388e7111b4dd764
3
+ metadata.gz: fc8976a98ceaa55f97512b3b0e78cec5f28e1d0ade29d23270894cbcfa1ef5c3
4
+ data.tar.gz: 149caed9e86daea3f45e745e6f32c28aa0a15b6b938237305e41bc85c774adc4
5
5
  SHA512:
6
- metadata.gz: 0e249bf85b0fea5d5378e74938a9cf711beb25d24878427de1d18f72f807a56636ffc1db1acbc3e134099c4c4ffec743b8f7d3176a3a63be12f386580bc5828b
7
- data.tar.gz: 0572c04c62eb4fe6a152787b3e9055df137c29f8ddc792584d7c85b9389565056f0c2d1fa78501a8fe9b38557af429da74961b41ec24284396033c31698ca2fc
6
+ metadata.gz: e9a49470b973e8b927c5921a5e373f18d66141d2af0c288fa6a2d0cac4f59fa7a534e1e52bf949d56482f8987843b9f5628d3699f0c27cf4c9cc9f271d6a33c8
7
+ data.tar.gz: 43e8734b1f3e7b2a7cfb16a1c4d74957fac5e4c1deb090d816d003655775374a8e3c03d473dbd7bc2166a05412562d74f811fe6dbe944237a958c9428f76167a
@@ -0,0 +1 @@
1
+ github: boltops-tools
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.5] - 2022-08-08
7
+ - [#628](https://github.com/boltops-tools/jets/pull/628) Multiple Databases
8
+ - [#629](https://github.com/boltops-tools/jets/pull/629) loosen zeitwerk dependency in generated project Gemfile
9
+ - [#630](https://github.com/boltops-tools/jets/pull/630) compile assets with WEBPACKER_ASSET_HOST as s3 endpoint url
10
+
11
+ ## [3.1.4] - 2022-07-02
12
+ - [#627](https://github.com/boltops-tools/jets/pull/627) use >= for most gem dependencies
13
+
14
+ ## [3.1.3] - 2022-06-29
15
+ - [#626](https://github.com/boltops-tools/jets/pull/626) aws options to better handle rate limit for base path mapping
16
+
6
17
  ## [3.1.2] - 2022-04-24
7
18
  - [#618](https://github.com/boltops-tools/jets/pull/618) Jets Console accepts environment cli argument
8
19
  - [#621](https://github.com/boltops-tools/jets/pull/621) Add SQS and SNS event helpers for jobs
data/jets.gemspec CHANGED
@@ -44,7 +44,7 @@ Gem::Specification.new do |spec|
44
44
  spec.add_dependency "aws-sdk-sqs"
45
45
  spec.add_dependency "aws-sdk-ssm"
46
46
  spec.add_dependency "cfn-status"
47
- spec.add_dependency "cfn_camelizer", "~> 0.4.6"
47
+ spec.add_dependency "cfn_camelizer", ">= 0.4.9"
48
48
  spec.add_dependency "cfn_response"
49
49
  spec.add_dependency "dotenv"
50
50
  spec.add_dependency "gems" # jets-gems dependency
@@ -57,11 +57,11 @@ Gem::Specification.new do |spec|
57
57
  spec.add_dependency "railties", "~> 6.1.0" # for ActiveRecord database_tasks.rb
58
58
  spec.add_dependency "rainbow"
59
59
  spec.add_dependency "recursive-open-struct"
60
- spec.add_dependency "serverlessgems", "~> 0.1.4"
60
+ spec.add_dependency "serverlessgems", ">= 0.2.0"
61
61
  spec.add_dependency "shotgun"
62
62
  spec.add_dependency "text-table"
63
63
  spec.add_dependency "thor"
64
- spec.add_dependency "zeitwerk", "~> 2.5.0"
64
+ spec.add_dependency "zeitwerk", ">= 2.6.0"
65
65
 
66
66
  spec.add_development_dependency "bundler"
67
67
  spec.add_development_dependency "byebug"
@@ -77,10 +77,11 @@ class Jets::Application
77
77
  config.inflections.irregular = {}
78
78
 
79
79
  config.assets = ActiveSupport::OrderedOptions.new
80
- config.assets.folders = %w[assets images packs]
81
80
  config.assets.base_url = nil # IE: https://cloudfront.com/my/base/path
82
- config.assets.max_age = 3600
83
81
  config.assets.cache_control = nil # IE: public, max-age=3600 , max_age is a shorter way to set cache_control.
82
+ config.assets.folders = %w[assets images packs]
83
+ config.assets.max_age = 3600
84
+ config.assets.webpacker_asset_host = "s3_endpoint" # true = use conventional by default
84
85
 
85
86
  config.ruby = ActiveSupport::OrderedOptions.new
86
87
 
data/lib/jets/booter.rb CHANGED
@@ -94,11 +94,23 @@ class Jets::Booter
94
94
  # `show processlist` until after a query. Have confirmed that the connection is reused and the connection count stays
95
95
  # the same.
96
96
  def connect_db
97
- primary_hash_config = ActiveRecord::Base.configurations.configs_for(env_name: Jets.env).find { |hash_config|
98
- hash_config.name == "primary"
99
- }
100
- primary_config = primary_hash_config.configuration_hash # configuration_hash is a normal Ruby Hash
101
- ActiveRecord::Base.establish_connection(primary_config)
97
+ if ActiveRecord::Base.legacy_connection_handling
98
+ primary_hash_config = ActiveRecord::Base.configurations.configs_for(env_name: Jets.env).find { |hash_config|
99
+ hash_config.name == "primary"
100
+ }
101
+
102
+ primary_config = primary_hash_config.configuration_hash # configuration_hash is a normal Ruby Hash
103
+
104
+ ActiveRecord::Base.establish_connection(primary_config)
105
+ else
106
+ configs = ActiveRecord::Base.configurations.configs_for(env_name: Jets.env, include_replicas: true)
107
+
108
+ databases = { }
109
+ databases[:writing] = :primary if configs.any? { |config| config.name == "primary" }
110
+ databases[:reading] = :primary_replica if configs.any? { |config| config.name == "primary_replica" }
111
+
112
+ ActiveRecord::Base.connects_to database: databases
113
+ end
102
114
  end
103
115
 
104
116
  def load_internal_turbines
@@ -205,12 +205,45 @@ module Jets::Builders
205
205
  return unless webpacker_included?
206
206
 
207
207
  sh("yarn install")
208
+
209
+ ENV['WEBPACKER_ASSET_HOST'] = webpacker_asset_host if Jets.config.assets.webpacker_asset_host
208
210
  webpack_command = File.exist?("#{Jets.root}/bin/webpack") ?
209
211
  "bin/webpack" :
210
212
  `which webpack`.strip
211
213
  sh "JETS_ENV=#{Jets.env} #{webpack_command}"
212
214
  end
213
215
 
216
+ # Different url for these. Examples:
217
+ #
218
+ # webpacker_asset_host https://demo-dev-s3bucket-lw5vq7ht8ip4.s3.us-west-2.amazonaws.com/jets/public/packs/media/images/boltops-0dd1c6bd.png
219
+ # s3_base_url https://s3-us-west-2.amazonaws.com/demo-dev-s3bucket-lw5vq7ht8ip4/jets/packs/media/images/boltops-0dd1c6bd.png
220
+ #
221
+ # Interesting: webpacker_asset_host works but s3_base_url does not for CORs. IE: reactjs or vuejs requests
222
+ # Thinking AWS configures the non-subdomain url endpoint to be more restrictive.
223
+ #
224
+ def webpacker_asset_host
225
+ # Allow user to set assets.webpacker_asset_host
226
+ #
227
+ # Jets.application.configure do
228
+ # config.assets.webpacker_asset_host = "https://cloudfront.com/my/base/path"
229
+ # end
230
+ #
231
+ assets = Jets.config.assets
232
+ return assets.webpacker_asset_host if assets.webpacker_asset_host && assets.webpacker_asset_host != "s3_endpoint"
233
+ return assets.base_url if assets.base_url
234
+
235
+ # By default, will use the s3 url endpoint directly by convention
236
+ return unless assets.webpacker_asset_host == "s3_endpoint"
237
+
238
+ region = Jets.aws.region
239
+
240
+ asset_base_url = region == 'us-east-1' ?
241
+ "https://#{s3_bucket}.s3.amazonaws.com" :
242
+ "https://#{s3_bucket}.s3.#{region}.amazonaws.com"
243
+
244
+ "#{asset_base_url}/jets/public" # s3_base_url
245
+ end
246
+
214
247
  def webpacker_included?
215
248
  # Old code, leaving around for now:
216
249
  # Thanks: https://stackoverflow.com/questions/4195735/get-list-of-gems-being-used-by-a-bundler-project
@@ -18,7 +18,7 @@ gem "mysql2", "~> 0.5.3"
18
18
  <% unless options[:mode] == 'job' -%>
19
19
  gem "dynomite"
20
20
  <% end -%>
21
- gem "zeitwerk", "~> 2.5.0"
21
+ gem "zeitwerk", ">= 2.5.0"
22
22
 
23
23
  # development and test groups are not bundled as part of the deployment
24
24
  group :development, :test do
@@ -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/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "3.1.2"
2
+ VERSION = "3.1.5"
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.2
4
+ version: 3.1.5
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-04-24 00:00:00.000000000 Z
11
+ date: 2022-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -252,16 +252,16 @@ dependencies:
252
252
  name: cfn_camelizer
253
253
  requirement: !ruby/object:Gem::Requirement
254
254
  requirements:
255
- - - "~>"
255
+ - - ">="
256
256
  - !ruby/object:Gem::Version
257
- version: 0.4.6
257
+ version: 0.4.9
258
258
  type: :runtime
259
259
  prerelease: false
260
260
  version_requirements: !ruby/object:Gem::Requirement
261
261
  requirements:
262
- - - "~>"
262
+ - - ">="
263
263
  - !ruby/object:Gem::Version
264
- version: 0.4.6
264
+ version: 0.4.9
265
265
  - !ruby/object:Gem::Dependency
266
266
  name: cfn_response
267
267
  requirement: !ruby/object:Gem::Requirement
@@ -434,16 +434,16 @@ dependencies:
434
434
  name: serverlessgems
435
435
  requirement: !ruby/object:Gem::Requirement
436
436
  requirements:
437
- - - "~>"
437
+ - - ">="
438
438
  - !ruby/object:Gem::Version
439
- version: 0.1.4
439
+ version: 0.2.0
440
440
  type: :runtime
441
441
  prerelease: false
442
442
  version_requirements: !ruby/object:Gem::Requirement
443
443
  requirements:
444
- - - "~>"
444
+ - - ">="
445
445
  - !ruby/object:Gem::Version
446
- version: 0.1.4
446
+ version: 0.2.0
447
447
  - !ruby/object:Gem::Dependency
448
448
  name: shotgun
449
449
  requirement: !ruby/object:Gem::Requirement
@@ -490,16 +490,16 @@ dependencies:
490
490
  name: zeitwerk
491
491
  requirement: !ruby/object:Gem::Requirement
492
492
  requirements:
493
- - - "~>"
493
+ - - ">="
494
494
  - !ruby/object:Gem::Version
495
- version: 2.5.0
495
+ version: 2.6.0
496
496
  type: :runtime
497
497
  prerelease: false
498
498
  version_requirements: !ruby/object:Gem::Requirement
499
499
  requirements:
500
- - - "~>"
500
+ - - ">="
501
501
  - !ruby/object:Gem::Version
502
- version: 2.5.0
502
+ version: 2.6.0
503
503
  - !ruby/object:Gem::Dependency
504
504
  name: bundler
505
505
  requirement: !ruby/object:Gem::Requirement
@@ -590,6 +590,7 @@ files:
590
590
  - ".cody/docs/bin/subnav.sh"
591
591
  - ".cody/docs/buildspec.yml"
592
592
  - ".cody/docs/project.rb"
593
+ - ".github/FUNDING.yml"
593
594
  - ".github/ISSUE_TEMPLATE.md"
594
595
  - ".github/ISSUE_TEMPLATE/bug_report.md"
595
596
  - ".github/ISSUE_TEMPLATE/documentation.md"