Skip to content

Commit cea240f

Browse files
authored
Update Core Service Collection Creations (canada-ca#2286)
* update core service create_collections * update replication factor to 3 * update database options * update dmarc-report database options
1 parent 9868abb commit cea240f

3 files changed

Lines changed: 39 additions & 85 deletions

File tree

services/core/core.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,12 @@ def update_guidance(
111111
for entry in guidance_data:
112112
if entry["file"] == "scanSummaryCriteria.json":
113113
if not db.has_collection("scanSummaryCriteria"):
114-
db.create_collection("scanSummaryCriteria")
114+
db.create_collection(
115+
name="scanSummaryCriteria",
116+
replication_factor=3,
117+
shard_count=6,
118+
write_concern=1,
119+
)
115120
for criteria_type, criteria in entry["guidance"].items():
116121
new_criteria = {
117122
"_key": criteria_type,
@@ -153,7 +158,12 @@ def update_guidance(
153158

154159
elif entry["file"] == "chartSummaryCriteria.json":
155160
if not db.has_collection("chartSummaryCriteria"):
156-
db.create_collection("chartSummaryCriteria")
161+
db.create_collection(
162+
"chartSummaryCriteria",
163+
replication_factor=3,
164+
shard_count=6,
165+
write_concern=1,
166+
)
157167
for criteria_type, criteria in entry["guidance"].items():
158168
new_criteria = {
159169
"_key": criteria_type,
@@ -191,7 +201,12 @@ def update_guidance(
191201
file_name = entry["file"].split(".json")[0]
192202
tag_type = file_name.split("tags_")[1]
193203
if not db.has_collection(f"{tag_type}GuidanceTags"):
194-
db.create_collection(f"{tag_type}GuidanceTags")
204+
db.create_collection(
205+
f"{tag_type}GuidanceTags",
206+
replication_factor=3,
207+
shard_count=6,
208+
write_concern=1,
209+
)
195210
for tag_key, tag_data in entry["guidance"].items():
196211
new_tag = {
197212
"_key": tag_key,
@@ -242,7 +257,12 @@ def update_scan_summaries(host=DB_HOST, name=DB_NAME, user=DB_USER, password=DB_
242257
db = client.db(name, username=user, password=password)
243258

244259
if not db.has_collection("scanSummaries"):
245-
db.create_collection("scanSummaries")
260+
db.create_collection(
261+
"scanSummaries",
262+
replication_factor=3,
263+
shard_count=6,
264+
write_concern=1,
265+
)
246266

247267
for scan_type in SCAN_TYPES:
248268
scan_pass = 0
@@ -288,7 +308,12 @@ def update_chart_summaries(host=DB_HOST, name=DB_NAME, user=DB_USER, password=DB
288308
db = client.db(name, username=user, password=password)
289309

290310
if not db.has_collection("chartSummaries"):
291-
db.create_collection("chartSummaries")
311+
db.create_collection(
312+
"chartSummaries",
313+
replication_factor=3,
314+
shard_count=6,
315+
write_concern=1,
316+
)
292317

293318
for chart_type, scan_types in CHARTS.items():
294319
pass_count = 0

services/dmarc-report/database-options.js

Lines changed: 6 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,34 @@
11
const databaseOptions = ({ rootPass }) => [
22
{ type: 'user', username: 'root', password: rootPass },
3-
{
4-
type: 'documentcollection',
5-
name: 'users',
6-
},
73
{
84
type: 'documentcollection',
95
name: 'organizations',
6+
options: { replicationFactor: 3, writeConcern: 1, numberOfShards: 6 },
107
},
118
{
129
type: 'documentcollection',
1310
name: 'domains',
14-
},
15-
{
16-
type: 'documentcollection',
17-
name: 'dkim',
18-
},
19-
{
20-
type: 'documentcollection',
21-
name: 'dkimResults',
22-
},
23-
{
24-
type: 'documentcollection',
25-
name: 'dmarc',
26-
},
27-
{
28-
type: 'documentcollection',
29-
name: 'spf',
30-
},
31-
{
32-
type: 'documentcollection',
33-
name: 'https',
34-
},
35-
{
36-
type: 'documentcollection',
37-
name: 'ssl',
38-
},
39-
{
40-
type: 'documentcollection',
41-
name: 'dkimGuidanceTags',
42-
},
43-
{
44-
type: 'documentcollection',
45-
name: 'dmarcGuidanceTags',
46-
},
47-
{
48-
type: 'documentcollection',
49-
name: 'spfGuidanceTags',
50-
},
51-
{
52-
type: 'documentcollection',
53-
name: 'httpsGuidanceTags',
54-
},
55-
{
56-
type: 'documentcollection',
57-
name: 'sslGuidanceTags',
58-
},
59-
{
60-
type: 'documentcollection',
61-
name: 'chartSummaries',
11+
options: { replicationFactor: 3, writeConcern: 1, numberOfShards: 6 },
6212
},
6313
{
6414
type: 'documentcollection',
6515
name: 'dmarcSummaries',
66-
},
67-
{
68-
type: 'edgecollection',
69-
name: 'affiliations',
16+
options: { replicationFactor: 3, writeConcern: 1, numberOfShards: 6 },
7017
},
7118
{
7219
type: 'edgecollection',
7320
name: 'claims',
74-
},
75-
{
76-
type: 'edgecollection',
77-
name: 'domainsDKIM',
78-
},
79-
{
80-
type: 'edgecollection',
81-
name: 'dkimToDkimResults',
82-
},
83-
{
84-
type: 'edgecollection',
85-
name: 'domainsDMARC',
86-
},
87-
{
88-
type: 'edgecollection',
89-
name: 'domainsSPF',
90-
},
91-
{
92-
type: 'edgecollection',
93-
name: 'domainsHTTPS',
94-
},
95-
{
96-
type: 'edgecollection',
97-
name: 'domainsSSL',
21+
options: { replicationFactor: 3, writeConcern: 1, numberOfShards: 6 },
9822
},
9923
{
10024
type: 'edgecollection',
10125
name: 'ownership',
26+
options: { replicationFactor: 3, writeConcern: 1, numberOfShards: 6 },
10227
},
10328
{
10429
type: 'edgecollection',
10530
name: 'domainsToDmarcSummaries',
31+
options: { replicationFactor: 3, writeConcern: 1, numberOfShards: 6 },
10632
},
10733
]
10834

services/super-admin/database-options.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ const databaseOptions = ({ rootPass }) => [
33
{
44
type: 'documentcollection',
55
name: 'users',
6+
options: { replicationFactor: 3, writeConcern: 1, numberOfShards: 6 },
67
},
78
{
89
type: 'documentcollection',
910
name: 'organizations',
11+
options: { replicationFactor: 3, writeConcern: 1, numberOfShards: 6 },
1012
},
1113
{
1214
type: 'edgecollection',
1315
name: 'affiliations',
16+
options: { replicationFactor: 3, writeConcern: 1, numberOfShards: 6 },
1417
},
1518
]
1619

0 commit comments

Comments
 (0)