-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
126 lines (115 loc) · 3.08 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
service: nzshm22-solvis-graphql-api
variablesResolutionMode: 20210326
plugins:
- serverless-python-requirements
- serverless-wsgi
- serverless-plugin-warmup
package:
individually: false
patterns:
- '!__pycache__/**'
- '!.git/**'
- '!.github/**'
- '!.pytest_cache/**'
- '!.mypy_cache/**'
- '!.tox/**'
- '!dist/**'
- '!docs/**'
- '!/**'
- '!node_modules/**'
- '!package.json'
- '!package-log.json'
- '!poetry.lock'
- '!tests/**'
- '!site/**'
- '!*.*'
- solvis_graphql_api/**
custom:
# DRY constants: define all compound/generated names in one place
# Override args are: .. defaults:
# --app_acroym signed-uploader
# --s3_bucket self:custom.app_acronym
# --s3_key_base self:custom.stage
# --region us-east-1
# --stage test
# --deletion_policy delete
app_acronym: ${opt:acronym, self:service}
default_stage: local
stage: ${opt:stage, self:custom.default_stage}
stack_name: ${self:custom.app_acronym}-${self:custom.stage}
region: ${opt:region, self:provider.region}
deletion_policy: Delete
# presigned URL TTL
url_default_ttl: 60
#serverless-wsgi settings
wsgi:
app: solvis_graphql_api.solvis_graphql_api.app
packRequirements: false
pythonBin: python3
#serverless-python-requirements settings
pythonRequirements:
dockerizePip: non-linux
slim: true
zip: true
slimPatterns:
- "**/*.egg-info*"
noDeploy:
- botocore
- vtkmodules
# Lambda warmer settings see https://www.serverless.com/plugins/serverless-plugin-warmup
warmup:
littleWarmer:
enabled: true
events:
- schedule: rate(5 minutes)
concurrency: 1
provider:
name: aws
runtime: python3.9
stage: ${opt:stage, 'dev'}
region: ap-southeast-2
apiGateway:
apiKeys:
- name: SOLVIS_GRAPHQL_API_TempApiKey-${self:custom.stage}
description: Api key until we have an auth function # Optional
iam:
role:
statements:
- Effect: Allow
Action:
- "cloudwatch:PutMetricData"
- "dynamodb:Scan"
- "dynamodb:DescribeTable"
- "dynamodb:GetItem"
- "dynamodb:Query"
Resource: "*"
functions:
app:
description: The graphql API of ${self:service}
handler: wsgi_handler.handler
memorySize: 2096 # optional, in MB, default is 1024
timeout: 20 # optional, in seconds, default is 6
events:
- http:
path: /{any+}
method: OPTIONS
- http:
path: /{any+}
method: POST
private: true
- http:
path: /{any+}
method: GET
private: true
environment:
SERVICE_NAME: ${self:service}
STACK_NAME: ${self:custom.stack_name}
REGION: ${self:custom.region}
DEPLOYMENT_STAGE: ${self:custom.stage}
ENABLE_METRICS: ${env:ENABLE_METRICS, 0}
LOGGING_CFG: ${env:LOGGING_CFG, "solvis_graphql_api/logging_aws.yaml"}
warmup:
littleWarmer:
enabled:
- test
- prod