-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
111 lines (105 loc) · 3.32 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
service: granola-scraper
provider:
name: aws
runtime: nodejs8.10
stage: dev
stackName: granola-stack
# profile: production
memorySize: 3008
versionFunctions: true
environment:
queueTableName: granola-queue
dataTableName: granola-data
productsTableName: granola-products
chromeBucketName: granola-chromium
chromeFileName: headless_shell.tar.gz
defaultLoadTimeout: 5000
infiniteScrollTimeout: 5000
selectorTimeout: 2000
package:
exclude:
- node_modules/@serverless-chrome/**
- node_modules/puppeteer/.local-chromium/**
- chrome/**
functions:
granolaScraper-main:
handler: src/main-lambda.handler
description: scheduled event handler
timeout: 90
events:
- schedule:
name: daily
rate: rate(24 hours)
enabled: false #true
granolaScraper-product:
handler: src/product-lambda.handler
description: ddb event stream handler
timeout: 90
events:
- stream:
type: dynamodb
arn: arn:aws:dynamodb:us-east-1:809220820577:table/granola-queue/stream/2018-07-06T04:12:05.714
batchSize: 1
startingPosition: LATEST
enabled: true
resources:
Resources:
granolaQueue:
Type: AWS::DynamoDB::Table
Properties:
TableName: granola-queue
AttributeDefinitions:
- AttributeName: date
AttributeType: S
- AttributeName: url
AttributeType: S
KeySchema:
- AttributeName: date
KeyType: HASH
- AttributeName: url
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
# event stream
granolaData:
Type: AWS::DynamoDB::Table
Properties:
TableName: granola-data
AttributeDefinitions:
- AttributeName: key
AttributeType: S
- AttributeName: price
AttributeType: S
KeySchema:
- AttributeName: key
KeyType: HASH
- AttributeName: price
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
granolaProducts:
Type: AWS::DynamoDB::Table
Properties:
TableName: granola-products
AttributeDefinitions:
- AttributeName: url
AttributeType: S
KeySchema:
- AttributeName: url
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
plugins:
- serverless-plugin-typescript
- serverless-dynamodb-local
- serverless-offline
custom:
chrome:
flags:
- --window-size=400,400
- --hide-scrollbars
functions:
- granolaScraper