forked from shalvah/DownloadThisVideo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverless.yml
More file actions
127 lines (118 loc) · 2.74 KB
/
serverless.yml
File metadata and controls
127 lines (118 loc) · 2.74 KB
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
service: DownloadThisVideo
plugins:
- serverless-dotenv-plugin
- serverless-plugin-aws-alerts
provider:
name: aws
runtime: nodejs8.10
stage: beta
memorySize: 128
timeout: 60
logRetentionInDays: 30
iamRoleStatements:
- Effect: Allow
Action:
- sns:Publish
Resource:
- "Fn::Join":
- ':'
- - "arn:aws:sns:us-east-1"
- Ref: AWS::AccountId
- "newMention"
- Effect: Allow
Action:
- cloudwatch:PutMetricData
Resource:
- "*"
environment:
TWITTER_CONSUMER_KEY: ${env:TWITTER_CONSUMER_KEY}
TWITTER_CONSUMER_SECRET: ${env:TWITTER_CONSUMER_SECRET}
TWITTER_ACCESS_TOKEN: ${env:TWITTER_ACCESS_TOKEN}
TWITTER_ACCESS_TOKEN_SECRET: ${env:TWITTER_ACCESS_TOKEN_SECRET}
REDIS_HOSTNAME: ${env:REDIS_HOSTNAME}
REDIS_PORT: ${env:REDIS_PORT}
REDIS_PASSWORD: ${env:REDIS_PASSWORD}
TWITTER_SCREEN_NAME: ${env:TWITTER_SCREEN_NAME}
EXTERNAL_URL: ${env:EXTERNAL_URL}
TOPIC_ARN:
"Fn::Join":
- ':'
-
- "arn:aws:sns:us-east-1"
- Ref: AWS::AccountId
- "newMention"
package:
include:
- views/**
exclude:
- README.md
- .gitignore
- .env
- .env.example
- .idea/**
- .git/**
- this-vid.png
functions:
fetchTweetsToDownload:
handler: handler.fetchTweetsToDownload
events:
- schedule: rate(1 minute)
alarms:
- functionErrors
- name: functionDuration
threshold: 5000
retryFailedTasks:
handler: handler.retryFailedTasks
sendDownloadLink:
handler: handler.sendDownloadLink
events:
- sns: newMention
alarms:
- functionErrors
- name: functionDuration
threshold: 5000
getDownloads:
handler: handler.getDownloads
events:
- http:
path: /{username}
method: get
request:
parameters:
paths:
username: true
alarms:
- functionErrors
- name: functionDuration
threshold: 2000
getHomePage:
handler: handler.getHomePage
events:
- http:
path: /
method: get
alarms:
- functionErrors
- name: functionDuration
threshold: 1000
custom:
alerts:
definitions:
functionErrors:
# alert if function throws an error
threshold: 1
period: 60
treatMissingData: notBreaching
functionDuration:
# alert if function takes more than 2 seconds too many times
threshold: 2000
period: 60
datapointsToAlarm: 10
evaluationPeriods: 30
treatMissingData: notBreaching
topics:
alarm:
topic: ${self:service}-dev-alerts-alarm
notifications:
- protocol: email
endpoint: shalvah.adebayo+awsalerts@gmail.com