-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserverless.yml
241 lines (234 loc) · 6.06 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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
service: discourse
#frameworkVersion: ">=1.2.0 <2.0.0"
custom:
stage: "${opt:stage, self:provider.stage}"
kmsKeyArn: ${file(env.yml):${self:custom.stage}.KEY_ARN}
pythonRequirements:
dockerizePip: non-linux
BadgesTopic:
Fn::Join:
- ":"
- - arn
- aws
- sns
- Ref: AWS::Region
- Ref: AWS::AccountId
- Discourse-Badges
StoreBadgesTopic:
Fn::Join:
- ":"
- - arn
- aws
- sns
- Ref: AWS::Region
- Ref: AWS::AccountId
- Store-Discourse-Badges
GroupsTopic:
Fn::Join:
- ":"
- - arn
- aws
- sns
- Ref: AWS::Region
- Ref: AWS::AccountId
- Discourse-Groups
StoreGroupsTopic:
Fn::Join:
- ":"
- - arn
- aws
- sns
- Ref: AWS::Region
- Ref: AWS::AccountId
- Store-Discourse-Groups
serverless-offline:
httpPort: 4000
provider:
name: aws
runtime: python3.8
timeout: 30
environment: ${file(env.yml):${self:custom.stage}}
iamRoleStatements: # permissions for all of your functions can be set here
- Effect: Allow
Action:
- KMS:Decrypt
Resource:
- ${self:custom.kmsKeyArn}
- Effect: "Allow"
Action:
- "ssm:GetParameter"
Resource: "arn:aws:ssm:*:715633473519:parameter/com.neo4j.devrel.discourse.*"
- Effect: "Allow"
Action:
- "ssm:GetParameter"
Resource: "arn:aws:ssm:*:715633473519:parameter/com.neo4j.graphacademy.*"
- Effect: 'Allow'
Action:
- "ses:SendEmail"
Resource:
"arn:aws:ses:us-east-1:715633473519:identity/[email protected]"
- Effect: 'Allow'
Action:
- "sns:Publish"
Resource:
- ${self:custom.BadgesTopic}
- Effect: 'Allow'
Action:
- "sns:Publish"
Resource:
- ${self:custom.StoreBadgesTopic}
- Effect: 'Allow'
Action:
- "sns:Publish"
Resource:
- ${self:custom.GroupsTopic}
- Effect: 'Allow'
Action:
- "sns:Publish"
Resource:
- ${self:custom.StoreGroupsTopic}
plugins:
- serverless-python-requirements
- serverless-offline
functions:
community-content:
name: Discourse-CommunityContentWebHook
handler: handler.community_content
timeout: 30
events:
- http:
method: POST
path: CommunityContent
import-posts-topics:
name: Discourse-ImportPostsTopics
handler: handler.import_posts_topics
events:
- http:
method: POST
path: ImportPostsTopics
user-events:
name: Discourse-UserEventsWebHook
handler: handler.user_events
timeout: 30
events:
- http:
method: POST
path: UserEvents
assign-edu-group:
name: Discourse-AssignEduGroup
handler: handler.assign_edu_group
timeout: 30
events:
- schedule: rate(24 hours)
send-edu-discourse-invites:
name: Discourse-SendEduDiscourse
handler: handler.send_edu_discourse_invites
timeout: 30
events:
- schedule: rate(24 hours)
import-twin4j:
name: Discourse-ImportTWIN4j
handler: handler.import_twin4j
events:
- schedule: cron(0 9 ? * 7 *)
update-profile:
name: Discourse-UpdateProfileWebHook
handler: handler.update_profile
timeout: 30
events:
- http:
method: POST
path: UpdateProfile
update-topics:
name: Discourse-UpdateTopics
handler: handler.update_topics
events:
- schedule: rate(1 hour)
update-categories:
name: Discourse-UpdateCategories
handler: handler.update_categories
events:
- schedule: rate(1 hour)
fetch-medium-posts:
name: Discourse-FetchMediumPosts
handler: handler.fetch_medium_posts
events:
- schedule: rate(10 minutes)
post-medium-to-discourse:
name: Discourse-PostMediumToDiscourse
handler: handler.post_medium_to_discourse
events:
- schedule: rate(5 minutes)
ninja-all:
name: Discourse-API-AllNinjas
handler: api.all_ninjas
events:
- http:
method: GET
path: AllNinjas
badges:
name: Discourse-AssignBadges
handler: handler.assign_badges
events:
- sns:
topicName: Discourse-Badges
displayName: Topic to handle assigning of badges
missing-badges:
name: Discourse-MissingBadges
handler: handler.missing_badges
events:
- schedule: rate(5 minutes)
find-users-badges:
name: Discourse-FindUsersAndBadges
handler: handler.find_users_badges
events:
- schedule: rate(1 minute)
store-badges:
name: Discourse-StoreBadges
handler: handler.store_badges
events:
- sns:
topicName: Store-Discourse-Badges
displayName: Topic to handle storing badges in Neo4j
assign-groups:
name: Discourse-AssignGroups
handler: handler.assign_groups
events:
- sns:
topicName: Discourse-Groups
displayName: Topic to handle assigning of groups
missing-groups:
name: Discourse-MissingGroups
handler: handler.missing_groups
events:
- schedule: rate(5 minutes)
find-users-groups:
name: Discourse-FindUsersAndGroups
handler: handler.find_users_groups
events:
- schedule: rate(1 minute)
store-groups:
name: Discourse-StoreGroups
handler: handler.store_groups
events:
- sns:
topicName: Store-Discourse-Groups
displayName: Topic to handle storing groups in Neo4j
poll-ninja-requests:
name: Discourse-PollNinjaRequests
handler: handler.poll_ninja_requests
events:
- schedule: rate(1 hour)
poll-ninja-recommended-questions:
name: Discourse-PollNinjaRecommendedQuestions
handler: handler.poll_ninja_recommended_questions
events:
- schedule: rate(1 hour)
clean-up-discourse-users:
name: Discourse-CleanUpDiscourseUsers
handler: handler.clean_up_discourse_users
package:
exclude:
- node_modules/**
- a/**
- .git/**