forked from open-bot/open-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
143 lines (136 loc) · 3.39 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
# set environment variable AWS_CLIENT_TIMEOUT to increase timeout
service: open-bot-v1
provider:
name: aws
runtime: nodejs12.x
memorySize: 256
stage: dev
region: us-east-1
logRetentionInDays: 14
iamRoleStatements:
- Effect: "Allow"
Resource: "*"
Action:
- "sns:*"
- Effect: "Allow"
Action:
- "*"
Resource: "arn:aws:dynamodb:us-east-1:*:table/open-bot-${opt:stage}-queue"
- Effect: "Allow"
Action:
- "*"
Resource:
- "arn:aws:dynamodb:us-east-1:*:table/open-bot-${opt:stage}-schedule"
- "arn:aws:dynamodb:us-east-1:*:table/open-bot-${opt:stage}-schedule/index/*"
plugins:
- serverless-offline
package:
individually: true
exclude:
- '**'
include:
- lib/node_modules/**
- handlers.js
functions:
processTasks:
handler: handlers.processTasks
timeout: 120
package:
include:
- lib/open-bot-process-tasks/**
- lib/open-bot/**
- lib/open-bot-scheduler/**
- config.json
environment:
STAGE: "${opt:stage}"
events:
- stream:
type: dynamodb
batchSize: 20
startingPosition: TRIM_HORIZON
arn:
Fn::GetAtt:
- QueueDynamoDbTable
- StreamArn
handleGithubEvent:
handler: handlers.handleGithubEvent
package:
include:
- lib/open-bot-handle-github-event/**
- lib/open-bot/**
- config.json
environment:
STAGE: "${opt:stage}"
events:
- http:
path: github
method: POST
timeout: 20
processScheduledTasks:
handler: handlers.processScheduledTasks
timeout: 300
package:
include:
- lib/open-bot-process-scheduled-tasks/**
- config.json
environment:
STAGE: "${opt:stage}"
events:
- schedule: rate(10 minutes)
resources:
Resources:
QueueDynamoDbTable:
Type: "AWS::DynamoDB::Table"
DeletionPolicy: Delete
Properties:
AttributeDefinitions:
-
AttributeName: item
AttributeType: S
KeySchema:
-
AttributeName: item
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
StreamSpecification:
StreamViewType: NEW_IMAGE
TableName: "open-bot-${opt:stage}-queue"
ScheduleDynamoDbTable:
Type: "AWS::DynamoDB::Table"
DeletionPolicy: Delete
Properties:
AttributeDefinitions:
-
AttributeName: item
AttributeType: S
-
AttributeName: epoch
AttributeType: N
-
AttributeName: schedule
AttributeType: N
KeySchema:
-
AttributeName: item
KeyType: HASH
GlobalSecondaryIndexes:
-
IndexName: schedule-index
KeySchema:
-
AttributeName: epoch
KeyType: HASH
-
AttributeName: schedule
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: "open-bot-${opt:stage}-schedule"