serverless-rack 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +15 -3
- data/lib/serverless_rack.rb +10 -9
- data/serverless-rack.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67c45bfb333ad3b27bd1d7f36e5b98ecc7ead2f27762a9ddc1c713b7d2cc5a9b
|
4
|
+
data.tar.gz: 9db88c7bf781a67032fb866886d443ff219140427ce1087e667d836a39f9271a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dbfe05405a816ae2a31e62a3046253f842616e72b3ca3aa0149e337f97d59e75127f3d513b657f2357e94c1c31a11701f352b2d82c75a22843f296dd388f988
|
7
|
+
data.tar.gz: 75b78e2e61ab8fcba27b75ac33c4cf328049b26ea97ff3480b4049e013d4b25d7a89c4e17896c57f08cd9f90ea53a6cdab196e97c1ba2d009888e32d23fc3bfd
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# 1.0.6
|
2
|
+
|
3
|
+
- Upgrade dependencies
|
4
|
+
- Add a dockerImage config option to override the docker image to be used for compiling gems (defaults to the lambci ruby images) (#17)
|
5
|
+
|
6
|
+
_Benjamin Curtis_
|
7
|
+
|
8
|
+
- Cache the bundle that is created by docker to avoid recompiling gems (#17)
|
9
|
+
|
10
|
+
_Benjamin Curtis_
|
11
|
+
|
12
|
+
- Handle empty `API_GATEWAY_BASE_PATH` (#14)
|
13
|
+
|
14
|
+
_Joel Van Horn_
|
15
|
+
|
1
16
|
# 1.0.5
|
2
17
|
|
3
18
|
- Upgrade dependencies
|
data/README.md
CHANGED
@@ -139,13 +139,23 @@ For more information, see https://bundler.io/docs.html.
|
|
139
139
|
|
140
140
|
If your application depends on any gems that include compiled binaries, these
|
141
141
|
must be compiled for the lambda execution environment. Enabling the `dockerizeBundler` configuration
|
142
|
-
option will fetch and build the gems using a
|
143
|
-
that emulates the lambda environment:
|
142
|
+
option will fetch and build the gems using a docker image that emulates the lambda environment:
|
144
143
|
|
145
144
|
```yaml
|
146
145
|
custom:
|
147
146
|
rack:
|
148
|
-
dockerizeBundler:
|
147
|
+
dockerizeBundler: true
|
148
|
+
```
|
149
|
+
|
150
|
+
The default docker image that will be used will match the runtime you are using.
|
151
|
+
That is, if you are using the `ruby2.7` runtime, then the docker image will be
|
152
|
+
`logandk/serverless-rack-bundler:ruby2.7`. You can override the docker image with the
|
153
|
+
`dockerImage` configuration option:
|
154
|
+
|
155
|
+
```yaml
|
156
|
+
custom:
|
157
|
+
rack:
|
158
|
+
dockerImage: lambci/lambda:build-ruby2.5
|
149
159
|
```
|
150
160
|
|
151
161
|
### Bundler configuration
|
@@ -219,6 +229,8 @@ $ sls rack serve -p 8000
|
|
219
229
|
When running locally, an environment variable named `IS_OFFLINE` will be set to `True`.
|
220
230
|
So, if you want to know when the application is running locally, check `ENV["IS_OFFLINE"]`.
|
221
231
|
|
232
|
+
For use with the `serverless-offline` plugin, run `sls rack install` prior to `sls offline`.
|
233
|
+
|
222
234
|
### Remote command execution
|
223
235
|
|
224
236
|
The `rack exec` command lets you execute ruby code remotely:
|
data/lib/serverless_rack.rb
CHANGED
@@ -15,17 +15,19 @@ TEXT_MIME_TYPES = [
|
|
15
15
|
'image/svg+xml'
|
16
16
|
].freeze
|
17
17
|
|
18
|
+
def base_path
|
19
|
+
"/#{ENV['API_GATEWAY_BASE_PATH']}" unless ENV['API_GATEWAY_BASE_PATH'].to_s.empty?
|
20
|
+
end
|
21
|
+
|
18
22
|
def keepalive_event?(event)
|
19
23
|
['aws.events', 'serverless-plugin-warmup'].include?(event['source'])
|
20
24
|
end
|
21
25
|
|
22
26
|
def parse_script_name(event, headers)
|
23
|
-
if
|
24
|
-
"/#{ENV['API_GATEWAY_BASE_PATH']}"
|
25
|
-
elsif (headers['Host'] || '').include?('amazonaws.com')
|
27
|
+
if base_path.nil? && (headers['Host'] || '').include?('amazonaws.com')
|
26
28
|
"/#{event['requestContext']['stage']}"
|
27
29
|
else
|
28
|
-
|
30
|
+
base_path.to_s
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
@@ -33,12 +35,11 @@ def parse_path_info(event)
|
|
33
35
|
# If a user is using a custom domain on API Gateway, they may have a base
|
34
36
|
# path in their URL. This allows us to strip it out via an optional
|
35
37
|
# environment variable.
|
36
|
-
if
|
37
|
-
|
38
|
-
|
38
|
+
if base_path && event['path'].start_with?(base_path)
|
39
|
+
event['path'][base_path.length..-1]
|
40
|
+
else
|
41
|
+
event['path']
|
39
42
|
end
|
40
|
-
|
41
|
-
event['path']
|
42
43
|
end
|
43
44
|
|
44
45
|
def parse_query_string(event)
|
data/serverless-rack.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverless-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logan Raarup
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: '0'
|
59
59
|
requirements: []
|
60
|
-
rubygems_version: 3.
|
60
|
+
rubygems_version: 3.1.2
|
61
61
|
signing_key:
|
62
62
|
specification_version: 4
|
63
63
|
summary: Serverless plugin to deploy Ruby Rack applications (Sinatra/Padrino/Cuba
|