Adding backup queue to bullboard if enabled.
This commit is contained in:
parent
6228d3346e
commit
51251b1fe2
|
@ -54,19 +54,6 @@ app.use(
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
app.use(pino(pinoSettings()))
|
|
||||||
|
|
||||||
if (!env.isTest()) {
|
|
||||||
const plugin = bullboard.init()
|
|
||||||
app.use(plugin)
|
|
||||||
}
|
|
||||||
|
|
||||||
app.context.eventEmitter = eventEmitter
|
|
||||||
app.context.auth = {}
|
|
||||||
|
|
||||||
// api routes
|
|
||||||
app.use(api.router.routes())
|
|
||||||
|
|
||||||
if (env.isProd()) {
|
if (env.isProd()) {
|
||||||
env._set("NODE_ENV", "production")
|
env._set("NODE_ENV", "production")
|
||||||
Sentry.init()
|
Sentry.init()
|
||||||
|
@ -104,7 +91,22 @@ server.on("close", async () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const initPro = async () => {
|
async function initRoutes() {
|
||||||
|
app.use(pino(pinoSettings()))
|
||||||
|
|
||||||
|
if (!env.isTest()) {
|
||||||
|
const plugin = await bullboard.init()
|
||||||
|
app.use(plugin)
|
||||||
|
}
|
||||||
|
|
||||||
|
app.context.eventEmitter = eventEmitter
|
||||||
|
app.context.auth = {}
|
||||||
|
|
||||||
|
// api routes
|
||||||
|
app.use(api.router.routes())
|
||||||
|
}
|
||||||
|
|
||||||
|
async function initPro() {
|
||||||
await pro.init({
|
await pro.init({
|
||||||
backups: {
|
backups: {
|
||||||
processing: {
|
processing: {
|
||||||
|
@ -179,11 +181,13 @@ module.exports = server.listen(env.PORT || 0, async () => {
|
||||||
// check for version updates
|
// check for version updates
|
||||||
await installation.checkInstallVersion()
|
await installation.checkInstallVersion()
|
||||||
|
|
||||||
// done last - these will never complete
|
// get the references to the queue promises, don't await as
|
||||||
let promises = []
|
// they will never end, unless the processing stops
|
||||||
promises.push(automations.init())
|
let queuePromises = []
|
||||||
promises.push(initPro())
|
queuePromises.push(automations.init())
|
||||||
await Promise.all(promises)
|
queuePromises.push(initPro())
|
||||||
|
// bring routes online as final step once everything ready
|
||||||
|
await initRoutes()
|
||||||
})
|
})
|
||||||
|
|
||||||
const shutdown = () => {
|
const shutdown = () => {
|
||||||
|
|
|
@ -3,6 +3,7 @@ const { BullAdapter } = require("@bull-board/api/bullAdapter")
|
||||||
const { KoaAdapter } = require("@bull-board/koa")
|
const { KoaAdapter } = require("@bull-board/koa")
|
||||||
const { queue } = require("@budibase/backend-core")
|
const { queue } = require("@budibase/backend-core")
|
||||||
const automation = require("../threads/automation")
|
const automation = require("../threads/automation")
|
||||||
|
const { backups } = require("@budibase/pro")
|
||||||
|
|
||||||
let automationQueue = queue.createQueue(
|
let automationQueue = queue.createQueue(
|
||||||
queue.JobQueue.AUTOMATION,
|
queue.JobQueue.AUTOMATION,
|
||||||
|
@ -11,9 +12,13 @@ let automationQueue = queue.createQueue(
|
||||||
|
|
||||||
const PATH_PREFIX = "/bulladmin"
|
const PATH_PREFIX = "/bulladmin"
|
||||||
|
|
||||||
exports.init = () => {
|
exports.init = async () => {
|
||||||
// Set up queues for bull board admin
|
// Set up queues for bull board admin
|
||||||
|
const backupQueue = await backups.getBackupQueue()
|
||||||
const queues = [automationQueue]
|
const queues = [automationQueue]
|
||||||
|
if (backupQueue) {
|
||||||
|
queues.push(backupQueue)
|
||||||
|
}
|
||||||
const adapters = []
|
const adapters = []
|
||||||
const serverAdapter = new KoaAdapter()
|
const serverAdapter = new KoaAdapter()
|
||||||
for (let queue of queues) {
|
for (let queue of queues) {
|
||||||
|
|
Loading…
Reference in New Issue