You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-19Lines changed: 20 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -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
-
Now, within your application's handler file, make sure to start the LambdaPunch DRb server outside of your handler method. Within the handler method, add an `ensure` section that lets the extension process know the request is done.
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
-
```ruby
30
-
LambdaPunch.start_server!
31
-
32
-
defhandler(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
-
Within your project or [Rails application's](https://lamby.custominktech.com/docs/anatomy)`Dockerfile`, after you copy your code, add this `RUN` command to install the extension within your container's `/opt/extensions` directory.
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.
For example, if you are using Rails with AWS Lambda via the [Lamby](https://lamby.custominktech.com/) v4 (or higher) gem along with [New Relic APM](https://dev.to/aws-heroes/using-new-relic-apm-with-rails-on-aws-lambda-51gi)here is how you configure the handled proc called after `Lamby.cmd` in an `ensure` block. This will force metrics to be flushed after each request.
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:
0 commit comments