-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserverless.yml
More file actions
307 lines (276 loc) · 9.96 KB
/
serverless.yml
File metadata and controls
307 lines (276 loc) · 9.96 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
frameworkVersion: '3'
# Removes serveless enterprise plugin injection
# See https://www.serverless.com/blog/framework-release-v138-websockets
# org: benoitmarchant
service: oh-my-plum-appointment-guru
variablesResolutionMode: 20210326
# Load environment variables from .env files (default: false)
# See https://www.serverless.com/framework/docs/environment-variables
useDotenv: true
package:
individually: false
excludeDevDependencies: false
patterns:
- '!~/**'
- '!tools/**'
- '!test/**'
- '!builds/**'
- '!dev/**'
- '!.vscode/**'
- '!node_modules/mod/demo/**'
- '!node_modules/mod/.git/**'
- '!node_modules/mod/ui/**'
- '!node_modules/mod/test/**'
- '!node_modules/mod/testing/**'
- '!node_modules/mod/tools/**'
- '!node_modules/mod/node_modules/**'
- '!node_modules/mod/.vscode/**'
- '!node_modules/business-data.mod/dev/**'
- '!node_modules/business-data.mod/test/**'
- '!node_modules/business-data.mod/sandbox/**'
- '!node_modules/business-data.mod/node_modules/**'
- '!node_modules/business-data.mod/.git/**'
- '!node_modules/business-data.mod/.vscode/**'
- '!node_modules/geo.mod/ui/**'
- '!node_modules/geo.mod/test/**'
- '!node_modules/geo.mod/.git/**'
- '!node_modules/local-websocket-server/**'
- '!node_modules/serverless/**'
- '!node_modules/serverless-offline/**'
- '!node_modules/serverless-plugin-common-excludes/**'
- '!node_modules/serverless-plugin-include-dependencies/**'
- '!node-build*'
- '!node_modules/@aws-sdk/**/dist-es/**'
- '!node_modules/@aws-sdk/**/dist-types/**'
- 'node_modules/uuid/**'
include:
- node_modules/uuid/**
- "!dev/**"
exclude:
- ~/**
# - node_modules/**/**.ts
- builds/**
# - dev/**
- node-build*/**
- test/**
- tools/**
- tmp/**
- .vscode/**
# Manual dev dependencies
# - node_modules/http-server/**
# - node_modules/webpack/**
# - node_modules/local-websocket-server/**
# - node_modules/serverless/**
# - node_modules/serverless-apigw-binary/**
# - node_modules/serverless-dotenv-plugin/**
# - node_modules/serverless-offline/**
# - node_modules/serverless-plugin-common-excludes/**
# - node_modules/serverless-plugin-include-dependencies/**
# - node_modules/serverless-plugin-package-size/**
# - node_modules/serverless-webpack/**
# - node_modules/@aws-sdk/**/dist-es/**
# - node_modules/@aws-sdk/**/dist-types/**
- node_modules/mod/.git/**
- node_modules/mod/.vscode/**
- node_modules/mod/demo/**
- node_modules/mod/ui/**
- node_modules/mod/test/**
- node_modules/mod/testing/**
- node_modules/mod/tools/**
# - node_modules/mod/window-loader/**
- node_modules/geo.mod/.git/**
- node_modules/geo.mod/test/**
- node_modules/geo.mod/ui/**
- node_modules/business-data.mod/.git/**
- node_modules/business-data.mod/.vscode/**
- node_modules/business-data.mod/dev/**
- node_modules/business-data.mod/sandbox/**
- node_modules/business-data.mod/test/**
- node_modules/business-data.mod/ui/**
- node_modules/local-websocket-server/**
- node_modules/serverless/**
- node_modules/serverless-offline/**
- node_modules/serverless-plugin-include-dependencies/**
- vscode-profile-**
- ./**.cpuprofile
#setup for environements and accounts to use so we cand do
# $ serverless deploy --stage mod
# $ serverless deploy --stage test
# $ serverless deploy --stage prod
# more at https://serverless-stack.com/chapters/configure-multiple-aws-profiles.html
custom:
myCategory: dental
myOrganization: cogent-design
myDomain: oh.my-plum-appointment.guru
myStage: ${opt:stage, self:provider.stage}
myRegion: ${opt:region, self:provider.region}
myPhrontDeskDomainName: ${self:service}.${self:custom.myOrganization}.${self:custom.myCategory}.app.phrontier.live
myMainWorkerWebsocketDomainName: connect.${self:service}.${self:custom.myOrganization}.${self:custom.myCategory}.app.phrontier.live
myMainWorkerHttpDomainName: send.${self:service}.${self:custom.myOrganization}.${self:custom.myCategory}.phrontier.live
myStagePhrontDeskDomainName:
mod: ${self:custom.myStage}.${self:custom.myPhrontDeskDomainName}
test: ${self:custom.myStage}.${self:custom.myPhrontDeskDomainName}
live: ${self:custom.myPhrontDeskDomainName}
myStageMainWorkerWebsocketDomainName:
mod: ${self:custom.myStage}.${self:custom.myMainWorkerWebsocketDomainName}
test: ${self:custom.myStage}.${self:custom.myMainWorkerWebsocketDomainName}
live: ${self:custom.myMainWorkerWebsocketDomainName}
myStageMainWorkerHttpDomainName:
mod: ${self:custom.myStage}.${self:custom.myMainWorkerHttpDomainName}
test: ${self:custom.myStage}.${self:custom.myMainWorkerHttpDomainName}
live: ${self:custom.myMainWorkerHttpDomainName}
myProfile:
mod: cogent-mod
test: cogent-test
live: cogent-live
myAccount:
mod: 006408448862
test: 545740467277
live: 540973189736
myRole:
mod: arn:aws:iam::006408448862:role/lambda-runner
test: arn:aws:iam::545740467277:role/lambda-runner
live: arn:aws:iam::540973189736:role/lambda-runner
myCfnRole:
mod: arn:aws:iam::006408448862:role/cloudformation-manager
test: arn:aws:iam::545740467277:role/cloudformation-manager
live: arn:aws:iam::540973189736:role/cloudformation-manager
serverless-offline:
httpPort: 4000
websocketPort: 3001
lambdaPort: 4002
distill:
include:
- 'node_modules/mod/core/date/time-zone-data'
minifyPatterns:
- 'node_modules/**'
- '!node_modules/mod/**'
- '!node_modules/geo.mod/**'
- '!node_modules/business-data.mod/**'
# - '!*/**'
s3Sync:
# A simple configuration for copying static assets
- bucketName: ${self.custom.myPhrontDeskDomainName} # required
#bucketPrefix: assets/ # optional
localDir: builds/plum-appointments # required
# localDir: / # required
deleteRemoved: false # optional, indicates whether sync deletes files no longer present in localDir. Defaults to 'true'
#acl: public-read # optional
followSymlinks: true # optional
#defaultContentType: text/html # optional
params: # optional
- index.html:
CacheControl: 'public, must-revalidate, proxy-revalidate, max-age=0'
- "*.js":
CacheControl: 'public, max-age=31536000'
#bucketTags: # optional, these are appended to existing S3 bucket tags (overwriting tags with the same key)
# tagKey1: tagValue1
# tagKey2: tagValue2
customDomains:
- websocket:
domainName: ${self:custom.myStageMainWorkerWebsocketDomainName.${self:custom.myStage}}
stage: ${self:custom.myStage}
basePath: ''
certificateName: '*.phrontier.live'
createRoute53Record: true
createRoute53IPv6Record: true
endpointType: 'regional'
securityPolicy: tls_1_2
- http:
domainName: ${self:custom.myStageMainWorkerHttpDomainName.${self:custom.myStage}}
stage: ${self:custom.myStage}
basePath: ''
certificateName: '*.phrontier.live'
createRoute53Record: true
createRoute53IPv6Record: true
endpointType: 'regional'
securityPolicy: tls_1_2
prune:
automatic: true
includeLayers: true
number: 3
provider:
name: aws
runtime: nodejs14.x
lambdaHashingVersion: 20201221
stage: mod
profile: ${self:custom.myProfile.${self:custom.myStage}}
role: ${self:custom.myRole.${self:custom.myStage}}
cfnRole: ${self:custom.myCfnRole.${self:custom.myStage}} # ARN of an IAM role for CloudFormation service. If specified, CloudFormation uses the role's credentials
region: us-west-2 # Overwrite the default region used. Default is us-east-1
websocketsApiName: connect.${self:service}
websocketsApiRouteSelectionExpression: $request.body.action # custom routes are selected by the value of the action property in the body
environment:
APIG_ENDPOINT:
Fn::Join:
- ''
- - Ref: WebsocketsApi
- .execute-api.
# - Ref: AWS::Region
- ${self:custom.myRegion}
- .amazonaws.com/
- ${self:custom.myStage}
httpApi:
name: send.${self:service}
# Disable the default 'execute-api' HTTP endpoint (default: false)
# Useful when using a custom domain.
disableDefaultEndpoint: true
# Enable CORS HTTP headers with default settings (allow all)
# Can be fine-tuned with specific options
cors: true
authorizers:
authorizeSend:
type: request
functionName: authorizeSend
identitySource:
- $request.querystring.session
functions:
connect:
handler: main.connect
events:
- websocket:
route: $connect # authorizers are only for connect routes
authorizer: # references the auth function below
name: authorize
# resultTtlInSeconds: 3600
identitySource:
- 'route.request.querystring.session'
authorize:
handler: main.authorize
default:
handler: main.default
events:
- websocket:
route: $default
authorizeSend:
handler: main.authorizeSend
send:
handler: main.send
events:
- httpApi:
path: /
method: POST
authorizer:
name: authorizeSend
# type: request
# identitySource:
# - 'method.request.querystring.session'
disconnect:
handler: main.disconnect
events:
- websocket:
route: $disconnect
# auth:
# handler: handler.auth
authenticate:
handler: main.authenticate
events:
- httpApi:
path: /authenticate
method: POST
plugins:
- serverless-plugin-common-excludes
- distill
- serverless-domain-manager
- serverless-offline
- serverless-s3-sync