-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
122 lines (111 loc) · 3.25 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
service: dogpack
provider:
name: aws
runtime: nodejs6.10
stage: ${opt:stage, self:custom.defaultStage}
profile: ${self:custom.profiles.${self:provider.stage}}
memorySize: 256
environment:
DYNAMODB_TABLE_DAYS: ${self:service}-${self:provider.stage}-DAYS
DYNAMODB_TABLE_RSVPS: ${self:service}-${self:provider.stage}-RSVPS
TWITTER_CONSUMER_KEY: ${self:custom.keys.consumer_key}
TWITTER_CONSUMER_SECRET: ${self:custom.keys.consumer_secret}
TWITTER_ACCESS_TOKEN_KEY: ${self:custom.keys.access_token_key}
TWITTER_ACCESS_TOKEN_SECRET: ${self:custom.keys.access_token_secret}
TWITTER_ID: ${self:custom.keys.twitter_id}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
- "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE_DAYS}"
- "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE_RSVPS}"
plugins:
- serverless-plugin-chrome
custom:
defaultStage: dev
profiles:
dev: dogpackDev
prod: dogpackProd
keys: ${file(../dogpack-keys.${self:provider.stage}.json)}
chrome:
functions:
- postReminder
functions:
postReminder:
handler: src/postReminder.default
timeout: 30
memorySize: 512
events:
- schedule:
name: post-reminder
description: 'Post reminder tweet'
rate: cron(0 * * * ? *)
postEvent:
handler: src/postEvent.default
events:
- schedule:
name: post-event
description: 'Post event tweet'
rate: cron(0 * * * ? *)
postRSVPs:
handler: src/postRSVPs.default
events:
- schedule:
name: post-RSVPs
description: 'Tally responses and post update tweet'
rate: cron(0 * * * ? *)
crcHook:
handler: src/crcCheck.default
events:
- http:
path: ${self:custom.keys.webhook_name}
method: get
dmHook:
handler: src/dmHook.default
events:
- http:
path: ${self:custom.keys.webhook_name}
method: post
resources:
Resources:
DaysDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
- AttributeName: Date
AttributeType: S
KeySchema:
- AttributeName: Date
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.DYNAMODB_TABLE_DAYS}
RSVPSDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
- AttributeName: Date
AttributeType: S
- AttributeName: UserID
AttributeType: S
KeySchema:
- AttributeName: Date
KeyType: HASH
- AttributeName: UserID
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.DYNAMODB_TABLE_RSVPS}
package:
exclude:
- scripts/**