-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
153 lines (148 loc) · 4.04 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
service: reverb-feedboost
custom:
stage: ${opt:stage, self:provider.stage}
plugins:
- files
- serverless-offline
provider:
name: aws
runtime: nodejs12.x
stage: dev
region: us-east-1
environment:
APP_NAME: FeedBoost
NODE_ENV: ${self:custom.stage}
APP_EMAIL: ${env:APP_EMAIL_${self:custom.stage}}
REVERB_HOST: ${env:REVERB_HOST_${self:custom.stage}}
REVERB_KEY: ${env:REVERB_KEY_${self:custom.stage}}
REVERB_SECRET: ${env:REVERB_SECRET_${self:custom.stage}}
REVERB_REDIRECT_PATH: ${env:REVERB_REDIRECT_PATH_${self:custom.stage}}
FILES_URL: ${env:FILES_URL_${self:custom.stage}}
BASE_URI: ${env:BASE_URI_${self:custom.stage}}
JWT_SECRET: ${env:JWT_SECRET_${self:custom.stage}}
CRYPTR_KEY: ${env:CRYPTR_KEY_${self:custom.stage}}
ALLOWED_USERS: ${env:ALLOWED_USERS_${self:custom.stage}}
iamRoleStatements:
- Effect: "Allow"
Action:
- "dynamodb:GetItem"
- "dynamodb:Query"
- "dynamodb:UpdateItem"
- "dynamodb:DeleteItem"
- "dynamodb:Scan"
- "dynamodb:GetRecords"
- "dynamodb:GetShardIterator"
- "dynamodb:DescribeStream"
- "dynamodb:ListStreams"
Resource:
- "arn:aws:dynamodb:us-east-1:*:table/feedboostUser_${opt:stage}"
- "arn:aws:dynamodb:us-east-1:*:table/feedboostUser_${opt:stage}/index/*"
- "arn:aws:dynamodb:us-east-1:*:table/feedboostUser_${opt:stage}/stream/*"
- Effect: "Allow"
Action:
- "ses:SendEmail"
Resource:
- "arn:aws:ses:us-east-1:*:identity/*"
functions:
apphome:
handler: lib/handlers/app.home
events:
- http:
path: /
method: get
appsub:
handler: lib/handlers/app.subscribe
events:
- http:
path: subscribe
method: get
- http:
path: login
method: get
appunsub:
handler: lib/handlers/app.unsubscribe
events:
- http:
path: unsubscribe/{hash}
method: post
appauth:
handler: lib/handlers/app.auth
events:
- http:
path: subscribe/success
method: get
logout:
handler: lib/handlers/app.logout
events:
- http:
path: logout
method: get
feedcheck:
handler: lib/handlers/feed.check
events:
- schedule: rate(1 hour)
migrate:
handler: lib/handlers/migrate.handler
resources:
Resources:
filesDir:
Type: AWS::S3::Bucket
Properties:
BucketName: feedboostassets${opt:stage}
AccessControl: PublicRead
# @TODO: restore pathmapping once it can be deployed reliably.
# pathmapping:
# Type: AWS::ApiGateway::BasePathMapping
# DependsOn:
# - ApiGatewayRestApi
# Properties:
# DomainName: ${file(config-${opt:stage}.yml):domain}
# Stage: ${opt:stage}
# RestApiId:
# Ref: ApiGatewayRestApi
UserDB:
Type: AWS::DynamoDB::Table
Properties:
TableName: feedboostUser_${opt:stage}
StreamSpecification:
StreamViewType: KEYS_ONLY
AttributeDefinitions:
-
AttributeName: email
AttributeType: S
-
AttributeName: code
AttributeType: S
KeySchema:
-
AttributeName: email
KeyType: HASH
GlobalSecondaryIndexes:
-
IndexName: code
KeySchema:
-
AttributeName: code
KeyType: HASH
Projection:
ProjectionType: KEYS_ONLY
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
package:
exclude:
- '.*'
- '**/*.swp'
- '__tests__/**'
- '__coverage__/**'
- 'yarn.lock'
- 'README.md'
- 'node_modules/serverless/**'
- 'node_modules/serverless-offline/**'
- 'node_modules/typescript/**'
- 'node_modules/aws-sdk/**'
- 'node_modules/@serverless/**'
- 'node_modules/@types/**'