forked from celer-network/bridges-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
160 lines (154 loc) · 3.9 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
service: llama-bridges
package:
individually: true
excludeDevDependencies: true
useDotenv: true
provider:
name: aws
runtime: nodejs16.x
memorySize: 128
timeout: 10
region: eu-central-1
endpointType: REGIONAL # Set to regional because the api gateway will be behind a cloudfront distribution
stage: prod # Default to dev if no stage is specified
tracing: # Enable X-Ray tracing (debugging)
apiGateway: true
lambda: true
iamRoleStatements:
- Effect: Allow # X-Ray permissions
Action:
- xray:PutTraceSegments
- xray:PutTelemetryRecords
Resource: "*"
- Effect: "Allow"
Action:
- rds-data:ExecuteStatement
- rds-data:BatchExecuteStatement
Resource:
- "Fn::Join":
- ":"
- - "arn:aws:rds-db"
- Ref: "AWS::Region"
- Ref: "AWS::AccountId"
- "db:indexer-instance-1-eu-central-1c"
- 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/*:*:*"
# For warm-up functions
- Effect: "Allow"
Action:
- "lambda:InvokeFunction"
Resource: "*"
- Effect: "Allow"
Action:
- "s3:ListBucket"
- "s3:*Object*"
Resource: "*"
environment:
PSQL_URL: ${env:PSQL_URL}
PSQL_USERNAME: ${env:PSQL_USERNAME}
PSQL_PW: ${env:PSQL_PW}
MODE: lambda
BSC_RPC: ${env:BSC_RPC}
CELO_RPC: ${env:CELO_RPC}
ETHEREUM_RPC: ${env:ETHEREUM_RPC}
OPTIMISM_RPC: ${env:OPTIMISM_RPC}
AURORA_RPC: ${env:AURORA_RPC}
ARBITRUM_RPC: ${env:ARBITRUM_RPC}
functions:
bridgeDayStats:
handler: src/handlers/getBridgeStatsOnDay.default
timeout: 30
memorySize: 2000
events:
- http:
path: bridgedaystats/{timestamp}/{chain}
method: get
bridgeVolume:
handler: src/handlers/getBridgeVolume.default
timeout: 30
memorySize: 3000
events:
- http:
path: bridgevolume/{chain}
method: get
bridges:
handler: src/handlers/getBridges.default
timeout: 30
memorySize: 2000
events:
- http:
path: bridges
method: get
bridge:
handler: src/handlers/getBridge.default
timeout: 30
memorySize: 2000
events:
- http:
path: bridge/{id}
method: get
transactions:
handler: src/handlers/getTransactions.default
timeout: 30
memorySize: 3000
events:
- http:
path: transactions/{id}
method: get
largeTransactions:
handler: src/handlers/getLargeTransactions.default
timeout: 30
memorySize: 3000
events:
- http:
path: largetransactions/{chain}
method: get
runAdapter:
handler: src/handlers/runAdapter.default
timeout: 900
memorySize: 1024
runAllAdapters:
handler: src/handlers/runAllAdapters.default
timeout: 900
memorySize: 250
events:
- schedule: cron(2,17,47 * * * ? *)
runAggregateAllAdapters:
handler: src/handlers/runAggregateAllAdapters.default
timeout: 900
memorySize: 10240
events:
- schedule: cron(32 * * * ? *)
checkDbEntries:
handler: src/handlers/checkDbEntries.default
timeout: 600
memorySize: 2000
events:
- schedule: cron(30 1 * * ? *)
resources:
# CORS for api gateway errors
- ${file(resources/api-gateway-errors.yml)}
custom:
stage: ${opt:stage, self:provider.stage}
webpack:
webpackConfig: ./webpack.config.js
includeModules: true
packager: "npm"
excludeFiles: src/**/*.test.ts
prune:
automatic: true
number: 5 # Number of versions to keep
plugins:
- serverless-webpack
- serverless-offline
- serverless-prune-plugin