forked from shalvah/DownloadThisVideo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
195 lines (183 loc) · 4.26 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
org: patriotsa4
app: twitter-video-link-extractor
service: twitter-video-link-extractor
plugins:
- serverless-dotenv-plugin
- serverless-plugin-aws-alerts
provider:
name: aws
region: eu-central-1
runtime: nodejs10.x
stage: beta
memorySize: 512
timeout: 6
logRetentionInDays: 30
iamRoleStatements:
- Effect: Allow
Action:
- sns:Publish
Resource:
- "Fn::Join":
- ':'
- - "arn:aws:sns:eu-central-1"
- Ref: AWS::AccountId
- "newMention"
- Effect: Allow
Action:
- ec2:DescribeNetworkInterfaces
- ec2:CreateNetworkInterface
- ec2:DeleteNetworkInterface
- ec2:DescribeInstances
- ec2:AttachNetworkInterface"
- 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}
TWITTER_CALLBACK_URL: ${env:TWITTER_CALLBACK_URL}
REDIS_URL: ${env:REDIS_URL}
REDIS_PASSWORD: ${env:REDIS_PASSWORD}
TWITTER_SCREEN_NAME: ${env:TWITTER_SCREEN_NAME}
EXTERNAL_URL: ${env:EXTERNAL_URL}
GTAG_ID: ${env:GTAG_ID}
AD_CODE: ${env:AD_CODE}
TOPIC_ARN:
"Fn::Join":
- ':'
-
- "arn:aws:sns:eu-central-1"
- Ref: AWS::AccountId
- "newMention"
package:
include:
- views/**
exclude:
- "*.md"
- "*.png"
- "*.ico"
- .*
- .*/**
- awscli-bundle.zip
- awscli-bundle/**
- spec/**
- assets/*.png
functions:
fetchTweetsToDownload:
handler: handler.fetchTweetsToDownload
vpc:
securityGroupIds:
- sg-c0ac1fb8
subnetIds:
- subnet-12139078
events:
- schedule: rate(1 minute)
alarms:
- functionErrors
- name: functionDuration
threshold: 5000
retryFailedTasks:
handler: handler.retryFailedTasks
sendDownloadLink:
handler: handler.sendDownloadLink
vpc:
securityGroupIds:
- sg-c0ac1fb8
subnetIds:
- subnet-12139078
events:
- sns: newMention
alarms:
- functionErrors
- name: functionDuration
threshold: 5000
startTwitterSignIn:
handler: handler.startTwitterSignIn
events:
- http:
path: /_/starttwittersignin
method: get
completeTwitterSignIn:
handler: handler.completeTwitterSignIn
events:
- http:
path: /_/completetwittersignin
method: get
request:
parameters:
querystrings:
username: true
action: false
fbtoken: false
page:
handler: handler.page
vpc:
securityGroupIds:
- sg-c0ac1fb8
subnetIds:
- subnet-12139078
events:
- http:
path: /p/{page}
method: get
request:
parameters:
paths:
page: true
getDownloadsOrStaticFiles:
handler: handler.getDownloadsOrStaticFiles
vpc:
securityGroupIds:
- sg-c0ac1fb8
subnetIds:
- subnet-12139078
#events:
# - http:
# path: /{username}
# method: get
# request:
# parameters:
# paths:
# username: true
alarms:
- functionErrors
- name: functionDuration
threshold: 2000
getHomePage:
handler: handler.getHomePage
vpc:
securityGroupIds:
- sg-c0ac1fb8
subnetIds:
- subnet-12139078
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: [email protected]