lamby-no-rails 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.python-version +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +17 -0
  6. data/Brewfile +5 -0
  7. data/CHANGELOG.md +109 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/Gemfile +3 -0
  10. data/Gemfile.lock +168 -0
  11. data/LICENSE.txt +21 -0
  12. data/Pipfile +13 -0
  13. data/Pipfile.lock +370 -0
  14. data/README.md +37 -0
  15. data/Rakefile +12 -0
  16. data/bin/bootstrap +20 -0
  17. data/bin/console +14 -0
  18. data/bin/setup +6 -0
  19. data/bin/test +5 -0
  20. data/bin/update +7 -0
  21. data/lamby.gemspec +29 -0
  22. data/lib/lamby.rb +25 -0
  23. data/lib/lamby/debug.rb +46 -0
  24. data/lib/lamby/handler.rb +71 -0
  25. data/lib/lamby/logger.rb +23 -0
  26. data/lib/lamby/rack.rb +85 -0
  27. data/lib/lamby/rack_alb.rb +73 -0
  28. data/lib/lamby/rack_api.rb +36 -0
  29. data/lib/lamby/railtie.rb +12 -0
  30. data/lib/lamby/sam_helpers.rb +9 -0
  31. data/lib/lamby/ssm_parameter_store.rb +154 -0
  32. data/lib/lamby/tasks.rake +15 -0
  33. data/lib/lamby/templates.rake +36 -0
  34. data/lib/lamby/templates/api_gateway.rb +25 -0
  35. data/lib/lamby/templates/api_gateway/app.rb +10 -0
  36. data/lib/lamby/templates/api_gateway/build +23 -0
  37. data/lib/lamby/templates/api_gateway/deploy +22 -0
  38. data/lib/lamby/templates/api_gateway/template.yaml +84 -0
  39. data/lib/lamby/templates/application_load_balancer.rb +25 -0
  40. data/lib/lamby/templates/application_load_balancer/app.rb +10 -0
  41. data/lib/lamby/templates/application_load_balancer/build +23 -0
  42. data/lib/lamby/templates/application_load_balancer/deploy +39 -0
  43. data/lib/lamby/templates/application_load_balancer/template.yaml +90 -0
  44. data/lib/lamby/templates/shared.rb +15 -0
  45. data/lib/lamby/version.rb +3 -0
  46. metadata +199 -0
