This repository has been archived by the owner on Jul 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
182 lines (173 loc) · 5.07 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
service: graphapi
provider:
name: aws
runtime: nodejs12.x
stage: ${opt:stage, 'dev'}
timeout: 20
region: eu-west-1
vpc:
securityGroupIds:
- ${ssm:/API/SecurityGroup}
subnetIds:
- ${ssm:/API/Subnet}
iamRoleStatements:
- Effect: 'Allow'
Action:
- 'sns:Publish'
Resource:
- ${ssm:/email/SNS/arn}
- ${ssm:/SNS/cache_query/arn}
- ${ssm:/resize/SNS/arn}
- Effect: Allow
Action:
- dynamodb:*
Resource:
- ${ssm:/dynamodb/redirects/arn}
- ${ssm:/dynamodb/conversations/arn}
- ${ssm:/dynamodb/connections/arn}
- ${ssm:/dynamodb/audit/arn}
- Effect: Allow
Action:
- execute-api:Invoke
Resource:
- arn:aws:execute-api:eu-west-1:312104790015:stzj06gng1/msg/*
- Effect: Allow
Action:
- states:StartExecution
Resource:
- ${ssm:/email/msgSF/arn}
- Effect: Allow
Action:
- states:StopExecution
Resource:
- arn:aws:states:*:*:execution:MsgBufferStateMachine:*
- Effect: Allow
Action:
- s3:*
Resource:
- ${ssm:/s3/user_media/arn}
environment:
stage: ${self:provider.stage}
PUBLIC_KEY: ${ssm:/API/PublicKey}
PRIVATE_KEY: ${ssm:/API/PrivateKey~true}
APOLLO_KEY: ${ssm:/API/ApolloKey~true}
MAILGUN_KEY: ${ssm:/API/MailgunKey~true}
OAUTH_CLIENT_ID: ${ssm:/API/OAuth/ClientId}
OAUTH_CLIENT_SECRET: ${ssm:/API/OAuth/ClientSecret~true}
CALENDAR_ID: ${ssm:/API/CalendarId}
CALENDAR_REFRESH_TOKEN: ${ssm:/API/CalendarRefreshToken~true}
AWS_KEY_ID: ${ssm:/API/AwsKeyId}
AWS_KEY_SECRET: ${ssm:/API/AwsKeySecret~true}
BUCKET_NAME: ${ssm:/API/ProfilePictures/BucketName}
BUCKET_URL: ${ssm:/API/ProfilePictures/BucketUrl}
DEV_PASSWORD: ${ssm:/API/DevPassword~true}
WHEREBY_API_TOKEN: ${ssm:/API/WherebyToken~true}
EMAIL_SNS: ${ssm:/email/SNS/arn}
MSG_EMAIL_SF_ARN: ${ssm:/email/msgSF/arn}
EMAIL_SECRET: ${ssm:/email/secret~true}
ASSET_BUCKET: ${ssm:/S3/assets/bucketUrl}
CACHE_SNS_ARN: ${ssm:/SNS/cache_query/arn}
USER_MEDIA_BUCKET: ${ssm:/s3/user_media/name}
ASSET_CDN: https://d1misjhz20pz2i.cloudfront.net/
IMG_SNS: ${ssm:/resize/SNS/arn}
IMG_ENDPOINT: ${ssm:/resize/endpoint}
IMG_SECRET: ${ssm:/resize/secret~true}
DB_HOST: ${ssm:/DB/Host}
DB_PROXY_HOST: ${ssm:/DB/Proxy/Host}
DB_PORT: ${ssm:/DB/Port}
DB_NAME: ${ssm:/DB/Name}
DB_USER: ${ssm:/API/DB/User}
DB_PASSWORD: ${ssm:/API/DB/Password~true}
DD_API_KEY: ${ssm:/API/Datadog/ApiKey}
DD_SERVICE: ${file(./sls.conf.js):DD_SERVICE}
DD_FLUSH_TO_LOG: ${file(./sls.conf.js):DD_FLUSH}
DD_ENHANCED_METRICS: ${file(./sls.conf.js):DD_ENHANCED}
DD_LOGS_INJECTION: ${file(./sls.conf.js):DD_LOG_INJECT}
DD_ENV: ${file(./sls.conf.js):DD_ENV}
GATEWAY: ${file(./sls.conf.js):GATEWAY}
functions:
graphapi:
handler: src/handler.graphapi
provisionedConcurrency: ${file(./sls.conf.js):PROVISIONED}
layers:
- arn:aws:lambda:eu-west-1:464622532012:layer:Datadog-Node12-x:23
events:
- http:
path: /
method: post
cors:
origins:
- https://upframe.io
- https://beta.upframe.io
allowCredentials: true
- http:
path: /
method: get
cors:
origins:
- https://upframe.io
- https://beta.upframe.io
allowCredentials: true
wsConnect:
handler: src/messaging/handler.wsConnect
layers:
- arn:aws:lambda:eu-west-1:464622532012:layer:Datadog-Node12-x:23
events:
- websocket:
route: $connect
- websocket:
route: $disconnect
- websocket:
route: $default
dbEvent:
handler: src/messaging/handler.dbEvent
layers:
- arn:aws:lambda:eu-west-1:464622532012:layer:Datadog-Node12-x:23
events:
- stream:
enabled: true
type: dynamodb
batchSize: 1
maximumRetryAttempts: 3
startingPosition: LATEST
arn: ${ssm:/dynamodb/conversations/stream/arn}
tableName: conversations
plugins:
- serverless-webpack
- serverless-offline-dynamodb-streams
- serverless-offline
- serverless-domain-manager
custom:
serverless-offline:
port: 5000
stage: offline
webpack:
includeModules:
forceExclude:
- aws-sdk
- datadog-lambda-js
- chalk
- mssql
- mysql
- mysql2
- sqlite3
- '@types'
packagerOptions:
scripts:
- rm -rf node_modules/@types && curl -sf https://gobinaries.com/tj/node-prune | sh && node-prune
customDomain:
RestApiId:
Ref: ApiGatewayRestApi
domainName: ${file(./sls.conf.js):DOMAIN}
endpointType: 'regional'
stage: ${opt:stage}
createRoute53Record: false
serverless-offline-sns:
port: 4002
debug: true
serverless-offline-dynamodb-streams:
apiVersion: '2013-12-02'
endpoint: http://0.0.0.0:8000
region: eu-west-1
skipCacheInvalidation: false
readInterval: 500