This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
221 lines (204 loc) · 8.23 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
service: offcourse
provider:
name: aws
cfLogs: true
runtime: nodejs4.3
environment:
serverlessStage: ${self:custom.envVars.serverlessStage}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:GetItem
- dynamodb:BatchGetItem
- dynamodb:PutItem
- dynamodb:query
- dynamodb:Scan
- s3:PutObject
- s3:GetObject
- kinesis:GetRecords
- kinesis:GetShardIterator
- kinesis:PutRecords
- kinesis:DescribeStream
- kinesis:ListStreams
Resource: "*"
custom:
kinesisBase: arn:aws:kinesis:us-east-1:774182433398:stream
dynamodbBase: arn:aws:dynamodb:us-east-1:774182433398:table
envVars: ${file(./envvars.yml):EnvVars}
functions:
command:
handler: functions/index.command
environment:
rawCoursesBucket: ${self:service}-raw-courses-${opt:stage}
rawUsersBucket: ${self:service}-raw-users-${opt:stage}
identitiesTable: "identities-${opt:stage}"
rawReposStream: "raw-github-repos-${opt:stage}"
events:
- http:
path: command
method: post
cors: true
integration: lambda
authorizer: authorize
augment:
handler: functions/index.augment
environment:
coursesStream: "courses-${opt:stage}"
bookmarksTable: "bookmarks-${opt:stage}"
resourcesTable: "resources-${opt:stage}"
coursesTable: "courses-${opt:stage}"
events:
- stream:
arn: ${self:custom.dynamodbBase}/resources-${opt:stage}/stream/2016-11-01T20:58:43.405
query:
handler: functions/index.query
environment:
elasticsearchEndpoint: ${self:custom.envVars.elasticsearchEndpoint}
resourcesTable: "resources-${opt:stage}"
events:
- http:
path: query
method: post
cors: true
integration: lambda
authorize:
handler: functions/index.authorize
environment:
identitiesTable: "identities-${opt:stage}"
authSecret: ${self:custom.envVars.auth0Secret}
retrieve:
handler: functions/index.retrieve
environment:
rawUsersStream: "raw-users-${opt:stage}"
coursesStream: "courses-${opt:stage}"
githubCoursesStream: "github-courses-${opt:stage}"
githubReposStream: "github-repos-${opt:stage}"
rawResourcesStream: "raw-resources-${opt:stage}"
errorsStream: "errors-${opt:stage}"
events:
- s3:
bucket: ${self:service}-resources-${opt:stage}
event: s3:ObjectCreated:*
- s3:
bucket: ${self:service}-raw-users-${opt:stage}
event: s3:ObjectCreated:*
- s3:
bucket: ${self:service}-raw-courses-${opt:stage}
event: s3:ObjectCreated:*
- s3:
bucket: ${self:service}-github-repos-${opt:stage}
event: s3:ObjectCreated:*
- s3:
bucket: ${self:service}-github-courses-${opt:stage}
event: s3:ObjectCreated:*
transform:
handler: functions/index.transform
environment:
bookmarksStream: "bookmarks-${opt:stage}"
coursesStream: "courses-${opt:stage}"
rawGithubCoursesStream: "raw-github-courses-${opt:stage}"
resourcesStream: "resources-${opt:stage}"
profilesStream: "profiles-${opt:stage}"
rawPortraitsStream: "raw-portraits-${opt:stage}"
identitiesStream: "identities-${opt:stage}"
errorsStream: "errors-${opt:stage}"
events:
- stream:
arn: ${self:custom.kinesisBase}/raw-resources-${opt:stage}
startingPosition: LATEST
- stream:
arn: ${self:custom.kinesisBase}/raw-users-${opt:stage}
startingPosition: LATEST
- stream:
arn: ${self:custom.kinesisBase}/courses-${opt:stage}
startingPosition: LATEST
- stream:
arn: ${self:custom.kinesisBase}/github-repos-${opt:stage}
startingPosition: LATEST
- stream:
arn: ${self:custom.kinesisBase}/github-courses-${opt:stage}
startingPosition: LATEST
save:
handler: functions/index.save
timeout: 20
environment:
identitiesTable: "identities-${opt:stage}"
coursesTable: "courses-${opt:stage}"
resourcesTable: "resources-${opt:stage}"
profilesTable: "profiles-${opt:stage}"
bookmarksTable: "bookmarks-${opt:stage}"
events:
- stream:
arn: ${self:custom.kinesisBase}/profiles-${opt:stage}
startingPosition: LATEST
- stream:
arn: ${self:custom.kinesisBase}/identities-${opt:stage}
startingPosition: LATEST
- stream:
arn: ${self:custom.kinesisBase}/courses-${opt:stage}
startingPosition: LATEST
- stream:
arn: ${self:custom.kinesisBase}/bookmarks-${opt:stage}
startingPosition: LATEST
- stream:
arn: ${self:custom.kinesisBase}/resources-${opt:stage}
startingPosition: LATEST
download:
handler: functions/index.download
environment:
embedlyApiKey: ${self:custom.envVars.embedlyApiKey}
githubApiKey: ${self:custom.envVars.githubApiKey}
resourcesBucket: ${self:service}-resources-${opt:stage}
githubCoursesBucket: ${self:service}-github-courses-${opt:stage}
githubReposBucket: ${self:service}-github-repos-${opt:stage}
assetsBucket: ${self:service}-assets-${opt:stage}
events:
- stream:
arn: ${self:custom.kinesisBase}/bookmarks-${opt:stage}
startingPosition: LATEST
- stream:
arn: ${self:custom.kinesisBase}/raw-github-repos-${opt:stage}
startingPosition: LATEST
- stream:
arn: ${self:custom.kinesisBase}/raw-github-courses-${opt:stage}
startingPosition: LATEST
- stream:
arn: ${self:custom.kinesisBase}/raw-portraits-${opt:stage}
startingPosition: LATEST
index:
handler: functions/index.index
environment:
elasticsearchEndpoint: ${self:custom.envVars.elasticsearchEndpoint}
events:
- stream:
arn: ${self:custom.dynamodbBase}/resources-${opt:stage}/stream/2016-11-01T20:58:43.405
- stream:
arn: ${self:custom.dynamodbBase}/courses-${opt:stage}/stream/2016-11-09T21:48:50.668
- stream:
arn: ${self:custom.dynamodbBase}/profiles-${opt:stage}/stream/2016-11-09T21:48:51.163
resources:
Resources:
AccessBucketsRole: ${file(./cloudformation/roles.yml):AccessBucketsRole}
ViewAssetsPolicy: ${file(./cloudformation/roles.yml):ViewAssetsPolicy}
RawUsersStream: ${file(./cloudformation/streams.yml):RawUsersStream}
RawPortraitsStream: ${file(./cloudformation/streams.yml):RawPortraitsStream}
RawResourcesStream: ${file(./cloudformation/streams.yml):RawResourcesStream}
RawCoursesStream: ${file(./cloudformation/streams.yml):RawCoursesStream}
RawGithubCoursesStream: ${file(./cloudformation/streams.yml):RawGithubCoursesStream}
RawGithubReposStream: ${file(./cloudformation/streams.yml):RawGithubReposStream}
ErrorsStream: ${file(./cloudformation/streams.yml):ErrorsStream}
PortraitsStream: ${file(./cloudformation/streams.yml):PortraitsStream}
ProfilesStream: ${file(./cloudformation/streams.yml):ProfilesStream}
IdentitiesStream: ${file(./cloudformation/streams.yml):IdentitiesStream}
CoursesStream: ${file(./cloudformation/streams.yml):CoursesStream}
BookmarksStream: ${file(./cloudformation/streams.yml):BookmarksStream}
ResourcesStream: ${file(./cloudformation/streams.yml):ResourcesStream}
GithubReposStream: ${file(./cloudformation/streams.yml):GithubReposStream}
GithubCoursesStream: ${file(./cloudformation/streams.yml):GithubCoursesStream}
ResourcesTable: ${file(./cloudformation/tables.yml):ResourcesTable}
ProfilesTable: ${file(./cloudformation/tables.yml):ProfilesTable}
CoursesTable: ${file(./cloudformation/tables.yml):CoursesTable}
BookmarksTable: ${file(./cloudformation/tables.yml):BookmarksTable}
IdentitiesTable: ${file(./cloudformation/tables.yml):IdentitiesTable}
AssetsBucket: ${file(./cloudformation/buckets.yml):AssetsBucket}
SearchCluster: ${file(./cloudformation/search-clusters.yml):SearchCluster}