@@ -0,0 +1,90 @@
1
+ AWSTemplateFormatVersion: '2010-09-09'
2
+ Transform: AWS::Serverless-2016-10-31
3
+ Description: APPNAMEHERE Lambda (ALB)
4
+
5
+ Parameters:
6
+
7
+ RailsEnv:
8
+ Type: String
9
+ Default: production
10
+ AllowedValues:
11
+ - staging
12
+ - production
13
+ VpcId:
14
+ Type: AWS::EC2::VPC::Id
15
+ Subnets:
16
+ Type: List<AWS::EC2::Subnet::Id>
17
+
18
+ Resources:
19
+
20
+ RailsLoadBalancer:
21
+ Type: AWS::ElasticLoadBalancingV2::LoadBalancer
22
+ Properties:
23
+ Name: APPNAMEHERE
24
+ Scheme: internet-facing
25
+ Subnets: !Ref Subnets
26
+ SecurityGroups:
27
+ - !Ref RailsSecurityGroup
28
+
29
+ RailsLoadBalancerTargetGroup:
30
+ Type: AWS::ElasticLoadBalancingV2::TargetGroup
31
+ DependsOn: RailsFunctionInvokePermission
32
+ Properties:
33
+ TargetType: lambda
34
+ TargetGroupAttributes:
35
+ - Key: lambda.multi_value_headers.enabled
36
+ Value: true
37
+ Targets:
38
+ - Id: !GetAtt RailsFunction.Arn
39
+
40
+ RailsLoadBalancerHttpListener:
41
+ Type: 'AWS::ElasticLoadBalancingV2::Listener'
42
+ Properties:
43
+ DefaultActions:
44
+ - TargetGroupArn: !Ref RailsLoadBalancerTargetGroup
45
+ Type: forward
46
+ LoadBalancerArn: !Ref RailsLoadBalancer
47
+ Port: 80
48
+ Protocol: HTTP
49
+
50
+ RailsSecurityGroup:
51
+ Type: AWS::EC2::SecurityGroup
52
+ Properties:
53
+ GroupDescription: Allow HTTP
54
+ VpcId: !Ref VpcId
55
+ SecurityGroupIngress:
56
+ - IpProtocol: tcp
57
+ FromPort: 80
58
+ ToPort: 80
59
+ CidrIp: 0.0.0.0/0
60
+
61
+ RailsFunctionInvokePermission:
62
+ Type: AWS::Lambda::Permission
63
+ Properties:
64
+ FunctionName: !GetAtt RailsFunction.Arn
65
+ Action: 'lambda:InvokeFunction'
66
+ Principal: elasticloadbalancing.amazonaws.com
67
+
68
+ RailsFunction:
69
+ Type: AWS::Serverless::Function
70
+ Properties:
71
+ CodeUri: .
72
+ Handler: app.handler
73
+ Runtime: ruby2.5
74
+ MemorySize: 512
75
+ Timeout: 30
76
+ Environment:
77
+ Variables:
78
+ RAILS_ENV: !Ref RailsEnv
79
+ FunctionName: !Join [ '', [ 'APPNAMEHERE-', !Ref RailsEnv, '-', !Ref 'AWS::Region' ] ]
80
+ AutoPublishAlias: live
81
+
82
+ Outputs:
83
+
84
+ RailsLoadBalancerDNSNAme:
85
+ Description: Application Load Balancer DNS Name
86
+ Value: !GetAtt RailsLoadBalancer.DNSName
87
+
88
+ RailsFunctionArn:
89
+ Description: Lambda ARN
90
+ Value: !GetAtt RailsFunction.Arn
@@ -0,0 +1,15 @@
1
+ def inst_name
2
+ $LAMBY_INSTALLER_NAME
3
+ end
4
+
5
+ def app_file(path)
6
+ Rails.root.join(path)
7
+ end
8
+
9
+ def tpl_file(path)
10
+ "#{__dir__}/#{inst_name}/#{path}"
11
+ end
12
+
13
+ def appname
14
+ Rails.application.class.parent.name
15
+ end
@@ -0,0 +1,3 @@
1
+ module Lamby
2
+ VERSION = '1.0.3'
3
+ end
metadata ADDED
@@ -0,0 +1,199 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lamby-no-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Ken Collins
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-01-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk-ssm
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: mocha
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: sqlite3
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: Simple Rails & AWS Lambda Integration using Rack and various utilities.
126
+ email:
127
+ - kcollins@customink.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".python-version"
134
+ - ".ruby-version"
135
+ - ".travis.yml"
136
+ - Brewfile
137
+ - CHANGELOG.md
138
+ - CODE_OF_CONDUCT.md
139
+ - Gemfile
140
+ - Gemfile.lock
141
+ - LICENSE.txt
142
+ - Pipfile
143
+ - Pipfile.lock
144
+ - README.md
145
+ - Rakefile
146
+ - bin/bootstrap
147
+ - bin/console
148
+ - bin/setup
149
+ - bin/test
150
+ - bin/update
151
+ - lamby.gemspec
152
+ - lib/lamby.rb
153
+ - lib/lamby/debug.rb
154
+ - lib/lamby/handler.rb
155
+ - lib/lamby/logger.rb
156
+ - lib/lamby/rack.rb
157
+ - lib/lamby/rack_alb.rb
158
+ - lib/lamby/rack_api.rb
159
+ - lib/lamby/railtie.rb
160
+ - lib/lamby/sam_helpers.rb
161
+ - lib/lamby/ssm_parameter_store.rb
162
+ - lib/lamby/tasks.rake
163
+ - lib/lamby/templates.rake
164
+ - lib/lamby/templates/api_gateway.rb
165
+ - lib/lamby/templates/api_gateway/app.rb
166
+ - lib/lamby/templates/api_gateway/build
167
+ - lib/lamby/templates/api_gateway/deploy
168
+ - lib/lamby/templates/api_gateway/template.yaml
169
+ - lib/lamby/templates/application_load_balancer.rb
170
+ - lib/lamby/templates/application_load_balancer/app.rb
171
+ - lib/lamby/templates/application_load_balancer/build
172
+ - lib/lamby/templates/application_load_balancer/deploy
173
+ - lib/lamby/templates/application_load_balancer/template.yaml
174
+ - lib/lamby/templates/shared.rb
175
+ - lib/lamby/version.rb
176
+ homepage: https://github.com/customink/lamby
177
+ licenses:
178
+ - MIT
179
+ metadata: {}
180
+ post_install_message:
181
+ rdoc_options: []
182
+ require_paths:
183
+ - lib
184
+ required_ruby_version: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
189
+ required_rubygems_version: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ requirements: []
195
+ rubygems_version: 3.0.6
196
+ signing_key:
197
+ specification_version: 4
198
+ summary: Simple Rails & AWS Lambda Integration using Rack
199
+ test_files: []