-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
108 lines (103 loc) · 2.67 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
org: tormozz48
app: football-chat-bot-aws
service: football-chat-bot-aws
frameworkVersion: '3'
custom:
serviceName: ${self:service}
stage: ${sls:stage}
tableName: 'events-table-${sls:stage}'
dynamodb:
stages:
- dev
start:
port: 8000
docker: true
sharedDb: true
inMemory: false
migrate: true
seed: false
noStart: false
convertEmptyValues: true
dockerImage: amazon/dynamodb-local
plugins:
- serverless-jest-plugin
- serverless-dynamodb-local
- serverless-plugin-typescript
- serverless-offline
provider:
name: aws
runtime: nodejs20.x
versionFunctions: false
tracing:
lambda: true
environment:
SERVICE_NAME: ${self:custom.serviceName}
STAGE: ${self:custom.stage}
EVENTS_TABLE: ${self:custom.tableName}
TELEGRAM_BOT_TOKEN: ${param:telegramBotToken}
TELEGRAM_BOT_WEBHOOK_URL: ${param:telegramBotWebhookUrl}
VK_TOKEN: ${param:vkToken}
VK_CONFIRMATION: ${param:vkConfirmation}
# uncomment for run tests
# TELEGRAM_BOT_TOKEN: telegram-bot-test-token-12345
# TELEGRAM_BOT_WEBHOOK_URL: http://telegram.bot.webhook.url
# VK_TOKEN: vk-test-token-12345
# VK_CONFIRMATION: confirmation-12345
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource:
- Fn::GetAtt: [EventsTable, Arn]
- Effect: Allow
Action:
- lambda:InvokeFunction
Resource:
- arn:aws:lambda:*
functions:
telegram:
handler: src/handlers/telegram.handler
events:
- httpApi:
path: /telegram
method: post
vk:
handler: src/handlers/vk.handler
events:
- httpApi:
path: /vk/callback
method: post
eventAdd:
handler: src/actions/event-add.eventAdd
eventInfo:
handler: src/actions/event-info.eventInfo
eventRemove:
handler: src/actions/event-remove.eventRemove
memberAdd:
handler: src/actions/member-add.memberAdd
memberRemove:
handler: src/actions/member-remove.memberRemove
resources:
Resources:
EventsTable:
Type: 'AWS::DynamoDB::Table'
Properties:
TableName: ${self:custom.tableName}
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: chatId
AttributeType: N
- AttributeName: eventDate
AttributeType: N
KeySchema:
- AttributeName: chatId
KeyType: HASH
- AttributeName: eventDate
KeyType: RANGE