lambda_punch 1.0.3 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +1 -0
- data/.devcontainer/devcontainer.json +19 -0
- data/.devcontainer/postCreate.sh +6 -0
- data/.github/workflows/test.yml +10 -11
- data/CHANGELOG.md +13 -1
- data/Gemfile.lock +8 -4
- data/README.md +21 -21
- data/bin/setup +3 -3
- data/bin/test +1 -3
- data/exe/lambda_punch +11 -0
- data/lib/lambda_punch/version.rb +1 -1
- metadata +12 -13
- data/Dockerfile +0 -2
- data/bin/_setup +0 -6
- data/bin/_test +0 -4
- data/bin/bootstrap +0 -6
- data/bin/run +0 -6
- data/docker-compose.yml +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edd0fcb9d2a3d808ef2f2209f7d2b9c344e372fecb918bd6d2e25dfe375b3c55
|
4
|
+
data.tar.gz: 4a0972320ed7f3734e43b9cfe9a9fde1134a2148b44532914361c99bc4b1f4fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07bb2eccf539f0322316520fb0b45ee95110e7e6d47165cc3460542de6629c6f72a616901616fbf93a8fc75fb6fa1208619fcf17e80c059c0f204a21893cc261
|
7
|
+
data.tar.gz: d1414ca50a4bcaca75dd346eab56b360d447f8f7e31736e4fe2a9d62ffafcd79cf9f4f77c5b8b687ce8eba1b3405daa34e06f576aebd64fd5dfe38076fcadd19
|
@@ -0,0 +1 @@
|
|
1
|
+
FROM mcr.microsoft.com/devcontainers/ruby:3.1
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"name": "lambda_punch",
|
3
|
+
"build": {
|
4
|
+
"dockerfile": "Dockerfile"
|
5
|
+
},
|
6
|
+
"features": {
|
7
|
+
"ghcr.io/devcontainers/features/sshd:latest": {}
|
8
|
+
},
|
9
|
+
"customizations": {
|
10
|
+
"vscode": {
|
11
|
+
"settings": {
|
12
|
+
"editor.formatOnSave": true
|
13
|
+
},
|
14
|
+
"extensions": []
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"postCreateCommand": ".devcontainer/postCreate.sh",
|
18
|
+
"remoteUser": "vscode"
|
19
|
+
}
|
data/.github/workflows/test.yml
CHANGED
@@ -2,16 +2,15 @@ name: Test
|
|
2
2
|
on: [push]
|
3
3
|
jobs:
|
4
4
|
test:
|
5
|
-
runs-on: ubuntu-
|
5
|
+
runs-on: ubuntu-20.04
|
6
6
|
steps:
|
7
7
|
- name: Checkout
|
8
|
-
uses: actions/checkout@
|
9
|
-
- name:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
./bin/test
|
8
|
+
uses: actions/checkout@v3
|
9
|
+
- name: Setup & Test
|
10
|
+
uses: devcontainers/ci@v0.3
|
11
|
+
with:
|
12
|
+
env: |
|
13
|
+
CI
|
14
|
+
runCmd: |
|
15
|
+
./bin/setup
|
16
|
+
./bin/test
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,20 @@
|
|
1
|
+
## [1.1.1] - 2023-04-16
|
2
|
+
|
3
|
+
### Fixed
|
4
|
+
|
5
|
+
- The `lambda_punch` install file.
|
6
|
+
|
7
|
+
## [1.1.0] - 2023-04-16
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- New `lambda_punch` install interface.
|
12
|
+
|
1
13
|
## [1.0.3] - 2021-10-27
|
2
14
|
|
3
15
|
### Added
|
4
16
|
|
5
|
-
-
|
17
|
+
- Any Timeout Gem. Tempfile Location Interface
|
6
18
|
|
7
19
|
### Changed
|
8
20
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lambda_punch (1.
|
4
|
+
lambda_punch (1.1.1)
|
5
5
|
concurrent-ruby
|
6
6
|
rake
|
7
7
|
rb-inotify
|
@@ -74,7 +74,7 @@ GEM
|
|
74
74
|
concurrent-ruby (1.1.9)
|
75
75
|
crass (1.0.6)
|
76
76
|
erubi (1.10.0)
|
77
|
-
ffi (1.15.
|
77
|
+
ffi (1.15.5)
|
78
78
|
globalid (0.5.2)
|
79
79
|
activesupport (>= 5.0)
|
80
80
|
i18n (1.8.10)
|
@@ -87,11 +87,13 @@ GEM
|
|
87
87
|
marcel (1.0.2)
|
88
88
|
method_source (1.0.0)
|
89
89
|
mini_mime (1.1.2)
|
90
|
+
mini_portile2 (2.6.1)
|
90
91
|
minitest (5.14.4)
|
91
92
|
minitest-focus (1.3.1)
|
92
93
|
minitest (>= 4, < 6)
|
93
94
|
nio4r (2.5.8)
|
94
|
-
nokogiri (1.12.5
|
95
|
+
nokogiri (1.12.5)
|
96
|
+
mini_portile2 (~> 2.6.1)
|
95
97
|
racc (~> 1.4)
|
96
98
|
pry (0.14.1)
|
97
99
|
coderay (~> 1.1)
|
@@ -137,7 +139,7 @@ GEM
|
|
137
139
|
activesupport (>= 4.0)
|
138
140
|
sprockets (>= 3.0.0)
|
139
141
|
thor (1.1.0)
|
140
|
-
timeout (0.2
|
142
|
+
timeout (0.3.2)
|
141
143
|
tzinfo (2.0.4)
|
142
144
|
concurrent-ruby (~> 1.0)
|
143
145
|
websocket-driver (0.7.5)
|
@@ -146,6 +148,8 @@ GEM
|
|
146
148
|
zeitwerk (2.5.1)
|
147
149
|
|
148
150
|
PLATFORMS
|
151
|
+
aarch64-linux
|
152
|
+
arm64-darwin-22
|
149
153
|
x86_64-linux
|
150
154
|
|
151
155
|
DEPENDENCIES
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# 👊 LambdaPunch
|
6
6
|
|
7
|
-
<a href="https://lamby.custominktech.com"><img src="https://
|
7
|
+
<a href="https://lamby.custominktech.com"><img src="https://raw.githubusercontent.com/customink/lamby/master/images/social2.png" alt="Lamby: Simple Rails & AWS Lambda Integration using Rack." align="right" width="450" style="margin-left:1rem;margin-bottom:1rem;" /></a>Asynchronous background job processing for AWS Lambda with Ruby using [Lambda Extensions](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-extensions-api.html). Inspired by the [SuckerPunch](https://github.com/brandonhilkert/sucker_punch) gem but specifically tooled to work with Lambda's invoke model.
|
8
8
|
|
9
9
|
**For a more robust background job solution, please consider using AWS SQS with the [Lambdakiq](https://github.com/customink/lambdakiq) gem. A drop-in replacement for [Sidekiq](https://github.com/mperham/sidekiq) when running Rails in AWS Lambda using the [Lamby](https://lamby.custominktech.com/) gem.**
|
10
10
|
|
@@ -18,35 +18,36 @@ The LambdaPunch extension process is very small and lean. It only requires a few
|
|
18
18
|
|
19
19
|
## 🎁 Installation
|
20
20
|
|
21
|
-
Add this line to your project's `Gemfile` and then make sure to `bundle install` afterward.
|
21
|
+
Add this line to your project's `Gemfile` and then make sure to `bundle install` afterward. It is only needed in the `production` group.
|
22
22
|
|
23
23
|
```ruby
|
24
24
|
gem 'lambda_punch'
|
25
25
|
```
|
26
26
|
|
27
|
-
|
27
|
+
Within your project or [Rails application's](https://lamby.custominktech.com/docs/anatomy) `Dockerfile`, add the following. Make sure you do this before you `COPY` your code. The idea is to implicitly use the default `USER root` since it needs permissions to create an `/opt/extensions` directory.
|
28
28
|
|
29
|
-
```
|
30
|
-
|
31
|
-
|
32
|
-
def handler(event:, context:)
|
33
|
-
# ...
|
34
|
-
ensure
|
35
|
-
LambdaPunch.handled!(context)
|
36
|
-
end
|
29
|
+
```dockerfile
|
30
|
+
RUN gem install lambda_punch && lambda_punch install
|
37
31
|
```
|
38
32
|
|
39
|
-
|
33
|
+
Installation with AWS Lambda via the [Lamby](https://lamby.custominktech.com/) v4 (or higher) gem can be done using Lamby's `handled_proc` config. For example, appends these to your `config/environments/production.rb` file. Here we are ensuring that the LambdaPunch DRb server is running and that after each Lamby request we notify LambdaPunch.
|
40
34
|
|
41
|
-
```
|
42
|
-
|
35
|
+
```ruby
|
36
|
+
config.to_prepare { LambdaPunch.start_server! }
|
37
|
+
config.lamby.handled_proc = Proc.new do |_event, context|
|
38
|
+
LambdaPunch.handled!(context)
|
39
|
+
end
|
43
40
|
```
|
44
41
|
|
45
|
-
If you are using
|
42
|
+
If you are using an older version of Lamby or a simple Ruby project with your own handler method, the installation would look something like this:
|
46
43
|
|
47
44
|
```ruby
|
48
|
-
|
49
|
-
|
45
|
+
LambdaPunch.start_server!
|
46
|
+
def handler(event:, context:)
|
47
|
+
# ...
|
48
|
+
ensure
|
49
|
+
LambdaPunch.handled!(context)
|
50
|
+
end
|
50
51
|
```
|
51
52
|
|
52
53
|
## 🧰 Usage
|
@@ -59,12 +60,11 @@ LambdaPunch.push do
|
|
59
60
|
end
|
60
61
|
```
|
61
62
|
|
62
|
-
|
63
|
+
A common use case would be to ensure the [New Relic APM](https://dev.to/aws-heroes/using-new-relic-apm-with-rails-on-aws-lambda-51gi) flushes its data after each request. Using Lamby in your `config/environments/production.rb` file would look like this:
|
63
64
|
|
64
65
|
```ruby
|
65
|
-
|
66
|
-
|
67
|
-
ensure
|
66
|
+
config.to_prepare { LambdaPunch.start_server! }
|
67
|
+
config.lamby.handled_proc = Proc.new do |_event, context|
|
68
68
|
LambdaPunch.push { NewRelic::Agent.agent.flush_pipe_data }
|
69
69
|
LambdaPunch.handled!(context)
|
70
70
|
end
|
data/bin/setup
CHANGED
data/bin/test
CHANGED
data/exe/lambda_punch
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake'
|
5
|
+
|
6
|
+
spec = Gem::Specification.find_by_name 'lambda_punch'
|
7
|
+
load "#{spec.gem_dir}/lib/lambda_punch/tasks/install.rake"
|
8
|
+
|
9
|
+
command = ARGV[0] || 'install'
|
10
|
+
|
11
|
+
Rake::Task["lambda_punch:#{command}"].invoke
|
data/lib/lambda_punch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lambda_punch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -111,28 +111,27 @@ dependencies:
|
|
111
111
|
description: 'LambdaPunch: Async Processing using Lambda Extensions'
|
112
112
|
email:
|
113
113
|
- ken@metaskills.net
|
114
|
-
executables:
|
114
|
+
executables:
|
115
|
+
- lambda_punch
|
115
116
|
extensions: []
|
116
117
|
extra_rdoc_files: []
|
117
118
|
files:
|
119
|
+
- ".devcontainer/Dockerfile"
|
120
|
+
- ".devcontainer/devcontainer.json"
|
121
|
+
- ".devcontainer/postCreate.sh"
|
118
122
|
- ".github/workflows/test.yml"
|
119
123
|
- ".gitignore"
|
120
124
|
- CHANGELOG.md
|
121
125
|
- CODE_OF_CONDUCT.md
|
122
|
-
- Dockerfile
|
123
126
|
- Gemfile
|
124
127
|
- Gemfile.lock
|
125
128
|
- LICENSE.txt
|
126
129
|
- README.md
|
127
130
|
- Rakefile
|
128
|
-
- bin/_setup
|
129
|
-
- bin/_test
|
130
|
-
- bin/bootstrap
|
131
131
|
- bin/console
|
132
|
-
- bin/run
|
133
132
|
- bin/setup
|
134
133
|
- bin/test
|
135
|
-
-
|
134
|
+
- exe/lambda_punch
|
136
135
|
- lambda_punch.gemspec
|
137
136
|
- lib/lambda_punch.rb
|
138
137
|
- lib/lambda_punch/api.rb
|
@@ -154,7 +153,7 @@ metadata:
|
|
154
153
|
homepage_uri: https://github.com/customink/lambda_punch
|
155
154
|
source_code_uri: https://github.com/customink/lambda_punch
|
156
155
|
changelog_uri: https://github.com/customink/lambda_punch/blob/main/CHANGELOG.md
|
157
|
-
post_install_message:
|
156
|
+
post_install_message:
|
158
157
|
rdoc_options: []
|
159
158
|
require_paths:
|
160
159
|
- lib
|
@@ -169,8 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
168
|
- !ruby/object:Gem::Version
|
170
169
|
version: '0'
|
171
170
|
requirements: []
|
172
|
-
rubygems_version: 3.
|
173
|
-
signing_key:
|
171
|
+
rubygems_version: 3.4.7
|
172
|
+
signing_key:
|
174
173
|
specification_version: 4
|
175
174
|
summary: 'LambdaPunch: Async Processing using Lambda Extensions'
|
176
175
|
test_files: []
|
data/Dockerfile
DELETED
data/bin/_setup
DELETED
data/bin/_test
DELETED
data/bin/bootstrap
DELETED
data/bin/run
DELETED