Skip to content

Commit e6762b9

Browse files
committed
feat(bullmq): Replaced Bull Arena with Bull Board
1 parent ce9fd6a commit e6762b9

20 files changed

+469
-3231
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ config/development*
1111
.okta.env
1212
system.env
1313
keylog.txt
14+

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ EmailEngine relies on Redis as its data store. Redis stores everything in RAM, s
105105

106106
To diagnose problems:
107107

108-
1. **Check Bull Queues:** Use the built-in Bull Arena UI to monitor queue states at [http://127.0.0.1:3000/admin/arena](http://127.0.0.1:3000/admin/arena).
108+
1. **Check Bull Queues:** Use the built-in Bull Arena UI to monitor queue states at [http://127.0.0.1:3000/admin/bull-board](http://127.0.0.1:3000/admin/bull-board).
109109
2. **Scan Keyspace:** Run the following to group Redis keys by type and generate a report:
110110

111111
```bash

Diff for: copy-static-files.sh

-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ cp node_modules/ace-builds/src-min/snippets/javascript.js static/js/ace/snippets
2222
cp node_modules/ace-builds/src-min/snippets/markdown.js static/js/ace/snippets
2323
cp node_modules/ace-builds/src-min/ext-searchbox.js static/js/ace/ext-searchbox.js
2424

25-
rm -rf static/openapi-themes/
26-
mkdir -p static/openapi-themes/
27-
cp node_modules/swagger-ui-themes/themes/3.x/theme-material.css static/openapi-themes/
28-
2925
wget https://developers.google.com/static/search/apis/ipranges/special-crawlers.json -O data/google-crawlers.json
3026
node -e 'console.log("Google crawlers updated: "+require("./data/google-crawlers.json").creationTime);'
3127

Diff for: lib/api-routes/bull-board-routes.js

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
'use strict';
2+
3+
const { createBullBoard } = require('@bull-board/api');
4+
const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter');
5+
const { HapiAdapter } = require('@bull-board/hapi');
6+
const { notifyQueue, submitQueue, documentsQueue } = require('../db');
7+
8+
async function init(args) {
9+
const { server } = args;
10+
11+
const serverAdapter = new HapiAdapter();
12+
13+
let queues = [
14+
{
15+
queue: notifyQueue,
16+
prefix: 'Webhooks Queue - ',
17+
description: 'This queue processes all email events that may trigger webhooks. Events that do not trigger a webhook are silently discarded.'
18+
},
19+
{
20+
queue: submitQueue,
21+
prefix: 'Submission Queue - ',
22+
description: 'This queue contains emails that are scheduled to be sent.'
23+
},
24+
{
25+
queue: documentsQueue,
26+
prefix: 'Document Queue - ',
27+
description: '(Deprecated) This queue was used for indexing email information in the Document Store'
28+
}
29+
];
30+
let queueAdapters = queues.map(queue => {
31+
let adapter = new BullMQAdapter(queue.queue, {
32+
description: queue.description,
33+
prefix: queue.prefix
34+
});
35+
36+
//adapter.setFormatter('name', job => `#Queue1 - ${job.name}`);
37+
38+
return adapter;
39+
});
40+
41+
createBullBoard({
42+
queues: queueAdapters,
43+
serverAdapter,
44+
options: {
45+
uiConfig: {
46+
boardTitle: 'Bull Board',
47+
boardLogo: { path: '/static/logo.png', width: '28px', height: '28px' },
48+
favIcon: { default: '/static/favicon/android-chrome-512x512.png', alternative: 'static/favicon/favicon-32x32.png' },
49+
miscLinks: [{ text: 'Dashboard', url: '/admin' }]
50+
}
51+
}
52+
});
53+
54+
serverAdapter.setBasePath('/admin/bull-board');
55+
await server.register(serverAdapter.registerPlugin(), {
56+
routes: { prefix: '/admin/bull-board' }
57+
});
58+
}
59+
60+
module.exports = init;

Diff for: lib/arena-express.js

-61
This file was deleted.

Diff for: lib/routes-ui.js

-59
Original file line numberDiff line numberDiff line change
@@ -954,65 +954,6 @@ function applyRoutes(server, call) {
954954
}
955955
});
956956

957-
server.route({
958-
method: 'GET',
959-
path: '/admin/arena',
960-
async handler(request, h) {
961-
return h.view(
962-
'arena/index',
963-
{
964-
pageTitle: 'Arena',
965-
menuTools: true,
966-
menuToolsArena: true,
967-
iframePage: true
968-
},
969-
{
970-
layout: 'app'
971-
}
972-
);
973-
}
974-
});
975-
976-
server.route({
977-
method: 'GET',
978-
path: '/admin/arena/queue/{queue}',
979-
async handler(request, h) {
980-
return h.view(
981-
'arena/index',
982-
{
983-
pageTitle: 'Arena',
984-
menuTools: true,
985-
menuToolsArena: true,
986-
iframePage: true,
987-
988-
queue: request.params.queue
989-
},
990-
{
991-
layout: 'app'
992-
}
993-
);
994-
},
995-
996-
options: {
997-
validate: {
998-
options: {
999-
stripUnknown: true,
1000-
abortEarly: false,
1001-
convert: true
1002-
},
1003-
1004-
async failAction(request, h, err) {
1005-
request.logger.error({ msg: 'Failed to validate queue argument', err });
1006-
return h.redirect('/admin').takeover();
1007-
},
1008-
1009-
params: Joi.object({
1010-
queue: Joi.string().empty('').valid('submit', 'notify', 'documents').label('Queue').required()
1011-
})
1012-
}
1013-
}
1014-
});
1015-
1016957
server.route({
1017958
method: 'GET',
1018959
path: '/admin/legal',

0 commit comments

Comments
 (0)