-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
105 lines (88 loc) · 2.63 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: ayane
useDotenv: true
plugins:
- serverless-scriptable-plugin
provider:
name: aws
runtime: nodejs20.x
region: ap-northeast-2
stage: dev
memorySize: 256
architecture: arm64
logRetentionInDays: 1
versionFunctions: false
timeout: 5
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"
STAGE: ${self:provider.stage}
SENTRY_DSN: ${env:SENTRY_DSN}
DISCORD_WEBHOOK_URL: ${env:DISCORD_WEBHOOK_URL}
AYANE_SUPABASE_LABEL: ${env:AYANE_SUPABASE_LABEL}
AYANE_SUPABASE_TYPE: ${env:AYANE_SUPABASE_TYPE}
AYANE_SUPABASE_ARG_1: ${env:AYANE_SUPABASE_ARG_1}
AYANE_REDISLAB_LABEL: ${env:AYANE_REDISLAB_LABEL}
AYANE_REDISLAB_TYPE: ${env:AYANE_REDISLAB_TYPE}
AYANE_REDISLAB_ARG_1: ${env:AYANE_REDISLAB_ARG_1}
AYANE_UPSTASH_REDIS_LABEL: ${env:AYANE_UPSTASH_REDIS_LABEL}
AYANE_UPSTASH_REDIS_TYPE: ${env:AYANE_UPSTASH_REDIS_TYPE}
AYANE_UPSTASH_REDIS_ARG_1: ${env:AYANE_UPSTASH_REDIS_ARG_1}
AYANE_UPSTASH_REDIS_ARG_2: ${env:AYANE_UPSTASH_REDIS_ARG_2}
iam:
role:
statements:
- Effect: "Allow"
Action:
- "dynamodb:GetItem"
- "dynamodb:PutItem"
- "dynamodb:DeleteItem"
- "dynamodb:UpdateItem"
- "dynamodb:BatchWriteItem"
- "dynamodb:Scan"
Resource:
- arn:aws:dynamodb:${self:provider.region}:${aws:accountId}:table/AyaneKeyValue
package:
patterns:
- "!**"
- "!node_modules/**"
- artifact/handlers.mjs*
- views/**/*
functions:
schedule:
handler: artifact/handlers.schedule
events:
# KST 19:00 = UTC 10:00
- schedule: cron(0 10 * * ? *)
http:
handler: artifact/handlers.http
url: true
events:
- httpApi:
method: ANY
path: /
- httpApi:
method: ANY
path: /{pathname+}
resources:
Resources:
KeyValueTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: AyaneKeyValue
AttributeDefinitions:
- AttributeName: label
AttributeType: S
KeySchema:
- AttributeName: label
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
custom:
scriptHooks:
# https://github.com/weixu365/serverless-scriptable-plugin/issues/49#issuecomment-594383342
# serverless-offline 이전에 직접 빌드
before:offline:start:init: pnpm artifact
before:package:createDeploymentArtifacts: pnpm artifact