-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
153 lines (143 loc) · 4.3 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
141
142
143
144
145
146
147
148
149
150
151
152
153
# Change this to something that suits you (eg: my-filesharing-service)
# Note that there's a length limit due to s3 bucket names, keep it short.
service: drop-bucket
plugins:
- serverless-offline
- serverless-finch # static site to s3 deployment
- serverless-plugin-optimize
- serverless-pseudo-parameters
- serverless-stack-output
package:
individually: true
custom:
stage: ${opt:stage, self:provider.stage}
client: # for serverless-finch
bucketName: ${self:custom.stage}-${self:service}-ui
distributionFolder: client/build
errorDocument: index.html
avDefsBucketName: ${self:custom.stage}-${self:service}-av-defs
fileBucketName: ${self:custom.stage}-${self:service}-files
dynamoDbTableName: ${self:custom.stage}-${self:service}-files
dynamoDbTableToIdx: ${self:custom.stage}-${self:service}-files-to-idx
dynamoDbTableFromIdx: ${self:custom.stage}-${self:service}-files-from-idx
cognitoUserPool: ${self:custom.stage}-user-pool
output:
handler: scripts/output.process
provider:
name: aws
runtime: nodejs8.10
stage: dev
region: us-east-1
environment:
CLAMAV_BUCKET_NAME: ${self:custom.avDefsBucketName}
FILE_BUCKET_NAME: ${self:custom.fileBucketName}
DYNAMODB_TABLE_NAME: ${self:custom.dynamoDbTableName}
DYNAMODB_TABLE_TO_IDX: ${self:custom.dynamoDbTableToIdx}
DYNAMODB_TABLE_FROM_IDX: ${self:custom.dynamoDbTableFromIdx}
COGNITO_IDENTITY_POOL_ID: "/ctrl-alt-del/${self:service}/${self:custom.stage}/COGNITO_IDENTITY_POOL_ID"
COGNITO_USER_POOL_ID: "/ctrl-alt-del/${self:service}/${self:custom.stage}/COGNITO_USER_POOL_ID"
ADMIN_EMAIL: "mark@control-alt-del.org" ## CHANGE ME
WEBSITE_URL: "https://dropbucket.control-alt-del.org" ## CHANGE ME
functions:
list:
role: DropBucketListRole
handler: list.list
events:
- http:
path: /list
method: get
cors: true
authorizer: aws_iam
share:
role: DropBucketShareRole
handler: share.shareFile
events:
- http:
path: /share
method: post
cors: true
authorizer: aws_iam
deleteShare:
role: DropBucketShareRole
handler: share.deleteShare
events:
- http:
path: /share/{type}/{id}
method: delete
cors: true
authorizer: aws_iam
request:
parameters:
paths:
type: true
id: true
listShared:
role: DropBucketShareRole
handler: share.listShared
events:
- http:
path: /share/{type}
method: get
cors: true
authorizer: aws_iam
request:
parameters:
paths:
type: true
shareLink:
role: DropBucketShareRole
handler: share.shareLink
events:
- http:
path: /shareLink/{id}
method: get
cors: true
authorizer: aws_iam
request:
parameters:
paths:
id: true
disableUser:
role: DropBucketDisableUserRole
handler: user.disable
scan:
role: DropBucketVirusScanRole
timeout: 600
memory: 3008
optimize:
includePaths:
- av/bin/clamscan
- av/bin/libclamav.so.9
- av/bin/libclammspack.so.0
- av/bin/libjson-c.so.2
- av/bin/libjson.so.0
- av/bin/libpcre2-8.so.0
- av/bin/libpcre2-posix.so.1
- av/bin/libltdl.so.7
handler: clam.scan
# Note: no event associated here, we do it from the bucket definition to overcome limitations
# of serverless deployment mechanism...
avDefsUpdater:
role: DropBucketVirusDefsRole
timeout: 600
optimize:
includePaths:
- av/bin/freshclam
- av/bin/libclamav.so.9
- av/bin/libclammspack.so.0
- av/bin/libjson-c.so.2
- av/bin/libjson.so.0
- av/bin/libpcre2-8.so.0
- av/bin/libpcre2-posix.so.1
- av/bin/libltdl.so.7
- av/etc/freshclam.conf
handler: freshclam.update
events:
- schedule: cron(0 12 * * ? *)
resources:
- ${file(resources/general.yml)}
- ${file(resources/iam-roles.yml)}
- ${file(resources/s3-bucket.yml)}
- ${file(resources/cognito-user-pool.yml)}
- ${file(resources/cognito-identity-pool.yml)}
- ${file(resources/dynamodb.yml)}