This repository was archived by the owner on Mar 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
189 lines (163 loc) · 4.53 KB
/
serverless.yml
File metadata and controls
189 lines (163 loc) · 4.53 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
service: collection-log-api
app: collection-log-api
frameworkVersion: "2"
useDotenv: true
provider:
name: aws
runtime: nodejs14.x
lambdaHashingVersion: 20201221
stage: ${opt:stage, 'local'}
region: us-east-1
logRetentionInDays: 14
timeout: 29
environment:
SERVICE_NAME: ${self:service}
STAGE_NAME: ${self:provider.stage}
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
DB_DIALECT: postgres
DB_NAME: ${env:DB_NAME}
DB_USER: ${env:DB_USER}
DB_PASS: ${env:DB_PASS}
DB_HOST: ${env:DB_HOST}
DB_PORT: ${env:DB_PORT}
vpc:
securityGroupIds:
- !Ref LambdaSecurityGroup
subnetIds:
- !Ref PrivateSubnetA
- !Ref PrivateSubnetB
iam:
role:
statements:
- Effect: Allow
Action:
- ec2:CreateNetworkInterface
- ec2:DescribeNetworkInterfaces
- ec2:DeleteNetworkInterface
- ec2:AssignPrivateIpAddresses
- ec2:UnassignPrivateIpAddresses
- lambda:InvokeAsync
- lambda:InvokeFunction
Resource: '*'
functions:
# Collection log endpoints
get-collection-log-by-username:
handler: src/handlers/collectionlog/get-collection-log-by-username.handler
events:
- httpApi:
path: /collectionlog/user/{username}
method: get
update-collection-log:
handler: src/handlers/collectionlog/update-collection-log.handler
memorySize: 2048
events:
- httpApi:
path: /collectionlog/{accountHash}
method: put
get-collection-log-exists:
handler: src/handlers/collectionlog/get-collection-log-exists.handler
events:
- httpApi:
path: /collectionlog/exists/{accountHash}
method: get
update-collection-log-details:
handler: src/handlers/collectionlog/update-collection-log-details.handler
timeout: 120
delete-collection-log:
handler: src/handlers/collectionlog/delete-collection-log.handler
events:
- httpApi:
path: /collectionlog/delete
method: delete
# User endpoints
create-user:
handler: src/handlers/user/create-user.handler
events:
- httpApi:
path: /user
method: post
get-user-typeahead:
handler: src/handlers/user/get-user-typeahead.handler
events:
- httpApi:
path: /user/typeahead/{username}
method: get
get-user-count:
handler: src/handlers/user/get-user-count.handler
events:
- httpApi:
path: /user/count
method: get
get-user-settings:
handler: src/handlers/user/get-user-settings.handler
events:
- httpApi:
path: /user/settings/{username}
method: get
# Items endpoints
get-items-recent:
handler: src/handlers/items/get-recent.handler
events:
- httpApi:
path: /items/recent/{username}
method: get
get-items-page-by-username:
handler: src/handlers/items/get-page-by-username.handler
events:
- httpApi:
path: /items/user/{username}
method: get
get-items-recent-global:
handler: src/handlers/items/get-recent-global.handler
events:
- httpApi:
path: /items/global
method: get
# Hiscores endpoints
get-hiscores:
handler: src/handlers/hiscores/get-hiscores.handler
events:
- httpApi:
path: /hiscores/{page}
method: get
get-hiscores-rank-by-username:
handler: src/handlers/hiscores/get-rank-by-username.handler
events:
- httpApi:
path: /hiscores/rank/{username}
method: get
get-hiscores-ranks-by-username:
handler: src/handlers/hiscores/get-account-type-ranks-by-username.handler
events:
- httpApi:
path: /hiscores/ranks/{username}
method: get
# Scheduled tasks
build-items-recent-global:
handler: src/handlers/items/build-recent-global.handler
timeout: 600
events:
- schedule: rate(10 minutes)
plugins:
- serverless-plugin-typescript
- serverless-tscpaths
- serverless-domain-manager
- serverless-offline
custom:
dev:
domainName: dev.api.collectionlog.net
prod:
domainName: api.collectionlog.net
customDomain:
domainName: ${self:custom.${self:provider.stage}.domainName}
certificateName: api.collectionlog.net
basePath: ''
stage: ${self:provider.stage}
createRoute53Record: true
apiType: http
endpointType: regional
resources:
- ${file(resources/vpc.yml)}
- ${file(resources/securitygroup.yml)}
- ${file(resources/route.yml)}
- ${file(resources/rds.yml)}