-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
140 lines (135 loc) · 3.21 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
131
132
133
134
135
136
137
138
139
140
service: yyt-binary-distribution-api
provider:
name: aws
runtime: nodejs10.x
stage: production
region: ap-northeast-2
tracing:
apiGateway: true
lambda: true
iamRoleStatements:
- Effect: 'Allow'
Action:
- 's3:GetObject'
- 's3:GetObjectAcl'
- 's3:PutObject'
- 's3:PutObjectAcl'
- 's3:DeleteObject'
Resource:
- 'arn:aws:s3:::${env:DIST_BUCKET}/*'
- Effect: 'Allow'
Action:
- 's3:ListBucket'
Resource:
- 'arn:aws:s3:::${env:DIST_BUCKET}'
- Effect: 'Allow'
Action:
- 'cloudfront:CreateInvalidation'
Resource:
- Fn::Join:
- ':'
- - arn:aws:cloudfront
- '' # No region for CloudFront
- Ref: AWS::AccountId
- distribution/${env:DIST_CF_ID}
- Effect: 'Allow'
Action:
- 's3:HeadObject'
- 's3:GetObject'
Resource:
- 'arn:aws:s3:::${env:CONFIG_BUCKET}/*'
environment:
CONFIG_BUCKET: ${env:CONFIG_BUCKET}
DIST_CONFIG_TOKENS: ${env:DIST_CONFIG_TOKENS}
DIST_BUCKET: ${env:DIST_BUCKET}
DIST_DOMAIN: ${env:DIST_DOMAIN}
DIST_API_URL_PREFIX: ${env:DIST_API_URL_PREFIX}
plugins:
- serverless-webpack
- serverless-offline
- serverless-prune-plugin
package:
individually: true
custom:
prune:
automatic: true
number: 7
functions:
createDistribution:
handler: src/put.createDistribution
memorySize: 256
timeout: 5
events:
- http:
path: /{serviceName}/{platform}/{version}
method: put
cors: true
deleteDistribution:
handler: src/put.deleteDistribution
memorySize: 256
timeout: 5
events:
- http:
path: /{serviceName}/{platform}/{version}
method: delete
cors: true
listAllDistributions:
handler: src/get.listAllDistributions
memorySize: 256
timeout: 12
events:
- http:
path: /{serviceName}
method: get
cors: true
listPlatformDistributions:
handler: src/get.listPlatformDistributions
memorySize: 256
timeout: 12
events:
- http:
path: /{serviceName}/{platform}
method: get
cors: true
getPlistForLatestIos:
handler: src/get.getPlistForLatestIos
memorySize: 256
timeout: 12
events:
- http:
path: /ios/{packageName}/{semver}/manifest.plist
method: get
cors: true
redirectToIosManifest:
handler: src/get.redirectToIosManifest
memorySize: 256
timeout: 12
events:
- http:
path: /ios-manifest/{packageName}/{semver}
method: get
cors: true
findExpiredDistributions:
handler: src/batch.findExpiredDistributions
memorySize: 256
timeout: 12
events:
- http:
path: /expiration
method: get
cors: true
deleteExpiredDists:
handler: src/batch.deleteExpiredDistributions
memorySize: 1024
timeout: 30
events:
- http:
path: /expiration
method: delete
- schedule: cron(0 20 * * ? *)
resources:
Resources:
DistBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${env:DIST_BUCKET}