d1d5984e30
* refactor(server emails): email transports module refactor to TypeScript * refactor(docker-compose deps): move local email server to common dev compose file * chore(server launch.json): add ts-node script running example * chore(server deps): add nodemailer types package * refactor(server activitystream): add strongly typed activity definitions * feat(server activitystream): add activity repository * feat(server info): add canonical url on the service level * feat(server): add static file serving route to server core * feat(server): add dependencies for periodical email digests * feat(server activity stream): call the initialization step from the activity stream module * feat(server activity digest): add WIP weekly email digest implementation * feat(server digest email): smul upgrades and fixes to the email template and its contents * just for Fabs to test * chore(root package.json): remove deleted docker-compose references * feat(frontend profile): add notification preferences panel * feat(server digest emails): set prod ready cron tab and timespan * refactor(server email digest): move templates into the email module * refactor(server activity digests): refactor to use notifications infrastructure * test(server activities): add tests and some refactor to activities and notification preferences * refactor(notification preferences): fix minor issues * test(server notification preferences test): fix describe nesting * fix(server activities): add missing action types * fix(server activities): fix errors after merging main * test(server activity notifications): add test coverage for activity notifications service * refactor(server activities): fixing tests and some cleanup * feat(server cli): add summary notification command to cli * chore(dev env db versions): upgrade local dev env versions * chore(server deps): upgrade local dev db to pg 14 * fix(docker-compose): bind maildev to localhost * process-scoped notifications test queues * test(activity tests): add sleep to fix flaky CI * feat(activity digests): add demo date for digest trigger * feat(activity digest): add UK timezone trigger date Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com> Co-authored-by: Fabians <fabis94@live.com>
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import { CommandModule } from 'yargs'
|
|
import express from 'express'
|
|
import { ExpressAdapter } from '@bull-board/express'
|
|
import { createBullBoard } from '@bull-board/api'
|
|
import { BullAdapter } from '@bull-board/api/bullAdapter'
|
|
import {
|
|
NOTIFICATIONS_QUEUE,
|
|
buildNotificationsQueue
|
|
} from '@/modules/notifications/services/queue'
|
|
import { cliDebug } from '@/modules/shared/utils/logger'
|
|
import { noop } from 'lodash'
|
|
|
|
const PORT = 3032
|
|
|
|
const command: CommandModule<unknown, { testQueueId: string }> = {
|
|
command: 'monitor [testQueueId]',
|
|
describe: 'Run bull-board monitoring web UI',
|
|
builder: {
|
|
testQueueId: {
|
|
describe:
|
|
'Optionally specify the ID of a test queue (from a test run) to load it as well',
|
|
type: 'string'
|
|
}
|
|
},
|
|
handler: async (argv) => {
|
|
const testQueueId = argv.testQueueId
|
|
|
|
cliDebug('Initializing bull queues...')
|
|
const queues = [buildNotificationsQueue(NOTIFICATIONS_QUEUE)]
|
|
|
|
if (testQueueId) {
|
|
cliDebug('Also initializing queue ' + testQueueId + '...')
|
|
queues.push(buildNotificationsQueue(testQueueId))
|
|
}
|
|
|
|
cliDebug('Initializing monitor...')
|
|
const app = express()
|
|
const serverAdapter = new ExpressAdapter()
|
|
|
|
createBullBoard({
|
|
serverAdapter,
|
|
queues: Object.values(queues).map((q) => new BullAdapter(q))
|
|
})
|
|
|
|
app.use(serverAdapter.getRouter())
|
|
|
|
app.listen(PORT, () => {
|
|
cliDebug(`Running on ${PORT}...`)
|
|
cliDebug(
|
|
`For the UI, open http://localhost:${PORT}/, and make sure Redis is running`
|
|
)
|
|
})
|
|
|
|
// Waiting forever
|
|
await new Promise(noop)
|
|
}
|
|
}
|
|
|
|
export = command
|