lamby 1.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/cicd.yml +17 -0
- data/.gitignore +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +51 -0
- data/Dockerfile +12 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +94 -79
- data/README.md +10 -4
- data/Rakefile +1 -0
- data/bin/_setup +6 -0
- data/bin/_test +6 -0
- data/bin/bootstrap +3 -17
- data/bin/setup +3 -3
- data/bin/test +6 -3
- data/bin/update +2 -2
- data/docker-compose.yml +14 -0
- data/lamby.gemspec +1 -2
- data/lib/lamby.rb +7 -3
- data/lib/lamby/handler.rb +16 -3
- data/lib/lamby/logger.rb +13 -9
- data/lib/lamby/rack.rb +11 -9
- data/lib/lamby/rack_alb.rb +11 -14
- data/lib/lamby/rack_http.rb +80 -0
- data/lib/lamby/{rack_api.rb → rack_rest.rb} +7 -3
- data/lib/lamby/ssm_parameter_store.rb +3 -3
- data/lib/lamby/templates.rake +4 -3
- data/lib/lamby/templates/{application_load_balancer.rb → alb.rb} +1 -1
- data/lib/lamby/templates/{application_load_balancer → alb}/app.rb +0 -0
- data/lib/lamby/templates/{application_load_balancer → alb}/build +3 -3
- data/lib/lamby/templates/{application_load_balancer → alb}/deploy +1 -1
- data/lib/lamby/templates/{application_load_balancer → alb}/template.yaml +1 -1
- data/lib/lamby/templates/{api_gateway.rb → http.rb} +2 -2
- data/lib/lamby/templates/{api_gateway → http}/app.rb +1 -1
- data/lib/lamby/templates/{api_gateway → http}/build +3 -3
- data/lib/lamby/templates/{api_gateway → http}/deploy +1 -1
- data/lib/lamby/templates/http/template.yaml +48 -0
- data/lib/lamby/templates/rest.rb +25 -0
- data/lib/lamby/templates/rest/app.rb +10 -0
- data/lib/lamby/templates/rest/build +23 -0
- data/lib/lamby/templates/rest/deploy +22 -0
- data/lib/lamby/templates/{api_gateway → rest}/template.yaml +2 -2
- data/lib/lamby/templates/shared.rb +3 -1
- data/lib/lamby/version.rb +1 -1
- data/vendor/.keep +0 -0
- metadata +29 -37
- data/.python-version +0 -1
- data/.travis.yml +0 -17
- data/Brewfile +0 -5
- data/Pipfile +0 -13
- data/Pipfile.lock +0 -370
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bb411b8d5961ebef380fdd6148d5349481a9f8d5ec4f935e6d3db25647b8c81
|
4
|
+
data.tar.gz: 889122ece8d9d93a695f8d941f37e56e898dc20c4c3e529e07fe89b87b7f043d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd62c1917031b62e0364e381dd003a24e7836e852656f02f2d4c8b77f4804b3c283a7303b4eb16ed5f5165eef8c6fa0e717e46bc15e559885e29cb7a7bab383c
|
7
|
+
data.tar.gz: 531a661486ef2473f83730f5bf22601429fffc52e39164bc38b473984a321ad3ce294fd21d81bef2e254746d4481af6190031470e64e1d50d55c0d995de53769
|
@@ -0,0 +1,17 @@
|
|
1
|
+
name: CI/CD
|
2
|
+
on: [push]
|
3
|
+
jobs:
|
4
|
+
cicd:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
steps:
|
7
|
+
- name: Checkout
|
8
|
+
uses: actions/checkout@v1
|
9
|
+
- name: Bootstrap
|
10
|
+
run: |
|
11
|
+
./bin/bootstrap
|
12
|
+
- name: Setup
|
13
|
+
run: |
|
14
|
+
./bin/setup
|
15
|
+
- name: Test
|
16
|
+
run: |
|
17
|
+
./bin/test
|
data/.gitignore
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
/pkg/
|
6
6
|
/spec/reports/
|
7
7
|
/tmp/
|
8
|
+
/vendor/bundle
|
8
9
|
test/dummy_app/.gitignore
|
9
10
|
test/dummy_app/app.rb
|
10
11
|
test/dummy_app/template.yaml
|
@@ -12,4 +13,3 @@ test/dummy_app/bin/build
|
|
12
13
|
test/dummy_app/bin/deploy
|
13
14
|
test/dummy_app/tmp
|
14
15
|
test/dummy_app/log/**/*
|
15
|
-
test/dummy_app/public/**/*
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.0
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,58 @@
|
|
1
|
+
<!-- -*- mode: markdown -*- -->
|
1
2
|
# Keep A Changelog!
|
2
3
|
|
3
4
|
See this http://keepachangelog.com link for information on how we want this documented formatted.
|
4
5
|
|
6
|
+
## v2.1.0
|
7
|
+
|
8
|
+
#### Changed
|
9
|
+
|
10
|
+
* Only load the railtie if `Rails` is defined.
|
11
|
+
|
12
|
+
## v2.0.1
|
13
|
+
|
14
|
+
#### Changed
|
15
|
+
|
16
|
+
* Remove Rails runtime dep. Only rack is needed.
|
17
|
+
|
18
|
+
## v2.0.0
|
19
|
+
|
20
|
+
Support for new API Gateway HTTP APIs!!!
|
21
|
+
|
22
|
+
#### Changed
|
23
|
+
|
24
|
+
* The `Lamby.handler` must have a `:rack` option. One of `:http`, `:rest`, `:alb`.
|
25
|
+
* Renamed template generators to match options above.
|
26
|
+
* The `lamby:install` task now defaults to HTTP API.
|
27
|
+
* Changed the name of `:api` rack option to `:rest`.
|
28
|
+
* Removed `export` from Dotenv files. Better Docker compatability.
|
29
|
+
|
30
|
+
#### Added
|
31
|
+
|
32
|
+
* New reack handler for HTTP API v1 and v2.
|
33
|
+
* Lots of backfill tests for, ALBs & REST APIs.
|
34
|
+
|
35
|
+
|
36
|
+
## v1.0.3
|
37
|
+
|
38
|
+
#### Changed
|
39
|
+
|
40
|
+
* Change shebangs to `#!/usr/bin/env bash`
|
41
|
+
|
42
|
+
|
43
|
+
## v1.0.2
|
44
|
+
|
45
|
+
#### Changed
|
46
|
+
|
47
|
+
* Adds an optional 'overwrite' parameter to #to_env.
|
48
|
+
|
49
|
+
## v1.0.1
|
50
|
+
|
51
|
+
#### Changed
|
52
|
+
|
53
|
+
* Links in bin/build templates to point to lamby.custominktech.com site.
|
54
|
+
|
55
|
+
|
5
56
|
## v1.0.0
|
6
57
|
|
7
58
|
#### Fixed
|
data/Dockerfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
FROM lambci/lambda:build-ruby2.7
|
2
|
+
|
3
|
+
# Lock down AWS SAM version.
|
4
|
+
RUN pip install awscli && \
|
5
|
+
pip uninstall --yes aws-sam-cli && \
|
6
|
+
pip install aws-sam-cli==0.45.0
|
7
|
+
|
8
|
+
# Asset Pipeline
|
9
|
+
RUN curl -sL https://rpm.nodesource.com/setup_12.x | bash - && \
|
10
|
+
yum install -y nodejs
|
11
|
+
|
12
|
+
WORKDIR /var/task
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,141 +1,155 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lamby (1.0
|
4
|
+
lamby (2.1.0)
|
5
5
|
rack
|
6
|
-
rails
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
10
9
|
specs:
|
11
|
-
actioncable (
|
12
|
-
actionpack (=
|
10
|
+
actioncable (6.0.2.2)
|
11
|
+
actionpack (= 6.0.2.2)
|
13
12
|
nio4r (~> 2.0)
|
14
13
|
websocket-driver (>= 0.6.1)
|
15
|
-
|
16
|
-
actionpack (=
|
17
|
-
|
18
|
-
|
14
|
+
actionmailbox (6.0.2.2)
|
15
|
+
actionpack (= 6.0.2.2)
|
16
|
+
activejob (= 6.0.2.2)
|
17
|
+
activerecord (= 6.0.2.2)
|
18
|
+
activestorage (= 6.0.2.2)
|
19
|
+
activesupport (= 6.0.2.2)
|
20
|
+
mail (>= 2.7.1)
|
21
|
+
actionmailer (6.0.2.2)
|
22
|
+
actionpack (= 6.0.2.2)
|
23
|
+
actionview (= 6.0.2.2)
|
24
|
+
activejob (= 6.0.2.2)
|
19
25
|
mail (~> 2.5, >= 2.5.4)
|
20
26
|
rails-dom-testing (~> 2.0)
|
21
|
-
actionpack (
|
22
|
-
actionview (=
|
23
|
-
activesupport (=
|
24
|
-
rack (~> 2.0)
|
27
|
+
actionpack (6.0.2.2)
|
28
|
+
actionview (= 6.0.2.2)
|
29
|
+
activesupport (= 6.0.2.2)
|
30
|
+
rack (~> 2.0, >= 2.0.8)
|
25
31
|
rack-test (>= 0.6.3)
|
26
32
|
rails-dom-testing (~> 2.0)
|
27
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
28
|
-
|
29
|
-
|
33
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
34
|
+
actiontext (6.0.2.2)
|
35
|
+
actionpack (= 6.0.2.2)
|
36
|
+
activerecord (= 6.0.2.2)
|
37
|
+
activestorage (= 6.0.2.2)
|
38
|
+
activesupport (= 6.0.2.2)
|
39
|
+
nokogiri (>= 1.8.5)
|
40
|
+
actionview (6.0.2.2)
|
41
|
+
activesupport (= 6.0.2.2)
|
30
42
|
builder (~> 3.1)
|
31
43
|
erubi (~> 1.4)
|
32
44
|
rails-dom-testing (~> 2.0)
|
33
|
-
rails-html-sanitizer (~> 1.
|
34
|
-
activejob (
|
35
|
-
activesupport (=
|
45
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
46
|
+
activejob (6.0.2.2)
|
47
|
+
activesupport (= 6.0.2.2)
|
36
48
|
globalid (>= 0.3.6)
|
37
|
-
activemodel (
|
38
|
-
activesupport (=
|
39
|
-
activerecord (
|
40
|
-
activemodel (=
|
41
|
-
activesupport (=
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
activerecord (=
|
49
|
+
activemodel (6.0.2.2)
|
50
|
+
activesupport (= 6.0.2.2)
|
51
|
+
activerecord (6.0.2.2)
|
52
|
+
activemodel (= 6.0.2.2)
|
53
|
+
activesupport (= 6.0.2.2)
|
54
|
+
activestorage (6.0.2.2)
|
55
|
+
actionpack (= 6.0.2.2)
|
56
|
+
activejob (= 6.0.2.2)
|
57
|
+
activerecord (= 6.0.2.2)
|
46
58
|
marcel (~> 0.3.1)
|
47
|
-
activesupport (
|
59
|
+
activesupport (6.0.2.2)
|
48
60
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
49
61
|
i18n (>= 0.7, < 2)
|
50
62
|
minitest (~> 5.1)
|
51
63
|
tzinfo (~> 1.1)
|
52
|
-
|
53
|
-
aws-eventstream (1.0.
|
54
|
-
aws-partitions (1.
|
55
|
-
aws-sdk-core (3.
|
64
|
+
zeitwerk (~> 2.2)
|
65
|
+
aws-eventstream (1.0.3)
|
66
|
+
aws-partitions (1.287.0)
|
67
|
+
aws-sdk-core (3.92.0)
|
56
68
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
57
|
-
aws-partitions (~> 1.0)
|
69
|
+
aws-partitions (~> 1, >= 1.239.0)
|
58
70
|
aws-sigv4 (~> 1.1)
|
59
71
|
jmespath (~> 1.0)
|
60
|
-
aws-sdk-ssm (1.
|
61
|
-
aws-sdk-core (~> 3, >= 3.
|
72
|
+
aws-sdk-ssm (1.73.0)
|
73
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
62
74
|
aws-sigv4 (~> 1.1)
|
63
|
-
aws-sigv4 (1.1.
|
75
|
+
aws-sigv4 (1.1.1)
|
64
76
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
65
|
-
builder (3.2.
|
77
|
+
builder (3.2.4)
|
66
78
|
coderay (1.1.2)
|
67
|
-
concurrent-ruby (1.1.
|
68
|
-
crass (1.0.
|
69
|
-
erubi (1.
|
79
|
+
concurrent-ruby (1.1.6)
|
80
|
+
crass (1.0.6)
|
81
|
+
erubi (1.9.0)
|
70
82
|
globalid (0.4.2)
|
71
83
|
activesupport (>= 4.2.0)
|
72
|
-
i18n (1.
|
84
|
+
i18n (1.8.2)
|
73
85
|
concurrent-ruby (~> 1.0)
|
74
86
|
jmespath (1.4.0)
|
75
|
-
loofah (2.
|
87
|
+
loofah (2.4.0)
|
76
88
|
crass (~> 1.0.2)
|
77
89
|
nokogiri (>= 1.5.9)
|
78
90
|
mail (2.7.1)
|
79
91
|
mini_mime (>= 0.1.1)
|
80
92
|
marcel (0.3.3)
|
81
93
|
mimemagic (~> 0.3.2)
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
mini_mime (1.0.1)
|
94
|
+
method_source (1.0.0)
|
95
|
+
mimemagic (0.3.4)
|
96
|
+
mini_mime (1.0.2)
|
86
97
|
mini_portile2 (2.4.0)
|
87
|
-
minitest (5.
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
98
|
+
minitest (5.14.0)
|
99
|
+
minitest-focus (1.1.2)
|
100
|
+
minitest (>= 4, < 6)
|
101
|
+
mocha (1.11.2)
|
102
|
+
nio4r (2.5.2)
|
103
|
+
nokogiri (1.10.9)
|
92
104
|
mini_portile2 (~> 2.4.0)
|
93
|
-
pry (0.
|
94
|
-
coderay (~> 1.1
|
95
|
-
method_source (~>
|
96
|
-
rack (2.
|
105
|
+
pry (0.13.0)
|
106
|
+
coderay (~> 1.1)
|
107
|
+
method_source (~> 1.0)
|
108
|
+
rack (2.2.2)
|
97
109
|
rack-test (1.1.0)
|
98
110
|
rack (>= 1.0, < 3)
|
99
|
-
rails (
|
100
|
-
actioncable (=
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
111
|
+
rails (6.0.2.2)
|
112
|
+
actioncable (= 6.0.2.2)
|
113
|
+
actionmailbox (= 6.0.2.2)
|
114
|
+
actionmailer (= 6.0.2.2)
|
115
|
+
actionpack (= 6.0.2.2)
|
116
|
+
actiontext (= 6.0.2.2)
|
117
|
+
actionview (= 6.0.2.2)
|
118
|
+
activejob (= 6.0.2.2)
|
119
|
+
activemodel (= 6.0.2.2)
|
120
|
+
activerecord (= 6.0.2.2)
|
121
|
+
activestorage (= 6.0.2.2)
|
122
|
+
activesupport (= 6.0.2.2)
|
109
123
|
bundler (>= 1.3.0)
|
110
|
-
railties (=
|
124
|
+
railties (= 6.0.2.2)
|
111
125
|
sprockets-rails (>= 2.0.0)
|
112
126
|
rails-dom-testing (2.0.3)
|
113
127
|
activesupport (>= 4.2.0)
|
114
128
|
nokogiri (>= 1.6)
|
115
|
-
rails-html-sanitizer (1.0
|
116
|
-
loofah (~> 2.
|
117
|
-
railties (
|
118
|
-
actionpack (=
|
119
|
-
activesupport (=
|
129
|
+
rails-html-sanitizer (1.3.0)
|
130
|
+
loofah (~> 2.3)
|
131
|
+
railties (6.0.2.2)
|
132
|
+
actionpack (= 6.0.2.2)
|
133
|
+
activesupport (= 6.0.2.2)
|
120
134
|
method_source
|
121
135
|
rake (>= 0.8.7)
|
122
|
-
thor (>= 0.
|
123
|
-
rake (
|
124
|
-
sprockets (
|
136
|
+
thor (>= 0.20.3, < 2.0)
|
137
|
+
rake (13.0.1)
|
138
|
+
sprockets (4.0.0)
|
125
139
|
concurrent-ruby (~> 1.0)
|
126
140
|
rack (> 1, < 3)
|
127
141
|
sprockets-rails (3.2.1)
|
128
142
|
actionpack (>= 4.0)
|
129
143
|
activesupport (>= 4.0)
|
130
144
|
sprockets (>= 3.0.0)
|
131
|
-
|
132
|
-
thor (0.20.3)
|
145
|
+
thor (1.0.1)
|
133
146
|
thread_safe (0.3.6)
|
134
|
-
tzinfo (1.2.
|
147
|
+
tzinfo (1.2.6)
|
135
148
|
thread_safe (~> 0.1)
|
136
149
|
websocket-driver (0.7.1)
|
137
150
|
websocket-extensions (>= 0.1.0)
|
138
151
|
websocket-extensions (0.1.4)
|
152
|
+
zeitwerk (2.3.0)
|
139
153
|
|
140
154
|
PLATFORMS
|
141
155
|
ruby
|
@@ -145,10 +159,11 @@ DEPENDENCIES
|
|
145
159
|
bundler
|
146
160
|
lamby!
|
147
161
|
minitest
|
162
|
+
minitest-focus
|
148
163
|
mocha
|
149
164
|
pry
|
165
|
+
rails
|
150
166
|
rake
|
151
|
-
sqlite3
|
152
167
|
|
153
168
|
BUNDLED WITH
|
154
|
-
1.
|
169
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
# Lamby [![
|
2
|
+
# Lamby [![Actions Status](https://github.com/customink/lamby/workflows/CI/CD/badge.svg)](https://github.com/customink/lamby/actions)
|
3
3
|
|
4
4
|
<h2>Simple Rails & AWS Lambda Integration</h2>
|
5
5
|
|
@@ -7,11 +7,11 @@
|
|
7
7
|
|
8
8
|
<p> </p>
|
9
9
|
|
10
|
-
The goal of this project is to provide minimal code to allow your Rails application to respond to incoming [AWS Lambda Function Handler in Ruby](https://docs.aws.amazon.com/lambda/latest/dg/ruby-handler.html) `event` and `context` objects in the Lambda handler. We support integration
|
10
|
+
The goal of this project is to provide minimal code to allow your Rails application to respond to incoming [AWS Lambda Function Handler in Ruby](https://docs.aws.amazon.com/lambda/latest/dg/ruby-handler.html) `event` and `context` objects in the Lambda handler. We support Application Load Balancer integration or API Gateway.
|
11
11
|
|
12
12
|
```ruby
|
13
13
|
def handler(event:, context:)
|
14
|
-
Lamby.handler $app, event, context
|
14
|
+
Lamby.handler $app, event, context, rack: :http
|
15
15
|
end
|
16
16
|
```
|
17
17
|
|
@@ -27,7 +27,13 @@ https://lamby.custominktech.com/docs/installing_aws_sam
|
|
27
27
|
|
28
28
|
## Contributing
|
29
29
|
|
30
|
-
After checking out the repo, run
|
30
|
+
After checking out the repo, run:
|
31
|
+
|
32
|
+
```shell
|
33
|
+
$ ./bin/bootstrap
|
34
|
+
$ ./bin/setup
|
35
|
+
$ ./bin/test
|
36
|
+
```
|
31
37
|
|
32
38
|
Bug reports and pull requests are welcome on GitHub at https://github.com/customink/lamby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
33
39
|
|
data/Rakefile
CHANGED
data/bin/_setup
ADDED
data/bin/_test
ADDED
data/bin/bootstrap
CHANGED
@@ -1,20 +1,6 @@
|
|
1
1
|
#!/bin/bash
|
2
|
-
|
3
2
|
set -e
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
brew bundle --verbose
|
9
|
-
}
|
10
|
-
fi
|
11
|
-
|
12
|
-
rbenv install \
|
13
|
-
--skip-existing \
|
14
|
-
$(cat .ruby-version)
|
15
|
-
|
16
|
-
CFLAGS="-I$(brew --prefix zlib)/include" \
|
17
|
-
LDFLAGS="-L$(brew --prefix zlib)/lib" \
|
18
|
-
pyenv install \
|
19
|
-
--skip-existing \
|
20
|
-
$(cat .python-version)
|
4
|
+
echo '== Building containers =='
|
5
|
+
docker pull lambci/lambda:build-ruby2.7
|
6
|
+
docker-compose build
|