forked from tatsuiman/slack-copilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
130 lines (121 loc) · 3.38 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
service: open-slack-ai
useDotenv: true
provider:
name: aws
runtime: python3.8
region: ap-northeast-1
stage: ${opt:stage, 'dev'}
logRetentionInDays: 7
ecr:
images:
slack-ai:
file: Dockerfile
path: ./src
platform: linux/amd64
environment:
LOG_LEVEL: 'info'
TEST_USER: ${env:TEST_USER}
BASE_MODEL: ${env:BASE_MODEL}
HEAVY_MODEL: ${env:HEAVY_MODEL}
NOTION_SECRET: ${env:NOTION_SECRET}
DATABASE_ID: ${env:DATABASE_ID}
SENTRY_DSN: ${env:SENTRY_DSN}
GITHUB_TOKEN: ${env:GITHUB_TOKEN}
GITHUB_ORG: ${env:GITHUB_ORG}
GOOGLE_CSE_ID: ${env:GOOGLE_CSE_ID}
GOOGLE_API_KEY: ${env:GOOGLE_API_KEY}
INTELX_API_KEY: ${env:INTELX_API_KEY}
SLACK_SIGNING_SECRET: ${env:SLACK_SIGNING_SECRET}
SLACK_BOT_TOKEN: ${env:SLACK_BOT_TOKEN}
SLACK_USER_TOKEN: ${env:SLACK_USER_TOKEN}
AWS_SNS_TOPIC_ARN: { "Ref" : "SlackAITopic" }
DB_USERS_TABLE: ${self:service}-${opt:stage, self:provider.stage}-slack-users
DB_MESSAGE_TABLE: ${self:service}-${opt:stage, self:provider.stage}-slack-message
iamRoleStatements:
- Effect: Allow
Action:
- sns:Publish
Resource: { "Ref" : "SlackAITopic" }
- Effect: Allow
Action:
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:Query
- dynamodb:Scan
- dynamodb:DeleteItem
Resource: "*"
functions:
slackai-handler:
timeout: 30
memorySize: 254
maximumEventAge: 21600
maximumRetryAttempts: 0
image:
name: slack-ai
command: app.handler
events:
- http:
path: /
method: post
integration: lambda-proxy
slackai-processor:
timeout: 500
memorySize: 512
maximumEventAge: 21600
maximumRetryAttempts: 0
image:
name: slack-ai
command: main.handler
events:
- sns:
arn:
Fn::Join:
- ':'
- - 'arn:aws:sns'
- Ref: 'AWS::Region'
- Ref: 'AWS::AccountId'
- ${self:service}-${opt:stage, self:provider.stage}-slack-message
topicName: ${self:service}-${opt:stage, self:provider.stage}-slack-message
resources:
Resources:
SlackAITopic:
Type: AWS::SNS::Topic
Properties:
TopicName: ${self:service}-${opt:stage, self:provider.stage}-slack-message
SlackUsersTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:service}-${opt:stage, self:provider.stage}-slack-users
AttributeDefinitions:
- AttributeName: user_id
AttributeType: S
KeySchema:
- AttributeName: user_id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
SlackMessageTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:service}-${opt:stage, self:provider.stage}-slack-message
AttributeDefinitions:
- AttributeName: doc_id
AttributeType: S
KeySchema:
- AttributeName: doc_id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
custom:
apiGatewayThrottling:
maxRequestsPerSecond: 5
maxConcurrentRequests: 10
prune:
automatic: true
number: 3
plugins:
- serverless-api-gateway-throttling
- serverless-prune-plugin