-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
83 lines (77 loc) · 2.18 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
service: llamapay-oracle
package:
individually: true
provider:
name: aws
runtime: nodejs14.x
memorySize: 250
region: eu-central-1
endpointType: REGIONAL # Set to regional because the api gateway will be behind a cloudfront distribution
stage: prod
tracing: # Enable X-Ray tracing (debugging)
apiGateway: true
lambda: true
iamRoleStatements:
- Effect: Allow # X-Ray permissions
Action:
- xray:PutTraceSegments
- xray:PutTelemetryRecords
Resource: "*"
- Effect: Allow # Lambda logs on cloudwatch
Action:
- logs:CreateLogGroup
- logs:CreateLogStream
- logs:PutLogEvents
Resource:
- "Fn::Join":
- ":"
- - "arn:aws:logs"
- Ref: "AWS::Region"
- Ref: "AWS::AccountId"
- "log-group:/aws/lambda/*:*:*"
environment:
stage: ${self:custom.stage}
custom:
stage: ${opt:stage, self:provider.stage}
webpack:
webpackConfig: ./webpack.config.js
includeModules:
forceInclude:
- ethers
packager: "npm"
excludeFiles: src/**/*.test.ts
prune:
automatic: true
number: 5 # Number of versions to keep
domainMap:
prod:
domain: nft.llamapay.io
certificateArn: "arn:aws:acm:us-east-1:249187628721:certificate/3162bd61-db34-4398-bc93-34974a23d1aa"
hostedZone: llamapay.io
domain: ${self:custom.domainMap.${self:custom.stage}.domain}
certificateArn: ${self:custom.domainMap.${self:custom.stage}.certificateArn}
hostedZone: ${self:custom.domainMap.${self:custom.stage}.hostedZone}
functions:
fallback:
handler: src/fallback.default
events:
- http:
path: /{params+}
method: any
triggerOracle:
handler: src/triggerOracle.default
timeout: 60
memorySize: 3000
events:
- schedule: cron(0 * * * ? *)
environment:
LLAMAPAY_ORACLE_PRIVATE_KEY: ${env:LLAMAPAY_ORACLE_PRIVATE_KEY}
resources:
# CORS for api gateway errors
- ${file(resources/api-gateway-errors.yml)}
# Cloudfront API distribution
- ${file(resources/api-cloudfront-distribution.yml)}
plugins:
- serverless-webpack-fixed
- serverless-offline
- serverless-prune-plugin