This repository has been archived by the owner on Jun 25, 2020. It is now read-only.
forked from all-contributors/app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
122 lines (112 loc) · 3.01 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
service: all-contributors-bot
frameworkVersion: ">=1.0.0 <2.0.0"
plugins:
- serverless-dotenv-plugin
- serverless-offline # must be last
# https://serverless.com/framework/docs/providers/aws/guide/packaging/
package:
include:
- 'node_modules/node-fetch/**'
custom:
stage: ${opt:stage, self:provider.stage}
statsBucket: '${self:service}-stats-bucket-${self:custom.stage}'
thundraLayer: 'arn:aws:lambda:us-east-1:269863060030:layer:thundra-lambda-node-layer:9'
appId:
dev: ${env:APP_ID}
sandbox: '24310'
prod: '23186'
logLevel:
dev: debug
sandbox: info
prod: info
sentryDsn:
dev: ''
sandbox: 'https://e950ab524cde4682a740c218c15a461d@sentry.io/1366866'
prod: 'https://e950ab524cde4682a740c218c15a461d@sentry.io/1366866'
provider:
name: aws
region: us-east-1
runtime: nodejs8.10
memorySize: 128
timeout: 6
environment:
APP_ID: ${self:custom.appId.${self:custom.stage}}
LOG_LEVEL: ${self:custom.logLevel.${self:custom.stage}}
SENTRY_DSN: ${self:custom.sentryDsn.${self:custom.stage}}
DISABLE_STATS: true
INSTALLATION_TOKEN_TTL: 3540
WEBHOOK_SECRET: ${env:WEBHOOK_SECRET}
PRIVATE_KEY: ${env:PRIVATE_KEY}
AMPLITUDE_API_KEY: ${env:AMPLITUDE_API_KEY}
SERVICE_NAME_AND_STAGE: 'all-contributors-bot-${opt:stage, self:provider.stage}'
STATS_BUCKET: ${self:custom.statsBucket}
LAMBDA_THUNDRA_API_KEY: ${env:THUNDRA_API_KEY}
iamRoleStatements:
- Effect: Allow
Action:
- lambda:InvokeFunction
Resource: '*'
- Effect: Allow
Action:
- s3:PutObject
- s3:GetObject
Resource: '*'
functions:
githubWebhook:
handler: src/serverless-webhook.handler
events:
- http:
path: /
method: post
cors: true
layers:
- ${self:custom.thundraLayer}
stats:
handler: src/tasks/stats/serverless-stats.handler
events:
- http:
path: /probot/stats
method: get
cors: true
healthCheck:
handler: src/serverless-health-check.handler
events:
- http:
path: /ping
method: get
cors: true
- http:
path: /health-check
method: get
cors: true
# Tasks
processIssueComment:
handler: src/tasks/processIssueComment/serverless-task.handler
memorySize: 512
timeout: 60
layers:
- ${self:custom.thundraLayer}
statsWorker:
handler: src/tasks/stats/serverless-stats-worker.handler
events:
- schedule: cron(0 21 * * ? *)
memorySize: 512
timeout: 900
layers:
- ${self:custom.thundraLayer}
resources:
Resources:
StatsBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${self:custom.statsBucket}
# StatsBucket:
# Type: AWS::S3::BucketPolicy
# Properties:
# BucketName: ${self:custom.statsBucket}
# PolicyDocument:
# - Effect: Allow
# Action:
# - s3:PutObject
# - s3:GetObject
# Resource: '*'