Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move bull-board to use mono-repo structure #281

Merged
merged 31 commits into from
May 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3b27440
Reformat the code when semicolons enabled
felixmosh May 15, 2021
a732941
Start of mono-repo refactor
felixmosh May 17, 2021
9cab4d2
Finish initial implementation of mono-repo mode
felixmosh May 23, 2021
f580539
Add example with-express
felixmosh May 23, 2021
18a0ee6
Change author
felixmosh May 23, 2021
ab3e0a6
Update express examples
felixmosh May 27, 2021
5b448dd
fix api path
felixmosh May 27, 2021
9768d9c
Add fastify adapter
felixmosh May 27, 2021
e70f6a9
Add fastify example
felixmosh May 27, 2021
45bf386
Add hapi adapter
felixmosh May 27, 2021
767bcfd
Add hapi example
felixmosh May 27, 2021
1094147
Change readmes
felixmosh May 27, 2021
7857efe
Update main README.md
felixmosh May 27, 2021
d7b80e3
Fix blurry fonts
felixmosh May 26, 2021
ee503b0
Reformat theme.css
felixmosh May 27, 2021
3e815ee
Remove eslint-plugin-prettier since it formats differently then prett…
felixmosh May 27, 2021
107f08d
Cleanup package.json
felixmosh May 27, 2021
22e716d
Change prettier config
felixmosh May 27, 2021
d43ff00
Fix lint
felixmosh May 28, 2021
0e6207f
Cleanup root
felixmosh May 28, 2021
235cfe2
chore(deps): bump dns-packet from 1.3.1 to 1.3.4 (#279)
dependabot[bot] May 28, 2021
ff14d20
Add release-it-yarn-workspaces
felixmosh May 28, 2021
49ad711
Drop support for node 10
felixmosh May 28, 2021
1e47501
feat: add addQueue and removeQueue methods (#278)
ejhayes May 21, 2021
043474a
Fix tests
felixmosh May 28, 2021
866a401
Reformat the code
felixmosh May 28, 2021
5195bec
Merge branch 'master' into mono-repo
felixmosh May 28, 2021
621884e
Update lock
felixmosh May 28, 2021
5584368
Change to ci env
felixmosh May 28, 2021
d9cd4c7
Change install command
felixmosh May 28, 2021
a1f69f1
Switch build & tests
felixmosh May 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [ '10.x', '12.x', '14.x' ]
node: [ '12.x', '14.x' ]
os: [ubuntu-latest]

steps:
Expand All @@ -25,12 +25,18 @@ jobs:

- name: Install deps and build (with cache)
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --silent

- name: Lint
run: yarn lint

- name: Test
run: yarn test --ci --coverage --maxWorkers=2

- name: Build
run: yarn build
env:
CI: true

- name: Test
run: yarn test
env:
CI: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules/
static/

dist
yarn-error.log
*.rdb
Expand Down
94 changes: 57 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ With this library you get a beautiful UI for visualizing what's happening with e
</a>
<p>

![UI](https://raw.githubusercontent.com/vcapretz/bull-board/master/shot.png)
![Fails](https://raw.githubusercontent.com/vcapretz/bull-board/master/fails.png)
![UI](https://raw.githubusercontent.com/felixmosh/bull-board/master/screenshots/shot.png)
![Fails](https://raw.githubusercontent.com/felixmosh/bull-board/master/screenshots/fails.png)

## Notes

Expand All @@ -34,13 +34,21 @@ If you want to learn more about queues and Redis: https://redis.io/.
To add it to your project start by adding the library to your dependencies list:

```sh
yarn add bull-board
yarn add @bull-board/express
# or
yarn add @bull-board/fastify
# or
yarn add @bull-board/hapi
```

Or

```sh
npm i bull-board
npm i @bull-board/express
# or
npm i @bull-board/fastify
# or
npm i @bull-board/hapi
```

## Hello World
Expand All @@ -51,23 +59,30 @@ The first step is to setup `bull-board` by calling `createBullBoard` method.
const express = require('express')
const Queue = require('bull')
const QueueMQ = require('bullmq')
const { createBullBoard } = require('bull-board')
const { BullAdapter } = require('bull-board/bullAdapter')
const { BullMQAdapter } = require('bull-board/bullMQAdapter')
const { createBullBoard } = require('@bull-board/api')
const { BullAdapter } = require('@bull-board/api/bullAdapter')
const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter')
const { ExpressAdapter } = require('@bull-board/express')

const someQueue = new Queue('someQueueName')
const someOtherQueue = new Queue('someOtherQueueName')
const queueMQ = new QueueMQ('queueMQName')

const { router, setQueues, replaceQueues, addQueue, removeQueue } = createBullBoard([
new BullAdapter(someQueue),
new BullAdapter(someOtherQueue),
new BullMQAdapter(queueMQ),
])
const serverAdapter = new ExpressAdapter();

const { addQueue, removeQueue, setQueues, replaceQueues } = createBullBoard({
queues: [
new BullAdapter(someQueue),
new BullAdapter(someOtherQueue),
new BullMQAdapter(queueMQ),
],
serverAdapter:serverAdapter
})

const app = express()

app.use('/admin/queues', router)
serverAdapter.setBasePath('/admin/queues')
app.use('/admin/queues', serverAdapter.getRouter());

// other configurations of your server
```
Expand All @@ -78,26 +93,30 @@ That's it! Now you can access the `/admin/queues` route, and you will be able to
For more advanced usages check the `examples` folder, currently it contains:
1. [Basic authentication example](https://github.com/felixmosh/bull-board/tree/master/examples/with-auth)
2. [Multiple instance of the board](https://github.com/felixmosh/bull-board/tree/master/examples/with-multiple-instances)
2. [With Fastify server](https://github.com/felixmosh/bull-board/tree/master/examples/with-fastify)
2. [With Hapi.js server](https://github.com/felixmosh/bull-board/tree/master/examples/with-hapi)
### Queue options
1. `readOnlyMode` (default: `false`)
Makes the UI as read only, hides all queue & job related actions

```js
const Queue = require('bull')
const QueueMQ = require('bullmq')
const { setQueues } = require('bull-board')
const { BullMQAdapter } = require('bull-board/bullMQAdapter')
const { BullAdapter } = require('bull-board/bullAdapter')
const { createBullBoard } = require('@bull-board/api')
const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter')
const { BullAdapter } = require('@bull-board/api/bullAdapter')

const someQueue = new Queue()
const someOtherQueue = new Queue()
const queueMQ = new QueueMQ()

const { router, setQueues, replaceQueues } = createBullBoard([
new BullAdapter(someQueue, { readOnlyMode: true }), // only this queue will be in read only mode
new BullAdapter(someOtherQueue),
new BullMQAdapter(queueMQ, { readOnlyMode: true }),
])
const { setQueues, replaceQueues } = createBullBoard({
queues: [
new BullAdapter(someQueue, { readOnlyMode: true }), // only this queue will be in read only mode
new BullAdapter(someOtherQueue),
new BullMQAdapter(queueMQ, { readOnlyMode: true }),
]
})
```

### Hosting router on a sub path
Expand All @@ -106,26 +125,27 @@ If you host your express service on a different path than root (/) ie. https://<

```js
const Queue = require('bull')
const { createBullBoard } = require('bull-board')
const { BullAdapter } = require('bull-board/bullAdapter')
const { createBullBoard } = require('@bull-board/api')
const { BullAdapter } = require('@bull-board/api/bullAdapter')
const { ExpressAdapter } = require('@bull-board/express')

const someQueue = new Queue('someQueueName')

const { router } = createBullBoard([
new BullAdapter(someQueue),
])
const serverAdapter = new ExpressAdapter();

const { router } = createBullBoard({
queues: [
new BullAdapter(someQueue),
],
serverAdapter
})

// ... express server configuration

let basePath = 'my-base-path';
const basePath = 'my-base-path';
serverAdapter.setBasePath(basePath)

app.use(
'/queues',
(req, res, next) => {
req.proxyUrl = basePath + '/queues';
next();
},
router);
app.use('/queues', serverAdapter.getRouter());
```

You will then find the bull-board UI at the following address `https://<server_name>/my-base-path/queues`.
Expand All @@ -134,11 +154,11 @@ You will then find the bull-board UI at the following address `https://<server_n

First, thank you for being interested in helping out, your time is always appreciated in every way. 💯

Remember to read the [Code of Conduct](https://github.com/vcapretz/bull-board/blob/master/CODE_OF_CONDUCT.md) so you also help maintaining a good Open source community around this project!
Remember to read the [Code of Conduct](https://github.com/felixmosh/bull-board/blob/master/CODE_OF_CONDUCT.md) so you also help maintaining a good Open source community around this project!

Here are some tips:

- Check the [issues page](https://github.com/vcapretz/bull-board/issues) for already opened issues (or maybe even closed ones) that might already address your question/bug/feature request.
- Check the [issues page](https://github.com/felixmosh/bull-board/issues) for already opened issues (or maybe even closed ones) that might already address your question/bug/feature request.
- When opening a bug report provide as much information as you can, some things might be useful for helping debugging and understading the problem
- Node, Redis, Bull, bull-board versions
- Sample code that reproduces the problem
Expand Down Expand Up @@ -180,4 +200,4 @@ yarn && yarn start:dev

# License

This project is licensed under the [MIT License](https://github.com/vcapretz/bull-board/blob/master/LICENSE), so it means it's completely free to use and copy, but if you do fork this project with nice additions that we could have here, remember to send a PR 👍
This project is licensed under the [MIT License](https://github.com/felixmosh/bull-board/blob/master/LICENSE), so it means it's completely free to use and copy, but if you do fork this project with nice additions that we could have here, remember to send a PR 👍
8 changes: 0 additions & 8 deletions docker-compose.yml

This file was deleted.

20 changes: 12 additions & 8 deletions example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import * as Bull from 'bull';
import Queue3 from 'bull';
import { Queue as QueueMQ, QueueScheduler, Worker } from 'bullmq';
import express from 'express';
import { createBullBoard } from './src';
import { BullAdapter } from './src/queueAdapters/bull';
import { BullMQAdapter } from './src/queueAdapters/bullMQ';
import { BullMQAdapter } from '@bull-board/api/dist/queueAdapters/bullMQ';
import { BullAdapter } from '@bull-board/api/dist/queueAdapters/bull';
import { createBullBoard } from '@bull-board/api';
import { ExpressAdapter } from '@bull-board/express';

const redisOptions = {
port: 6379,
Expand Down Expand Up @@ -76,12 +77,15 @@ const run = async () => {
});
});

const { router: bullBoardRouter } = createBullBoard([
new BullMQAdapter(exampleBullMq),
new BullAdapter(exampleBull),
]);
const serverAdapter = new ExpressAdapter();
serverAdapter.setBasePath('/ui');

app.use('/ui', bullBoardRouter);
createBullBoard({
queues: [new BullMQAdapter(exampleBullMq), new BullAdapter(exampleBull)],
serverAdapter,
});

app.use('/ui', serverAdapter.getRouter());

app.listen(3000, () => {
console.log('Running on 3000...');
Expand Down
File renamed without changes.
Loading