lamby 2.7.0 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +10 -1
- data/README.md +1 -5
- data/bin/_test +2 -1
- data/lib/lamby.rb +1 -0
- data/lib/lamby/config.rb +4 -0
- data/lib/lamby/handler.rb +24 -8
- data/lib/lamby/rack.rb +16 -0
- data/lib/lamby/rack_alb.rb +9 -0
- data/lib/lamby/rack_http.rb +10 -0
- data/lib/lamby/rack_rest.rb +8 -0
- data/lib/lamby/runner.rb +60 -0
- data/lib/lamby/templates/alb.rb +2 -2
- data/lib/lamby/templates/alb/Dockerfile +12 -0
- data/lib/lamby/templates/alb/Dockerfile-build +11 -8
- data/lib/lamby/templates/alb/_build +9 -24
- data/lib/lamby/templates/alb/_deploy +10 -41
- data/lib/lamby/templates/alb/app.rb +1 -1
- data/lib/lamby/templates/alb/deploy +3 -8
- data/lib/lamby/templates/alb/docker-compose.yml +9 -7
- data/lib/lamby/templates/alb/template.yaml +1 -1
- data/lib/lamby/templates/http.rb +2 -2
- data/lib/lamby/templates/http/Dockerfile +12 -0
- data/lib/lamby/templates/http/Dockerfile-build +11 -8
- data/lib/lamby/templates/http/_build +9 -24
- data/lib/lamby/templates/http/_deploy +9 -23
- data/lib/lamby/templates/http/app.rb +1 -1
- data/lib/lamby/templates/http/deploy +3 -8
- data/lib/lamby/templates/http/docker-compose.yml +9 -7
- data/lib/lamby/templates/http/template.yaml +1 -1
- data/lib/lamby/templates/rest.rb +2 -2
- data/lib/lamby/templates/rest/Dockerfile +12 -0
- data/lib/lamby/templates/rest/Dockerfile-build +11 -8
- data/lib/lamby/templates/rest/_build +9 -24
- data/lib/lamby/templates/rest/_deploy +9 -23
- data/lib/lamby/templates/rest/app.rb +1 -1
- data/lib/lamby/templates/rest/deploy +3 -8
- data/lib/lamby/templates/rest/docker-compose.yml +9 -7
- data/lib/lamby/templates/rest/template.yaml +1 -1
- data/lib/lamby/version.rb +1 -1
- metadata +3 -3
- data/lib/lamby/bootsnap.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6ae3826f4ce744519216bb6ab16623d5bdc883f001659ca5ad41587741bafce
|
4
|
+
data.tar.gz: 1121aba0a89a081171e4b22f6298982d289481b4a80c97e3d1593b24b08bb4aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51ed673525f7bb529bf9964c0d799db699c90605bf8e0156289069ad8e460dca8f82a0048544866f43e7add5a5f604281d4ba6e61be38cf27c24dd187bd2a523
|
7
|
+
data.tar.gz: 11e89941e727d448b0b9b5052a145cf813a3aded320c3dde45e8fd82b22eee52dbe74afa962e77a206befa22412a50d226492fa71d502bd92ab3724e51596b12
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,41 @@
|
|
4
4
|
|
5
5
|
See this http://keepachangelog.com link for information on how we want this documented formatted.
|
6
6
|
|
7
|
+
## v3.0.2
|
8
|
+
|
9
|
+
#### Added
|
10
|
+
|
11
|
+
- Runner now returns STDOUT/STDERR as body.
|
12
|
+
|
13
|
+
## v3.0.1
|
14
|
+
|
15
|
+
#### Fixed
|
16
|
+
|
17
|
+
- Fix Lambdakiq integration. Thanks #97.
|
18
|
+
|
19
|
+
## v3.0.0
|
20
|
+
|
21
|
+
#### Added
|
22
|
+
|
23
|
+
- Automatically handle `Lambdakiq.jobs?(event)`.
|
24
|
+
- New event for tasks like DB migrations. #80 #93
|
25
|
+
|
26
|
+
#### Changed
|
27
|
+
|
28
|
+
- Updated template files to latest lambda container standards.
|
29
|
+
|
30
|
+
## v2.8.0
|
31
|
+
|
32
|
+
#### Fixed
|
33
|
+
|
34
|
+
- Perform rack body closing hooks on request #85
|
35
|
+
|
36
|
+
## v2.7.1
|
37
|
+
|
38
|
+
#### Removed
|
39
|
+
|
40
|
+
- Bootsnap setup convenience require.
|
41
|
+
|
7
42
|
## v2.7.0
|
8
43
|
|
9
44
|
#### Added
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lamby (
|
4
|
+
lamby (3.0.2)
|
5
5
|
rack
|
6
6
|
|
7
7
|
GEM
|
@@ -73,6 +73,9 @@ GEM
|
|
73
73
|
aws-partitions (~> 1, >= 1.239.0)
|
74
74
|
aws-sigv4 (~> 1.1)
|
75
75
|
jmespath (~> 1.0)
|
76
|
+
aws-sdk-sqs (1.38.0)
|
77
|
+
aws-sdk-core (~> 3, >= 3.112.0)
|
78
|
+
aws-sigv4 (~> 1.1)
|
76
79
|
aws-sdk-ssm (1.108.0)
|
77
80
|
aws-sdk-core (~> 3, >= 3.112.0)
|
78
81
|
aws-sigv4 (~> 1.1)
|
@@ -88,6 +91,11 @@ GEM
|
|
88
91
|
i18n (1.8.10)
|
89
92
|
concurrent-ruby (~> 1.0)
|
90
93
|
jmespath (1.4.0)
|
94
|
+
lambdakiq (1.0.1)
|
95
|
+
activejob
|
96
|
+
aws-sdk-sqs
|
97
|
+
concurrent-ruby
|
98
|
+
railties
|
91
99
|
loofah (2.9.1)
|
92
100
|
crass (~> 1.0.2)
|
93
101
|
nokogiri (>= 1.5.9)
|
@@ -160,6 +168,7 @@ PLATFORMS
|
|
160
168
|
DEPENDENCIES
|
161
169
|
aws-sdk-ssm
|
162
170
|
bundler
|
171
|
+
lambdakiq
|
163
172
|
lamby!
|
164
173
|
minitest
|
165
174
|
minitest-focus
|
data/README.md
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# Lamby [![Actions Status](https://github.com/customink/lamby/workflows/CI/CD/badge.svg)](https://github.com/customink/lamby/actions)
|
3
2
|
|
4
3
|
<h2>Simple Rails & AWS Lambda Integration</h2>
|
@@ -11,7 +10,7 @@ The goal of this project is to provide minimal code to allow your Rails applicat
|
|
11
10
|
|
12
11
|
```ruby
|
13
12
|
def handler(event:, context:)
|
14
|
-
Lamby.handler $app, event, context
|
13
|
+
Lamby.handler $app, event, context
|
15
14
|
end
|
16
15
|
```
|
17
16
|
|
@@ -19,12 +18,10 @@ end
|
|
19
18
|
|
20
19
|
https://lamby.custominktech.com/docs/quick_start
|
21
20
|
|
22
|
-
|
23
21
|
## Full Documentation
|
24
22
|
|
25
23
|
https://lamby.custominktech.com/docs/installing_aws_sam
|
26
24
|
|
27
|
-
|
28
25
|
## Contributing
|
29
26
|
|
30
27
|
After checking out the repo, run:
|
@@ -37,7 +34,6 @@ $ ./bin/test
|
|
37
34
|
|
38
35
|
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.
|
39
36
|
|
40
|
-
|
41
37
|
## Code of Conduct
|
42
38
|
|
43
39
|
Everyone interacting in the Lamby project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/customink/lamby/blob/master/CODE_OF_CONDUCT.md).
|
data/bin/_test
CHANGED
data/lib/lamby.rb
CHANGED
data/lib/lamby/config.rb
CHANGED
data/lib/lamby/handler.rb
CHANGED
@@ -41,6 +41,7 @@ module Lamby
|
|
41
41
|
def body
|
42
42
|
@rbody ||= ''.tap do |rbody|
|
43
43
|
@body.each { |part| rbody << part if part }
|
44
|
+
@body.close if @body.respond_to? :close
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
@@ -67,16 +68,19 @@ module Lamby
|
|
67
68
|
private
|
68
69
|
|
69
70
|
def rack
|
70
|
-
@rack
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
else
|
76
|
-
Lamby::RackHttp.new @event, @context
|
71
|
+
return @rack if defined?(@rack)
|
72
|
+
@rack = begin
|
73
|
+
type = rack_option
|
74
|
+
klass = Lamby::Rack.lookup type, @event
|
75
|
+
(klass && klass.handle?(@event)) ? klass.new(@event, @context) : false
|
77
76
|
end
|
78
77
|
end
|
79
78
|
|
79
|
+
def rack_option
|
80
|
+
return if ENV['LAMBY_TEST_DYNAMIC_HANDLER']
|
81
|
+
@options[:rack]
|
82
|
+
end
|
83
|
+
|
80
84
|
def rack_response
|
81
85
|
rack? ? rack.response(self) : {}
|
82
86
|
end
|
@@ -86,6 +90,10 @@ module Lamby
|
|
86
90
|
Debug.call @event, @context, rack.env
|
87
91
|
elsif rack?
|
88
92
|
@app.call rack.env
|
93
|
+
elsif runner?
|
94
|
+
Runner.call(@event)
|
95
|
+
elsif lambdakiq?
|
96
|
+
Lambdakiq.handler(@event)
|
89
97
|
elsif event_bridge?
|
90
98
|
Lamby.config.event_bridge_handler.call @event, @context
|
91
99
|
[200, {}, StringIO.new('')]
|
@@ -100,12 +108,20 @@ module Lamby
|
|
100
108
|
end
|
101
109
|
|
102
110
|
def rack?
|
103
|
-
|
111
|
+
rack
|
104
112
|
end
|
105
113
|
|
106
114
|
def event_bridge?
|
107
115
|
Lamby.config.event_bridge_handler &&
|
108
116
|
@event.key?('source') && @event.key?('detail') && @event.key?('detail-type')
|
109
117
|
end
|
118
|
+
|
119
|
+
def lambdakiq?
|
120
|
+
defined?(::Lambdakiq) && ::Lambdakiq.jobs?(@event)
|
121
|
+
end
|
122
|
+
|
123
|
+
def runner?
|
124
|
+
Runner.handle?(@event)
|
125
|
+
end
|
110
126
|
end
|
111
127
|
end
|
data/lib/lamby/rack.rb
CHANGED
@@ -7,6 +7,22 @@ module Lamby
|
|
7
7
|
LAMBDA_CONTEXT = 'lambda.context'.freeze
|
8
8
|
HTTP_X_REQUESTID = 'HTTP_X_REQUEST_ID'.freeze
|
9
9
|
HTTP_COOKIE = 'HTTP_COOKIE'.freeze
|
10
|
+
|
11
|
+
class << self
|
12
|
+
|
13
|
+
def lookup(type, event)
|
14
|
+
types[type] || types.values.detect { |t| t.handle?(event) }
|
15
|
+
end
|
16
|
+
|
17
|
+
# Order is important. REST is hardest to isolated with handle? method.
|
18
|
+
def types
|
19
|
+
{ alb: RackAlb,
|
20
|
+
http: RackHttp,
|
21
|
+
rest: RackRest,
|
22
|
+
api: RackRest }
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
10
26
|
|
11
27
|
attr_reader :event, :context
|
12
28
|
|
data/lib/lamby/rack_alb.rb
CHANGED
data/lib/lamby/rack_http.rb
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
module Lamby
|
2
2
|
class RackHttp < Lamby::Rack
|
3
3
|
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def handle?(event)
|
7
|
+
event.key?('version') &&
|
8
|
+
( event.dig('requestContext', 'http') ||
|
9
|
+
event.dig('requestContext', 'httpMethod') )
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
4
14
|
def response(handler)
|
5
15
|
if handler.base64_encodeable?
|
6
16
|
{ isBase64Encoded: true, body: handler.body64 }
|
data/lib/lamby/rack_rest.rb
CHANGED
data/lib/lamby/runner.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
3
|
+
module Lamby
|
4
|
+
class Runner
|
5
|
+
class Error < StandardError ; end
|
6
|
+
class UnknownCommandPattern < Error ; end
|
7
|
+
|
8
|
+
PATTERNS = [
|
9
|
+
%r{\A\./bin/(rails|rake) db:migrate.*}
|
10
|
+
]
|
11
|
+
|
12
|
+
class << self
|
13
|
+
|
14
|
+
def handle?(event)
|
15
|
+
event.dig 'lamby', 'runner'
|
16
|
+
end
|
17
|
+
|
18
|
+
def call(event)
|
19
|
+
new(event).call
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize(event)
|
25
|
+
@event = event
|
26
|
+
@body = ''
|
27
|
+
end
|
28
|
+
|
29
|
+
def call
|
30
|
+
validate!
|
31
|
+
status = Open3.popen3(command, chdir: chdir) do |_stdin, stdout, stderr, thread|
|
32
|
+
@body << stdout.read
|
33
|
+
@body << stderr.read
|
34
|
+
puts @body
|
35
|
+
thread.value.exitstatus
|
36
|
+
end
|
37
|
+
[status, {}, StringIO.new(@body)]
|
38
|
+
end
|
39
|
+
|
40
|
+
def command
|
41
|
+
@event.dig 'lamby', 'runner'
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def chdir
|
47
|
+
defined?(::Rails) ? ::Rails.root : Dir.pwd
|
48
|
+
end
|
49
|
+
|
50
|
+
def validate!
|
51
|
+
return if pattern?
|
52
|
+
raise UnknownCommandPattern.new(command)
|
53
|
+
end
|
54
|
+
|
55
|
+
def pattern?
|
56
|
+
PATTERNS.any? { |p| p === command }
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
data/lib/lamby/templates/alb.rb
CHANGED
@@ -10,13 +10,13 @@ gsub_file app_file('template.yaml'), /APPNAMEHERE/, appname
|
|
10
10
|
copy_file tpl_file('Dockerfile'), app_file('Dockerfile')
|
11
11
|
copy_file tpl_file('Dockerfile-build'), app_file('Dockerfile-build')
|
12
12
|
copy_file tpl_file('docker-compose.yml'), app_file('docker-compose.yml')
|
13
|
+
gsub_file app_file('docker-compose.yml'), /APPNAMEHERE/, appname.downcase
|
13
14
|
|
14
15
|
say 'Adding to .gitignore...'
|
15
16
|
FileUtils.touch app_file('.gitignore')
|
16
17
|
append_to_file app_file('.gitignore'), <<~GITIGNORE
|
17
18
|
# Lamby
|
18
19
|
/.aws-sam
|
19
|
-
/.lamby
|
20
20
|
GITIGNORE
|
21
21
|
|
22
22
|
say 'Creating ./bin files for build and deploy...'
|
@@ -24,10 +24,10 @@ copy_file tpl_file('_build'), app_file('bin/_build')
|
|
24
24
|
gsub_file app_file('bin/_build'), /APPNAMEHERE/, appname.downcase
|
25
25
|
chmod app_file('bin/_build'), 0755
|
26
26
|
copy_file tpl_file('deploy'), app_file('bin/deploy')
|
27
|
+
gsub_file app_file('bin/deploy'), /APPNAMEHERE/, appname.downcase
|
27
28
|
chmod app_file('bin/deploy'), 0755
|
28
29
|
copy_file tpl_file('_deploy'), app_file('bin/_deploy')
|
29
30
|
gsub_file app_file('bin/_deploy'), /APPNAMEHERE/, appname.downcase
|
30
31
|
chmod app_file('bin/_deploy'), 0755
|
31
|
-
gsub_file app_file('bin/deploy'), /APPNAMEHERE/, appname.downcase
|
32
32
|
|
33
33
|
say 'Welcome to AWS Lambda and Rails 🎉', :green
|
@@ -1,3 +1,15 @@
|
|
1
1
|
FROM public.ecr.aws/lambda/ruby:2.7
|
2
|
+
ARG RAILS_ENV
|
3
|
+
ENV RAILS_ENV=$RAILS_ENV
|
4
|
+
|
2
5
|
COPY . .
|
6
|
+
|
7
|
+
# == Cleanup Unused Files & Directories ==
|
8
|
+
RUN rm -rf \
|
9
|
+
log \
|
10
|
+
node_modules \
|
11
|
+
test \
|
12
|
+
tmp \
|
13
|
+
vendor/bundle/ruby/2.7.0/cache
|
14
|
+
|
3
15
|
CMD ["app.handler"]
|
@@ -1,15 +1,18 @@
|
|
1
1
|
FROM amazon/aws-sam-cli-build-image-ruby2.7
|
2
2
|
|
3
3
|
# Ensure minimum required SAM version.
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
ENV SAM_CLI_VERSION=1.23.0
|
5
|
+
RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v${SAM_CLI_VERSION}/aws-sam-cli-linux-x86_64.zip" \
|
6
|
+
-o "aws-sam-cli-linux-x86_64.zip" && \
|
7
|
+
unzip -q aws-sam-cli-linux-x86_64.zip -d sam-installation && \
|
8
|
+
./sam-installation/install && \
|
9
|
+
rm -rf ./sam-installation ./aws-sam-cli-linux-x86_64.zip
|
7
10
|
|
8
11
|
# Node for JavaScript.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash - && \
|
13
|
+
yum install -y nodejs && \
|
14
|
+
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo && \
|
15
|
+
rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg && \
|
16
|
+
yum install -y yarn
|
14
17
|
|
15
18
|
WORKDIR /var/task
|
@@ -1,20 +1,15 @@
|
|
1
|
-
#!/
|
1
|
+
#!/bin/sh
|
2
2
|
set -e
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
cp -r "$SAM_TEMP" "./.lamby/$RESOURCE"
|
11
|
-
pushd "./.lamby/$RESOURCE"
|
12
|
-
|
13
|
-
echo '== Cleaning Dev Dependencies =='
|
14
|
-
rm -rf ./.bundle \
|
15
|
-
./vendor/bundle
|
4
|
+
if [ "$CI" != "true" ]; then
|
5
|
+
echo "== Cleaning dev dependencies for local deploy. Run ./bin/setup again afterward! =="
|
6
|
+
rm -rf ./.bundle \
|
7
|
+
./vendor/bundle \
|
8
|
+
./node_modules
|
9
|
+
fi
|
16
10
|
|
17
11
|
echo '== Bundle For Deployment =='
|
12
|
+
bundle lock --add-platform x86_64-linux
|
18
13
|
bundle config --local deployment true
|
19
14
|
bundle config --local without 'development test'
|
20
15
|
bundle config --local path './vendor/bundle'
|
@@ -27,14 +22,4 @@ echo "== Environments & Configuration =="
|
|
27
22
|
# LAMBY_SSM_PARAMS_PATH="/APPNAMEHERE/${RAILS_ENV}/env"
|
28
23
|
|
29
24
|
echo "== Asset Hosts & Precompiling =="
|
30
|
-
|
31
|
-
# RAILS_GROUPS=assets \
|
32
|
-
# ./bin/rails assets:precompile
|
33
|
-
|
34
|
-
echo "== Cleanup Unused Files & Directories =="
|
35
|
-
rm -rf \
|
36
|
-
log \
|
37
|
-
node_modules \
|
38
|
-
test \
|
39
|
-
tmp \
|
40
|
-
vendor/bundle/ruby/2.7.0/cache
|
25
|
+
NODE_ENV='production' ./bin/rails assets:precompile
|
@@ -1,62 +1,31 @@
|
|
1
|
-
#!/
|
1
|
+
#!/bin/sh
|
2
2
|
set -e
|
3
3
|
|
4
|
-
export DEPLOYMENT_NAME="myorg/APPNAMEHERE"
|
5
|
-
export RAILS_ENV=${RAILS_ENV:="production"}
|
6
|
-
export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:=us-east-1}
|
7
|
-
export CLOUDFORMATION_BUCKET=${CLOUDFORMATION_BUCKET:="lamby.cloudformation.${DEPLOYMENT_NAME/\//-}"}
|
8
|
-
|
9
4
|
# https://github.com/aws/aws-sam-cli/issues/2447
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
echo '== Creating ECR repository =='
|
14
|
-
echo 'You can safely ignore any RepositoryAlreadyExistsException errors...'
|
15
|
-
aws ecr create-repository \
|
16
|
-
--repository-name "$DEPLOYMENT_NAME" \
|
17
|
-
--image-tag-mutability MUTABLE \
|
18
|
-
--image-scanning-configuration scanOnPush=true \
|
19
|
-
--region "$AWS_DEFAULT_REGION" || true
|
5
|
+
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
|
6
|
+
IMAGE_REPOSITORY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/APPNAMEHERE"
|
20
7
|
|
21
|
-
|
8
|
+
echo "== Lamby build =="
|
22
9
|
./bin/_build
|
23
10
|
|
24
|
-
|
25
|
-
aws ec2 describe-vpcs \
|
26
|
-
--output text \
|
27
|
-
--filters 'Name=state,Values=available' \
|
28
|
-
--query 'Vpcs[0].VpcId'
|
29
|
-
)}
|
30
|
-
|
31
|
-
export SUBNETS=${SUBNETS:=$(
|
32
|
-
aws ec2 describe-subnets \
|
33
|
-
--output text \
|
34
|
-
--filters 'Name=state,Values=available' "Name=vpc-id,Values=$VPCID" \
|
35
|
-
--query 'Subnets[*].SubnetId' | \
|
36
|
-
tr -s '[:blank:]' ','
|
37
|
-
)}
|
38
|
-
|
11
|
+
echo "== SAM build =="
|
39
12
|
sam build \
|
40
13
|
--parameter-overrides \
|
41
|
-
|
14
|
+
RailsEnv="${RAILS_ENV}"
|
42
15
|
|
43
|
-
echo "== SAM package
|
16
|
+
echo "== SAM package =="
|
44
17
|
sam package \
|
45
18
|
--region "$AWS_DEFAULT_REGION" \
|
46
19
|
--template-file ./.aws-sam/build/template.yaml \
|
47
20
|
--output-template-file ./.aws-sam/build/packaged.yaml \
|
48
21
|
--image-repository "$IMAGE_REPOSITORY" \
|
49
|
-
--s3-bucket "${CLOUDFORMATION_BUCKET}" \
|
50
|
-
--s3-prefix "${DEPLOYMENT_NAME/\//-}-${RAILS_ENV}"
|
51
22
|
|
52
|
-
echo "== SAM deploy
|
23
|
+
echo "== SAM deploy =="
|
53
24
|
sam deploy \
|
54
25
|
--region "$AWS_DEFAULT_REGION" \
|
55
26
|
--template-file ./.aws-sam/build/packaged.yaml \
|
56
|
-
--stack-name "
|
27
|
+
--stack-name "APPNAMEHERE-${RAILS_ENV}" \
|
57
28
|
--image-repository "$IMAGE_REPOSITORY" \
|
58
29
|
--capabilities "CAPABILITY_IAM" \
|
59
30
|
--parameter-overrides \
|
60
|
-
RailsEnv="${RAILS_ENV}"
|
61
|
-
VpcId=${VPCID} \
|
62
|
-
Subnets=${SUBNETS}
|
31
|
+
RailsEnv="${RAILS_ENV}"
|
@@ -1,13 +1,8 @@
|
|
1
|
-
#!/
|
1
|
+
#!/bin/sh
|
2
2
|
set -e
|
3
3
|
|
4
4
|
export RAILS_ENV=${RAILS_ENV:=production}
|
5
5
|
|
6
|
-
if [[ "$OSTYPE" == *"darwin"* ]]; then
|
7
|
-
export SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock
|
8
|
-
fi
|
9
|
-
|
10
6
|
docker-compose run \
|
11
|
-
|
12
|
-
|
13
|
-
./bin/_deploy
|
7
|
+
APPNAMEHERE \
|
8
|
+
./bin/_deploy
|
@@ -1,17 +1,19 @@
|
|
1
1
|
version: '3.7'
|
2
2
|
services:
|
3
|
-
|
3
|
+
APPNAMEHERE:
|
4
4
|
build:
|
5
|
-
context: .
|
5
|
+
context: '.'
|
6
6
|
dockerfile: Dockerfile-build
|
7
|
+
entrypoint: ./bin/entrypoint
|
7
8
|
environment:
|
8
9
|
- RAILS_ENV=${RAILS_ENV-development}
|
10
|
+
- SAM_CLI_TELEMETRY=0
|
9
11
|
- AWS_PROFILE=${AWS_PROFILE-default}
|
12
|
+
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
|
13
|
+
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
|
10
14
|
- AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION-us-east-1}
|
11
|
-
-
|
15
|
+
- CI=${CI}
|
12
16
|
volumes:
|
13
|
-
- ${
|
14
|
-
-
|
15
|
-
- ~/.ssh/known_hosts:/root/.ssh/known_hosts
|
16
|
-
- .:/var/task:delegated
|
17
|
+
- ${PWD}:/var/task
|
18
|
+
- ${HOME}/.aws:/root/.aws
|
17
19
|
- /var/run/docker.sock:/var/run/docker.sock
|
data/lib/lamby/templates/http.rb
CHANGED
@@ -10,13 +10,13 @@ gsub_file app_file('template.yaml'), /APPNAMEHERE/, appname
|
|
10
10
|
copy_file tpl_file('Dockerfile'), app_file('Dockerfile')
|
11
11
|
copy_file tpl_file('Dockerfile-build'), app_file('Dockerfile-build')
|
12
12
|
copy_file tpl_file('docker-compose.yml'), app_file('docker-compose.yml')
|
13
|
+
gsub_file app_file('docker-compose.yml'), /APPNAMEHERE/, appname.downcase
|
13
14
|
|
14
15
|
say 'Adding to .gitignore...'
|
15
16
|
FileUtils.touch app_file('.gitignore')
|
16
17
|
append_to_file app_file('.gitignore'), <<~GITIGNORE
|
17
18
|
# Lamby
|
18
19
|
/.aws-sam
|
19
|
-
/.lamby
|
20
20
|
GITIGNORE
|
21
21
|
|
22
22
|
say 'Creating ./bin files for build and deploy...'
|
@@ -24,10 +24,10 @@ copy_file tpl_file('_build'), app_file('bin/_build')
|
|
24
24
|
gsub_file app_file('bin/_build'), /APPNAMEHERE/, appname.downcase
|
25
25
|
chmod app_file('bin/_build'), 0755
|
26
26
|
copy_file tpl_file('deploy'), app_file('bin/deploy')
|
27
|
+
gsub_file app_file('bin/deploy'), /APPNAMEHERE/, appname.downcase
|
27
28
|
chmod app_file('bin/deploy'), 0755
|
28
29
|
copy_file tpl_file('_deploy'), app_file('bin/_deploy')
|
29
30
|
gsub_file app_file('bin/_deploy'), /APPNAMEHERE/, appname.downcase
|
30
31
|
chmod app_file('bin/_deploy'), 0755
|
31
|
-
gsub_file app_file('bin/deploy'), /APPNAMEHERE/, appname.downcase
|
32
32
|
|
33
33
|
say 'Welcome to AWS Lambda and Rails 🎉', :green
|
@@ -1,3 +1,15 @@
|
|
1
1
|
FROM public.ecr.aws/lambda/ruby:2.7
|
2
|
+
ARG RAILS_ENV
|
3
|
+
ENV RAILS_ENV=$RAILS_ENV
|
4
|
+
|
2
5
|
COPY . .
|
6
|
+
|
7
|
+
# == Cleanup Unused Files & Directories ==
|
8
|
+
RUN rm -rf \
|
9
|
+
log \
|
10
|
+
node_modules \
|
11
|
+
test \
|
12
|
+
tmp \
|
13
|
+
vendor/bundle/ruby/2.7.0/cache
|
14
|
+
|
3
15
|
CMD ["app.handler"]
|
@@ -1,15 +1,18 @@
|
|
1
1
|
FROM amazon/aws-sam-cli-build-image-ruby2.7
|
2
2
|
|
3
3
|
# Ensure minimum required SAM version.
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
ENV SAM_CLI_VERSION=1.23.0
|
5
|
+
RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v${SAM_CLI_VERSION}/aws-sam-cli-linux-x86_64.zip" \
|
6
|
+
-o "aws-sam-cli-linux-x86_64.zip" && \
|
7
|
+
unzip -q aws-sam-cli-linux-x86_64.zip -d sam-installation && \
|
8
|
+
./sam-installation/install && \
|
9
|
+
rm -rf ./sam-installation ./aws-sam-cli-linux-x86_64.zip
|
7
10
|
|
8
11
|
# Node for JavaScript.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash - && \
|
13
|
+
yum install -y nodejs && \
|
14
|
+
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo && \
|
15
|
+
rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg && \
|
16
|
+
yum install -y yarn
|
14
17
|
|
15
18
|
WORKDIR /var/task
|
@@ -1,20 +1,15 @@
|
|
1
|
-
#!/
|
1
|
+
#!/bin/sh
|
2
2
|
set -e
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
cp -r "$SAM_TEMP" "./.lamby/$RESOURCE"
|
11
|
-
pushd "./.lamby/$RESOURCE"
|
12
|
-
|
13
|
-
echo '== Cleaning Dev Dependencies =='
|
14
|
-
rm -rf ./.bundle \
|
15
|
-
./vendor/bundle
|
4
|
+
if [ "$CI" != "true" ]; then
|
5
|
+
echo "== Cleaning dev dependencies for local deploy. Run ./bin/setup again afterward! =="
|
6
|
+
rm -rf ./.bundle \
|
7
|
+
./vendor/bundle \
|
8
|
+
./node_modules
|
9
|
+
fi
|
16
10
|
|
17
11
|
echo '== Bundle For Deployment =='
|
12
|
+
bundle lock --add-platform x86_64-linux
|
18
13
|
bundle config --local deployment true
|
19
14
|
bundle config --local without 'development test'
|
20
15
|
bundle config --local path './vendor/bundle'
|
@@ -27,14 +22,4 @@ echo "== Environments & Configuration =="
|
|
27
22
|
# LAMBY_SSM_PARAMS_PATH="/APPNAMEHERE/${RAILS_ENV}/env"
|
28
23
|
|
29
24
|
echo "== Asset Hosts & Precompiling =="
|
30
|
-
|
31
|
-
# RAILS_GROUPS=assets \
|
32
|
-
# ./bin/rails assets:precompile
|
33
|
-
|
34
|
-
echo "== Cleanup Unused Files & Directories =="
|
35
|
-
rm -rf \
|
36
|
-
log \
|
37
|
-
node_modules \
|
38
|
-
test \
|
39
|
-
tmp \
|
40
|
-
vendor/bundle/ruby/2.7.0/cache
|
25
|
+
NODE_ENV='production' ./bin/rails assets:precompile
|
@@ -1,44 +1,30 @@
|
|
1
|
-
#!/
|
1
|
+
#!/bin/sh
|
2
2
|
set -e
|
3
3
|
|
4
|
-
export DEPLOYMENT_NAME="myorg/APPNAMEHERE"
|
5
|
-
export RAILS_ENV=${RAILS_ENV:="production"}
|
6
|
-
export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:=us-east-1}
|
7
|
-
export CLOUDFORMATION_BUCKET=${CLOUDFORMATION_BUCKET:="lamby.cloudformation.${DEPLOYMENT_NAME/\//-}"}
|
8
|
-
|
9
4
|
# https://github.com/aws/aws-sam-cli/issues/2447
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
echo '== Creating ECR repository =='
|
14
|
-
echo 'You can safely ignore any RepositoryAlreadyExistsException errors...'
|
15
|
-
aws ecr create-repository \
|
16
|
-
--repository-name "$DEPLOYMENT_NAME" \
|
17
|
-
--image-tag-mutability MUTABLE \
|
18
|
-
--image-scanning-configuration scanOnPush=true \
|
19
|
-
--region "$AWS_DEFAULT_REGION" || true
|
5
|
+
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
|
6
|
+
IMAGE_REPOSITORY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/APPNAMEHERE"
|
20
7
|
|
21
|
-
|
8
|
+
echo "== Lamby build =="
|
22
9
|
./bin/_build
|
23
10
|
|
11
|
+
echo "== SAM build =="
|
24
12
|
sam build \
|
25
13
|
--parameter-overrides \
|
26
|
-
|
14
|
+
RailsEnv="${RAILS_ENV}"
|
27
15
|
|
28
|
-
echo "== SAM package
|
16
|
+
echo "== SAM package =="
|
29
17
|
sam package \
|
30
18
|
--region "$AWS_DEFAULT_REGION" \
|
31
19
|
--template-file ./.aws-sam/build/template.yaml \
|
32
20
|
--output-template-file ./.aws-sam/build/packaged.yaml \
|
33
21
|
--image-repository "$IMAGE_REPOSITORY" \
|
34
|
-
--s3-bucket "${CLOUDFORMATION_BUCKET}" \
|
35
|
-
--s3-prefix "${DEPLOYMENT_NAME/\//-}-${RAILS_ENV}"
|
36
22
|
|
37
|
-
echo "== SAM deploy
|
23
|
+
echo "== SAM deploy =="
|
38
24
|
sam deploy \
|
39
25
|
--region "$AWS_DEFAULT_REGION" \
|
40
26
|
--template-file ./.aws-sam/build/packaged.yaml \
|
41
|
-
--stack-name "
|
27
|
+
--stack-name "APPNAMEHERE-${RAILS_ENV}" \
|
42
28
|
--image-repository "$IMAGE_REPOSITORY" \
|
43
29
|
--capabilities "CAPABILITY_IAM" \
|
44
30
|
--parameter-overrides \
|
@@ -1,13 +1,8 @@
|
|
1
|
-
#!/
|
1
|
+
#!/bin/sh
|
2
2
|
set -e
|
3
3
|
|
4
4
|
export RAILS_ENV=${RAILS_ENV:=production}
|
5
5
|
|
6
|
-
if [[ "$OSTYPE" == *"darwin"* ]]; then
|
7
|
-
export SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock
|
8
|
-
fi
|
9
|
-
|
10
6
|
docker-compose run \
|
11
|
-
|
12
|
-
|
13
|
-
./bin/_deploy
|
7
|
+
APPNAMEHERE \
|
8
|
+
./bin/_deploy
|
@@ -1,17 +1,19 @@
|
|
1
1
|
version: '3.7'
|
2
2
|
services:
|
3
|
-
|
3
|
+
APPNAMEHERE:
|
4
4
|
build:
|
5
|
-
context: .
|
5
|
+
context: '.'
|
6
6
|
dockerfile: Dockerfile-build
|
7
|
+
entrypoint: ./bin/entrypoint
|
7
8
|
environment:
|
8
9
|
- RAILS_ENV=${RAILS_ENV-development}
|
10
|
+
- SAM_CLI_TELEMETRY=0
|
9
11
|
- AWS_PROFILE=${AWS_PROFILE-default}
|
12
|
+
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
|
13
|
+
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
|
10
14
|
- AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION-us-east-1}
|
11
|
-
-
|
15
|
+
- CI=${CI}
|
12
16
|
volumes:
|
13
|
-
- ${
|
14
|
-
-
|
15
|
-
- ~/.ssh/known_hosts:/root/.ssh/known_hosts
|
16
|
-
- .:/var/task:delegated
|
17
|
+
- ${PWD}:/var/task
|
18
|
+
- ${HOME}/.aws:/root/.aws
|
17
19
|
- /var/run/docker.sock:/var/run/docker.sock
|
data/lib/lamby/templates/rest.rb
CHANGED
@@ -10,13 +10,13 @@ gsub_file app_file('template.yaml'), /APPNAMEHERE/, appname
|
|
10
10
|
copy_file tpl_file('Dockerfile'), app_file('Dockerfile')
|
11
11
|
copy_file tpl_file('Dockerfile-build'), app_file('Dockerfile-build')
|
12
12
|
copy_file tpl_file('docker-compose.yml'), app_file('docker-compose.yml')
|
13
|
+
gsub_file app_file('docker-compose.yml'), /APPNAMEHERE/, appname.downcase
|
13
14
|
|
14
15
|
say 'Adding to .gitignore...'
|
15
16
|
FileUtils.touch app_file('.gitignore')
|
16
17
|
append_to_file app_file('.gitignore'), <<~GITIGNORE
|
17
18
|
# Lamby
|
18
19
|
/.aws-sam
|
19
|
-
/.lamby
|
20
20
|
GITIGNORE
|
21
21
|
|
22
22
|
say 'Creating ./bin files for build and deploy...'
|
@@ -24,10 +24,10 @@ copy_file tpl_file('_build'), app_file('bin/_build')
|
|
24
24
|
gsub_file app_file('bin/_build'), /APPNAMEHERE/, appname.downcase
|
25
25
|
chmod app_file('bin/_build'), 0755
|
26
26
|
copy_file tpl_file('deploy'), app_file('bin/deploy')
|
27
|
+
gsub_file app_file('bin/deploy'), /APPNAMEHERE/, appname.downcase
|
27
28
|
chmod app_file('bin/deploy'), 0755
|
28
29
|
copy_file tpl_file('_deploy'), app_file('bin/_deploy')
|
29
30
|
gsub_file app_file('bin/_deploy'), /APPNAMEHERE/, appname.downcase
|
30
31
|
chmod app_file('bin/_deploy'), 0755
|
31
|
-
gsub_file app_file('bin/deploy'), /APPNAMEHERE/, appname.downcase
|
32
32
|
|
33
33
|
say 'Welcome to AWS Lambda and Rails 🎉', :green
|
@@ -1,3 +1,15 @@
|
|
1
1
|
FROM public.ecr.aws/lambda/ruby:2.7
|
2
|
+
ARG RAILS_ENV
|
3
|
+
ENV RAILS_ENV=$RAILS_ENV
|
4
|
+
|
2
5
|
COPY . .
|
6
|
+
|
7
|
+
# == Cleanup Unused Files & Directories ==
|
8
|
+
RUN rm -rf \
|
9
|
+
log \
|
10
|
+
node_modules \
|
11
|
+
test \
|
12
|
+
tmp \
|
13
|
+
vendor/bundle/ruby/2.7.0/cache
|
14
|
+
|
3
15
|
CMD ["app.handler"]
|
@@ -1,15 +1,18 @@
|
|
1
1
|
FROM amazon/aws-sam-cli-build-image-ruby2.7
|
2
2
|
|
3
3
|
# Ensure minimum required SAM version.
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
ENV SAM_CLI_VERSION=1.23.0
|
5
|
+
RUN curl -L "https://github.com/aws/aws-sam-cli/releases/download/v${SAM_CLI_VERSION}/aws-sam-cli-linux-x86_64.zip" \
|
6
|
+
-o "aws-sam-cli-linux-x86_64.zip" && \
|
7
|
+
unzip -q aws-sam-cli-linux-x86_64.zip -d sam-installation && \
|
8
|
+
./sam-installation/install && \
|
9
|
+
rm -rf ./sam-installation ./aws-sam-cli-linux-x86_64.zip
|
7
10
|
|
8
11
|
# Node for JavaScript.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash - && \
|
13
|
+
yum install -y nodejs && \
|
14
|
+
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo && \
|
15
|
+
rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg && \
|
16
|
+
yum install -y yarn
|
14
17
|
|
15
18
|
WORKDIR /var/task
|
@@ -1,20 +1,15 @@
|
|
1
|
-
#!/
|
1
|
+
#!/bin/sh
|
2
2
|
set -e
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
cp -r "$SAM_TEMP" "./.lamby/$RESOURCE"
|
11
|
-
pushd "./.lamby/$RESOURCE"
|
12
|
-
|
13
|
-
echo '== Cleaning Dev Dependencies =='
|
14
|
-
rm -rf ./.bundle \
|
15
|
-
./vendor/bundle
|
4
|
+
if [ "$CI" != "true" ]; then
|
5
|
+
echo "== Cleaning dev dependencies for local deploy. Run ./bin/setup again afterward! =="
|
6
|
+
rm -rf ./.bundle \
|
7
|
+
./vendor/bundle \
|
8
|
+
./node_modules
|
9
|
+
fi
|
16
10
|
|
17
11
|
echo '== Bundle For Deployment =='
|
12
|
+
bundle lock --add-platform x86_64-linux
|
18
13
|
bundle config --local deployment true
|
19
14
|
bundle config --local without 'development test'
|
20
15
|
bundle config --local path './vendor/bundle'
|
@@ -27,14 +22,4 @@ echo "== Environments & Configuration =="
|
|
27
22
|
# LAMBY_SSM_PARAMS_PATH="/APPNAMEHERE/${RAILS_ENV}/env"
|
28
23
|
|
29
24
|
echo "== Asset Hosts & Precompiling =="
|
30
|
-
|
31
|
-
# RAILS_GROUPS=assets \
|
32
|
-
# ./bin/rails assets:precompile
|
33
|
-
|
34
|
-
echo "== Cleanup Unused Files & Directories =="
|
35
|
-
rm -rf \
|
36
|
-
log \
|
37
|
-
node_modules \
|
38
|
-
test \
|
39
|
-
tmp \
|
40
|
-
vendor/bundle/ruby/2.7.0/cache
|
25
|
+
NODE_ENV='production' ./bin/rails assets:precompile
|
@@ -1,44 +1,30 @@
|
|
1
|
-
#!/
|
1
|
+
#!/bin/sh
|
2
2
|
set -e
|
3
3
|
|
4
|
-
export DEPLOYMENT_NAME="myorg/APPNAMEHERE"
|
5
|
-
export RAILS_ENV=${RAILS_ENV:="production"}
|
6
|
-
export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:=us-east-1}
|
7
|
-
export CLOUDFORMATION_BUCKET=${CLOUDFORMATION_BUCKET:="lamby.cloudformation.${DEPLOYMENT_NAME/\//-}"}
|
8
|
-
|
9
4
|
# https://github.com/aws/aws-sam-cli/issues/2447
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
echo '== Creating ECR repository =='
|
14
|
-
echo 'You can safely ignore any RepositoryAlreadyExistsException errors...'
|
15
|
-
aws ecr create-repository \
|
16
|
-
--repository-name "$DEPLOYMENT_NAME" \
|
17
|
-
--image-tag-mutability MUTABLE \
|
18
|
-
--image-scanning-configuration scanOnPush=true \
|
19
|
-
--region "$AWS_DEFAULT_REGION" || true
|
5
|
+
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
|
6
|
+
IMAGE_REPOSITORY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/APPNAMEHERE"
|
20
7
|
|
21
|
-
|
8
|
+
echo "== Lamby build =="
|
22
9
|
./bin/_build
|
23
10
|
|
11
|
+
echo "== SAM build =="
|
24
12
|
sam build \
|
25
13
|
--parameter-overrides \
|
26
|
-
|
14
|
+
RailsEnv="${RAILS_ENV}"
|
27
15
|
|
28
|
-
echo "== SAM package
|
16
|
+
echo "== SAM package =="
|
29
17
|
sam package \
|
30
18
|
--region "$AWS_DEFAULT_REGION" \
|
31
19
|
--template-file ./.aws-sam/build/template.yaml \
|
32
20
|
--output-template-file ./.aws-sam/build/packaged.yaml \
|
33
21
|
--image-repository "$IMAGE_REPOSITORY" \
|
34
|
-
--s3-bucket "${CLOUDFORMATION_BUCKET}" \
|
35
|
-
--s3-prefix "${DEPLOYMENT_NAME/\//-}-${RAILS_ENV}"
|
36
22
|
|
37
|
-
echo "== SAM deploy
|
23
|
+
echo "== SAM deploy =="
|
38
24
|
sam deploy \
|
39
25
|
--region "$AWS_DEFAULT_REGION" \
|
40
26
|
--template-file ./.aws-sam/build/packaged.yaml \
|
41
|
-
--stack-name "
|
27
|
+
--stack-name "APPNAMEHERE-${RAILS_ENV}" \
|
42
28
|
--image-repository "$IMAGE_REPOSITORY" \
|
43
29
|
--capabilities "CAPABILITY_IAM" \
|
44
30
|
--parameter-overrides \
|
@@ -1,13 +1,8 @@
|
|
1
|
-
#!/
|
1
|
+
#!/bin/sh
|
2
2
|
set -e
|
3
3
|
|
4
4
|
export RAILS_ENV=${RAILS_ENV:=production}
|
5
5
|
|
6
|
-
if [[ "$OSTYPE" == *"darwin"* ]]; then
|
7
|
-
export SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock
|
8
|
-
fi
|
9
|
-
|
10
6
|
docker-compose run \
|
11
|
-
|
12
|
-
|
13
|
-
./bin/_deploy
|
7
|
+
APPNAMEHERE \
|
8
|
+
./bin/_deploy
|
@@ -1,17 +1,19 @@
|
|
1
1
|
version: '3.7'
|
2
2
|
services:
|
3
|
-
|
3
|
+
APPNAMEHERE:
|
4
4
|
build:
|
5
|
-
context: .
|
5
|
+
context: '.'
|
6
6
|
dockerfile: Dockerfile-build
|
7
|
+
entrypoint: ./bin/entrypoint
|
7
8
|
environment:
|
8
9
|
- RAILS_ENV=${RAILS_ENV-development}
|
10
|
+
- SAM_CLI_TELEMETRY=0
|
9
11
|
- AWS_PROFILE=${AWS_PROFILE-default}
|
12
|
+
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
|
13
|
+
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
|
10
14
|
- AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION-us-east-1}
|
11
|
-
-
|
15
|
+
- CI=${CI}
|
12
16
|
volumes:
|
13
|
-
- ${
|
14
|
-
-
|
15
|
-
- ~/.ssh/known_hosts:/root/.ssh/known_hosts
|
16
|
-
- .:/var/task:delegated
|
17
|
+
- ${PWD}:/var/task
|
18
|
+
- ${HOME}/.aws:/root/.aws
|
17
19
|
- /var/run/docker.sock:/var/run/docker.sock
|
data/lib/lamby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lamby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -150,7 +150,6 @@ files:
|
|
150
150
|
- docker-compose.yml
|
151
151
|
- lamby.gemspec
|
152
152
|
- lib/lamby.rb
|
153
|
-
- lib/lamby/bootsnap.rb
|
154
153
|
- lib/lamby/config.rb
|
155
154
|
- lib/lamby/debug.rb
|
156
155
|
- lib/lamby/handler.rb
|
@@ -160,6 +159,7 @@ files:
|
|
160
159
|
- lib/lamby/rack_http.rb
|
161
160
|
- lib/lamby/rack_rest.rb
|
162
161
|
- lib/lamby/railtie.rb
|
162
|
+
- lib/lamby/runner.rb
|
163
163
|
- lib/lamby/sam_helpers.rb
|
164
164
|
- lib/lamby/ssm_parameter_store.rb
|
165
165
|
- lib/lamby/tasks.rake
|