-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
105 lines (99 loc) · 2.72 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
service: github-slack-mentions
plugins:
- serverless-python-requirements
- serverless-domain-manager
custom:
default_stage: test
pythonRequirements:
dockerizePip: non-linux
layer: true
customDomain:
domainName: < custom domain name >
basePath: ''
stage: ${self:provider.stage}
createRoute53Record: true
provider:
name: aws
profile: default
runtime: python3.7
stage: dev
region: us-west-2
memorySize: 256
environment:
SLACK_BOT_TOKEN: xoxb-< slack bot token >
SLACK_APP_SIGNING_SECRET: < Slack App Siging token >
GITHUB_SECRET: < github webhook secret >
GH_USERNAME: < GitHub Username >
GH_PAT: < GitHub Password or PAT >
GH_ORG: < GitHub Organization name >
DYNAMODB_TABLE: ${self:service}-${opt:stage, self:provider.stage}
LOG_LEVEL: WARNING
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
- "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
- "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}/index/slack_id"
package:
exclude:
- node_modules/
- tests/
- README.md
- requirements.txt
- package.json
- package-lock.json
include:
- helpers/*.py
- "*.py"
functions:
mentions:
timeout: 6
handler: route_requests.lambda_handler
layers:
- { Ref: PythonRequirementsLambdaLayer }
events:
- http:
path: github-webhook/mentions
method: post
integration: lambda-proxy
reminders:
timeout: 300
handler: reminders.lambda_handler
layers:
- { Ref: PythonRequirementsLambdaLayer }
events:
- schedule: rate(1 hour)
resources:
Resources:
gitusers:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
- AttributeName: ghusername
AttributeType: S
- AttributeName: slack_id
AttributeType: S
KeySchema:
- AttributeName: ghusername
KeyType: HASH
GlobalSecondaryIndexes:
- IndexName: slack_id
KeySchema:
- AttributeName: slack_id
KeyType: HASH
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: '1'
WriteCapacityUnits: '1'
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.DYNAMODB_TABLE}