-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathserverless.yml
120 lines (115 loc) · 3.73 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
service: bundlewatch-service
frameworkVersion: '3'
plugins:
- serverless-dynamodb-local
- serverless-domain-manager
- serverless-git-info
- serverless-offline # must be last
custom:
stage: ${opt:stage, 'dev'}
storeTable: '${self:service}-store-table-${self:custom.stage}'
dynamodb:
start:
port: 8000
migrate: true
inMemory: true
githubClientId:
dev: '04fcf325dd26ca2a159f'
stage: '04fcf325dd26ca2a159f'
prod: '04fcf325dd26ca2a159f'
githubClientSecret:
dev: ${env:GITHUB_CLIENT_SECRET}
stage: ${env:GITHUB_CLIENT_SECRET}
prod: ${env:GITHUB_CLIENT_SECRET}
customDomain:
domainName: service.bundlewatch.io
basePath: ''
stage: ${self:custom.stage}
createRoute53Record: true
endpointType: regional
apiType: http
gitSha1: ${git:sha1} # git rev-parse --short HEAD
provider:
name: aws
region: us-east-1
runtime: nodejs20.x
memorySize: 512
timeout: 29
iam:
role:
statements:
- Effect: Allow
Action:
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
- dynamodb:DescribeTable
Resource:
- { 'Fn::GetAtt': ['StoreTable', 'Arn'] }
environment:
STORE_TABLE: ${self:custom.storeTable}
GITHUB_CLIENT_ID: ${self:custom.githubClientId.${self:custom.stage}}
GITHUB_CLIENT_SECRET: ${self:custom.githubClientSecret.${self:custom.stage}}
GIT_SHA1: ${self:custom.gitSha1}
functions:
expressRouter:
handler: src/router/index.app
events:
- httpApi:
path: /
method: get
- httpApi:
path: /store
method: post
- httpApi:
path: /store/lookup
method: post
- httpApi:
path: /setup-github
method: get
- httpApi:
path: /results
method: get
- httpApi:
path: /static/results-styles.css
method: get
- httpApi:
path: /static/setup-github-styles.css
method: get
- httpApi:
path: /analyze
method: post
resources:
Resources:
StoreTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
- AttributeName: repo
AttributeType: S
- AttributeName: repoBranch
AttributeType: S
- AttributeName: timestamp
AttributeType: S
KeySchema:
- AttributeName: repo
KeyType: HASH
- AttributeName: repoBranch
KeyType: RANGE
LocalSecondaryIndexes:
- IndexName: timestamp
KeySchema:
- AttributeName: repo
KeyType: HASH
- AttributeName: timestamp
KeyType: RANGE
Projection:
ProjectionType: KEYS_ONLY
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:custom.storeTable}