This repository has been archived by the owner on Sep 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
93 lines (88 loc) · 3.24 KB
/
serverless.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
service: hills-api
provider:
name: aws
region: ${opt:region, '${file(./serverless-shared.yml):constants.defaultRegion}'}
runtime: nodejs10.x # matches package.json:engines
stage: ${opt:stage, 'dev'}
memorySize: 128 # MB, sls default is 1024, aws default is 128
timeout: 3 # seconds, sls default is 6, aws default is 3
apiGateway:
minimumCompressionSize: 1024 # bytes, this enables compression
# Only the graphql lambda needs this, but a single shared role is much easier to configure
iamRoleStatements:
- Effect: Allow
Action:
- rds-data:ExecuteStatement
Resource:
- Fn::ImportValue: ${self:provider.stage}-HillsApiDatabaseClusterArn
- Effect: Allow
Action:
- secretsmanager:GetSecretValue
Resource:
- Fn::ImportValue: ${self:provider.stage}-HillsApiDatabaseClusterSecretArn
plugins:
- serverless-api-stage
- serverless-offline
- serverless-plugin-git-variables
- serverless-prune-plugin
package:
exclude:
- ./**
- '!./node_modules/**' # don't re-include this; it'd override excludeDevDependencies
excludeDevDependencies: true # default is true; fyi
include:
- ./src/**/!(*.spec).js
- ./src/**/rhbSections.json
functions:
graphql:
handler: src/handlers/graphql.fn
description: ${self:custom.versionInfo}
memorySize: 256 # MB, sls default is 1024, aws default is 128
timeout: 6 # seconds, sls default is 6, aws default is 3. Needs to be longer than Aurora Severless connect timeout for when it's sleeping
# reservedConcurrency cannot be specified on the provider - https://github.com/serverless/serverless/issues/5472
reservedConcurrency: 10
environment:
# Due to lack of support for cross-stack references in Serverless offline, ARNs must be manually copied into here before running
DATABASE_CLUSTER_ARN:
Fn::ImportValue: ${self:provider.stage}-HillsApiDatabaseClusterArn
DATABASE_CLUSTER_SECRET_ARN:
Fn::ImportValue: ${self:provider.stage}-HillsApiDatabaseClusterSecretArn
NODE_ENV: production # for Express, and anything else that might care
events:
- http:
path: graphql
method: post
cors: true
- http:
path: graphql
method: get
cors: true
playground:
handler: src/handlers/playground.fn
description: ${self:custom.versionInfo}
# reservedConcurrency cannot be specified on the provider - https://github.com/serverless/serverless/issues/5472
reservedConcurrency: 10
events:
- http:
path: playground
method: get
schemaDump:
handler: src/handlers/schemaDump.fn
description: ${self:custom.versionInfo}
# reservedConcurrency cannot be specified on the provider - https://github.com/serverless/serverless/issues/5472
reservedConcurrency: 10
events:
- http:
path: schema
method: get
custom:
exportGitVariables: false
prune:
automatic: true
number: 3
stageSettings:
MethodSettings:
# https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-request-throttling.html
ThrottlingBurstLimit: 20
ThrottlingRateLimit: 20
versionInfo: ${git:branch}:${git:describeLight} isDirty=${git:isDirty} "${git:message}"