Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
bull-arena
Advanced tools
An intuitive Web GUI for Bee Queue, Bull and BullMQ. Built on Express so you can run Arena standalone, or mounted in another app as middleware.
For a quick introduction to the motivations for creating Arena, read Interactively monitoring Bull, a Redis-backed job queue for Node.
Arena accepts the following options:
const Arena = require('bull-arena');
// Mandatory import of queue library.
const Bee = require('bee-queue');
Arena({
// All queue libraries used must be explicitly imported and included.
Bee,
// Provide a `Bull` option when using bull, similar to the `Bee` option above.
queues: [
{
// Required for each queue definition.
name: 'name_of_my_queue',
// User-readable display name for the host. Required.
hostId: 'Queue Server 1',
// Queue type (Bull or Bee - default Bull).
type: 'bee',
// Queue key prefix. Defaults to "bq" for Bee and "bull" for Bull.
prefix: 'foo',
},
],
// Optionally include your own stylesheet
customCssPath: 'https://example.com/custom-arena-styles.css',
// Optionally include your own script
customJsPath: 'https://example.com/custom-arena-js.js',
});
The required name
and hostId
in each queue object have to be present in each queue object. Additional keys can be present in them, to configure the redis client itself.
The three ways in which you can configure the client are:
// In a queue object.
{
// Hostname or IP. Required.
"host": "127.0.0.1",
// Bound port. Optional, default: 6379.
"port": 6379,
// Optional, to issue a redis AUTH command.
"password": "hello",
// Optional; default 0. Most of the time, you'll leave this absent.
"db": 1
}
You can also provide a url
field instead of host
, port
, db
and password
.
{
"url": "[redis:]//[[user][:password@]][host][:port][/db-number][?db=db-number[&password=bar[&option=value]]]"
}
Arena is compatible with both Bee and Bull. If you need to pass some specific configuration options directly to the redis client library your queue uses, you can also do so.
Bee uses node redis client, Bull uses ioredis client. These clients expect different configurations options.
{
"redis": {}
}
For Bee, the redis
key will be directly passed to redis.createClient
, as explained here.
For Bull, the redis
key will be directly passed to ioredis
, as explained here. To use this to connect to a Sentinel cluster, see here.
To specify a custom configuration file location, see Running Arena as a node module.
Note that if you happen to use Amazon Web Services' ElastiCache as your Redis host, check out http://mixmax.com/blog/bull-queue-aws-autodiscovery
See the Docker image section or the docker-arena repository for information about running this standalone.
Note that because Arena is implemented using async
/await
, Arena only currently supports Node >=7.6
.
Using Arena as a node module has potential benefits:
Usage:
In project folder:
$ npm install bull-arena
In router.js:
const Arena = require('bull-arena');
const express = require('express');
const router = express.Router();
const arena = Arena({
// Include a reference to the bee-queue or bull libraries, depending on the library being used.
queues: [
{
// First queue configuration
},
{
// Second queue configuration
},
{
// And so on...
},
],
});
router.use('/', arena);
Arena
takes two arguments. The first, config
, is a plain object containing the queue configuration, flow configuration (just for bullmq for now) and other optional parameters. The second, listenOpts
, is an object that can contain the following optional parameters:
port
- specify custom port to listen on (default: 4567)host
- specify custom ip to listen on (default: '0.0.0.0')basePath
- specify custom path to mount server on (default: '/')disableListen
- don't let the server listen (useful when mounting Arena as a sub-app of another Express app) (default: false)useCdn
- set false to use the bundled js and css files (default: true)customCssPath
- an URL to an external stylesheet (default: null)import Arena from 'bull-arena';
import Bull from 'bull';
const arenaConfig = Arena({
Bull,
queues: [
{
type: 'bull',
// Name of the bull queue, this name must match up exactly with what you've defined in bull.
name: "Notification_Emailer",
// Hostname or queue prefix, you can put whatever you want.
hostId: "MyAwesomeQueues",
// Redis auth.
redis: {
port: /* Your redis port */,
host: /* Your redis host domain*/,
password: /* Your redis password */,
},
},
],
// Optionally include your own stylesheet
customCssPath: 'https://example.com/custom-arena-styles.css',
// Optionally include your own script
customJsPath: 'https://example.com/custom-arena-js.js',
},
{
// Make the arena dashboard become available at {my-site.com}/arena.
basePath: '/arena',
// Let express handle the listening.
disableListen: true,
});
// Make arena's resources (js/css deps) available at the base app route
app.use('/', arenaConfig);
(Credit to tim-soft for the example config.)
import Arena from 'bull-arena';
import { Queue, FlowProducer } from "bullmq";
const arenaConfig = Arena({
BullMQ: Queue,
FlowBullMQ: FlowProducer,
queues: [
{
type: 'bullmq',
// Name of the bullmq queue, this name must match up exactly with what you've defined in bullmq.
name: "testQueue",
// Hostname or queue prefix, you can put whatever you want.
hostId: "worker",
// Redis auth.
redis: {
port: /* Your redis port */,
host: /* Your redis host domain*/,
password: /* Your redis password */,
},
},
],
flows: [
{
type: 'bullmq',
// Name of the bullmq flow connection, this name helps to identify different connections.
name: "testConnection",
// Hostname, you can put whatever you want.
hostId: "Flow",
// Redis auth.
redis: {
port: /* Your redis port */,
host: /* Your redis host domain*/,
password: /* Your redis password */,
},
},
],
// Optionally include your own stylesheet
customCssPath: 'https://example.com/custom-arena-styles.css',
// Optionally include your own script
customJsPath: 'https://example.com/custom-arena-js.js',
},
{
// Make the arena dashboard become available at {my-site.com}/arena.
basePath: '/arena',
// Let express handle the listening.
disableListen: true,
});
// Make arena's resources (js/css deps) available at the base app route
app.use('/', arenaConfig);
Arena is dual-compatible with Bull 3.x and Bee-Queue 1.x. To add a Bee queue to the Arena dashboard, include the type: 'bee'
property with an individual queue's configuration object.
Arena has added preliminary support for BullMQ post 3.4.x version. To add a BullMQ queue to the Arena dashboard, include the type: 'bullmq'
property with an individual queue's configuration object.
You can docker pull
Arena from Docker Hub.
Please see the docker-arena repository for details.
See contributing guidelines and an example.
The MIT License.
FAQs
An interactive UI dashboard for Bee Queue
The npm package bull-arena receives a total of 25,755 weekly downloads. As such, bull-arena popularity was classified as popular.
We found that bull-arena demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 29 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.