-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
101 lines (83 loc) · 2.09 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
service: hoshino
useDotenv: true
plugins:
- serverless-scriptable-plugin
provider:
name: aws
runtime: nodejs20.x
region: ap-northeast-1
stage: dev
memorySize: 512
architecture: arm64
logRetentionInDays: 1
versionFunctions: false
apiGateway:
minimumCompressionSize: 1024 # Enable gzip compression for responses > 1 KB
environment:
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
NODE_OPTIONS: '--enable-source-maps --stack-trace-limit=1000'
AWS_ACCOUNT_ID: ${aws:accountId}
STAGE: ${self:provider.stage}
NODE_ENV: production
REDIS_URL: ${env:REDIS_URL}
WEBSOCKET_URL: ${env:WEBSOCKET_URL}
iam:
role:
statements:
- Effect: "Allow"
Action:
- sqs:SendMessage
Resource:
- arn:aws:sqs:${self:provider.region}:${aws:accountId}:hoshino-${self:provider.stage}-ws
package:
individually: true
patterns:
- "!**"
- "!node_modules/**"
functions:
# 예제 돌릴때 필요
httpMain:
handler: artifact/http_main.dispatch
url: true
package:
patterns:
- artifact/http_main.mjs*
- views/**/*
- static/**/*
events:
- httpApi: ANY /
- httpApi: ANY /{pathname+}
# 관리 편의상 하나에 다 넣음
wsMain:
handler: artifact/ws_main.dispatch
package:
patterns:
- artifact/ws_main.mjs*
events:
- websocket:
route: $connect
- websocket:
route: $disconnect
- websocket:
route: $default
sqsMain:
handler: artifact/sqs_main.dispatch
package:
patterns:
- artifact/sqs_main.mjs*
events:
- sqs:
arn: arn:aws:sqs:${self:provider.region}:${aws:accountId}:hoshino-${self:provider.stage}-ws
batchSize: 1
enabled: false
resources:
Resources:
SQSExampleQueue:
Type: AWS::SQS::Queue
Properties:
QueueName: hoshino-${self:provider.stage}-ws
VisibilityTimeout: 60
MessageRetentionPeriod: 1209600 # 14 days
custom:
scriptHooks:
before:package:createDeploymentArtifacts: pnpm artifact