-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
194 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,7 @@ | |
|
||
# rspec failure tracking | ||
.rspec_status | ||
|
||
integration/template.json | ||
.aws-sam/ | ||
samconfig.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM public.ecr.aws/lambda/ruby:2.7 | ||
|
||
ENV GEM_HOME=${LAMBDA_TASK_ROOT} | ||
ENV BUNDLE_PATH=${LAMBDA_TASK_ROOT}/vendor/bundle | ||
COPY integration/Gemfile* ${LAMBDA_TASK_ROOT}/ | ||
RUN bundle install | ||
|
||
COPY lib ${LAMBDA_TASK_ROOT}/lib | ||
COPY integration/* ${LAMBDA_TASK_ROOT}/ | ||
|
||
#RUN find ${LAMBDA_TASK_ROOT} | ||
|
||
CMD ["main.Main.handle"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source 'https://rubygems.org' | ||
gem 'sinatra' | ||
gem 'rack', '<3' | ||
gem 'webrick' | ||
#gem 'rackup' | ||
#gem 'rack-session' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
mustermann (3.0.0) | ||
ruby2_keywords (~> 0.0.1) | ||
rack (2.2.4) | ||
rack-protection (3.0.2) | ||
rack | ||
ruby2_keywords (0.0.5) | ||
sinatra (3.0.2) | ||
mustermann (~> 3.0) | ||
rack (~> 2.2, >= 2.2.4) | ||
rack-protection (= 3.0.2) | ||
tilt (~> 2.0) | ||
tilt (2.0.11) | ||
webrick (1.7.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
rack (< 3) | ||
sinatra | ||
webrick | ||
|
||
BUNDLED WITH | ||
2.4.0.dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
build: | ||
jsonnet template.jsonnet > template.json | ||
sam build | ||
|
||
setup: build | ||
sam deploy --guided | ||
|
||
deploy: build | ||
sam deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# sinatra app for integration test | ||
|
||
``` | ||
make setup | ||
make deploy | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'sinatra/base' | ||
|
||
class App < Sinatra::Base | ||
get '/' do | ||
cnt = session[:cnt] || 0 | ||
content_type :html | ||
"<!DOCTYPE html><html><head><meta charset='utf-8'><title>apigatewayv2_rack test</title><body><p>Hello from Lambda!</p><form method='post'><p><button type='submit'>+</button> #{cnt}</p></form>" | ||
end | ||
|
||
post '/' do | ||
session[:cnt] ||= 0 | ||
session[:cnt] += 1 | ||
redirect '/' | ||
end | ||
|
||
get '/errortown' do | ||
raise RuntimeError, 'errortown...' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require_relative './app' | ||
require 'rack' | ||
require 'logger' | ||
|
||
use(Rack::CommonLogger, Logger.new($stdout)) | ||
use(Rack::Session::Cookie, key: 'sess', expire_after: 3600, secret: 'insecure-secret') | ||
run App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
$:.unshift(File.join(__dir__, 'lib')) | ||
require 'rack' | ||
require 'rack/builder' | ||
require 'apigatewayv2_rack' | ||
|
||
|
||
#module Main | ||
# @app = Rack::Builder.load_file(File.join(__dir__, 'config.ru'), {})[0] | ||
# def self.handle(event:, context:) | ||
# puts(JSON.generate(event: event, context: context)) | ||
# retval = Apigatewayv2Rack.handle_request(event: event, context: context, app: @app) | ||
# puts(JSON.generate(retval)) | ||
# retval | ||
# end | ||
#end | ||
#def handler(event:, context:) | ||
# Main.handle(event: event, context: context) | ||
#end | ||
|
||
$stdout.sync = true | ||
Main = Apigatewayv2Rack.handler_from_rack_config_file(File.join(__dir__, 'config.ru')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SAM template | ||
{ | ||
AWSTemplateFormatVersion: '2010-09-09', | ||
Transform: 'AWS::Serverless-2016-10-31', | ||
Description: '', | ||
|
||
Resources: { | ||
AppFunction: { | ||
Type: 'AWS::Serverless::Function', // https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction | ||
Properties: { | ||
PackageType: 'Image', | ||
FunctionUrlConfig: { AuthType: 'NONE' }, | ||
}, | ||
Metadata: { | ||
DockerContext: '..', | ||
Dockerfile: 'Dockerfile.integration', | ||
}, | ||
}, | ||
}, | ||
Outputs: { | ||
AppUrl: { | ||
Description: 'app endpoint', | ||
Value: { 'Fn::GetAtt': ['AppFunctionUrl', 'FunctionUrl'] }, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters