-
Notifications
You must be signed in to change notification settings - Fork 3
/
serverless.yml
114 lines (105 loc) · 3.51 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
service: snbot
provider:
name: aws
runtime: nodejs8.10
stage: ${opt:stage, 'dev'}
region: us-east-1
memorySize: 256
variables: ${file(secret-${self:provider.stage}.yml)}
deploymentBucket: snbot-sls-deploy
timeout: 60 # 60 seconds
tracing: true
environment:
NODE_ENV: ${self:provider.variables.NODE_ENV}
FB_PAGE_TOKEN: ${self:provider.variables.FB_PAGE_TOKEN}
FB_VERIFY_TOKEN: ${self:provider.variables.FB_VERIFY_TOKEN}
FB_USERNAME: ${self:provider.variables.FB_USERNAME}
TVDB_API_KEY: ${self:provider.variables.TVDB_API_KEY}
TRAKT_API_KEY: ${self:provider.variables.TRAKT_API_KEY}
WITAI_TOKEN: ${self:provider.variables.WITAI_TOKEN}
FAN_ART_API_KEY: ${self:provider.variables.FAN_ART_API_KEY}
THE_MOVIE_DB_API_KEY: ${self:provider.variables.THE_MOVIE_DB_API_KEY}
DEBUG: 'dispatch-notif:*'
iamRoleStatements:
- Effect: 'Allow' # xray permissions (required)
Action:
- 'xray:PutTraceSegments'
- 'xray:PutTelemetryRecords'
Resource:
- '*'
- Effect: 'Allow'
Action:
- 'lambda:InvokeFunction'
Resource:
Fn::Join:
- ':'
- - 'arn:aws:lambda'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'function'
- '${self:service}-${self:provider.stage}-*'
- Effect: 'Allow'
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
Fn::Join:
- ':'
- - 'arn:aws:dynamodb'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- 'table/*'
# you can add packaging information here
package:
individually: true
exclude:
- '*/**'
functions:
messengerEntryPoint:
handler: src/messenger-entry-function/index.handler
description: The main entry point for FB Messenger, whatever a user sends to the Messenger, it is forwarded here by the Messenger Platform
events:
- http:
path: webhook
method: get
- http:
path: webhook
method: post
messengerReply:
handler: src/messenger-reply-function/index.handler
description: Whenver the bot wants to reply something, this function converts it into messenger friendly format and sends
processQuery:
handler: src/process-query-function/index.handler
description: The actual brain of the Series Notifier bot
notificationCron:
handler: src/cron/dispatch-notif.main
description: A cron that sends notifications to users when an episode is live
events:
- schedule:
name: series-notifier-dispatch-notif-cron-${self:provider.stage}
description: A cron that sends notifications to users when an episode is live
rate: rate(15 minutes)
nextEpCacheUpdateCron:
handler: src/cron/update-next-episode-cache.main
description: A cron that updates the cache in DB of Next Episode Cache model
events:
- schedule:
name: series-notifier-update-next-episode-cache-cron-${self:provider.stage}
description: A cron that updates the cache in DB of Next Episode Cache model
rate: rate(12 hours)
plugins:
- serverless-webpack
- serverless-offline
- serverless-plugin-tracing
custom:
stage: ${opt:stage, self:provider.stage}
webpack:
packager: 'yarn' # Defaults to npm
keepOutputDirectory: true
builtAssetIncludeGlob: '**/*.{js,json}'
serverless-offline:
location: ./.webpack/service