This sample demonstrates how to deploy a BullMQ message queue on top of managed Redis with a queue processor and a dashboard to monitor the queue.
Once your app is up and running you can go to the /board
route for the board
service to see the Bull Board dashboard and use the username admin
and the board password you set to log in (see Configuration).
To add a job to the queue, you can go to the /add
route of the api
service. This will use some default values so you can test things out. You can also see an example of a post request in the sample HTTP request file.
The worker
service is the queue processor that will process the jobs added to the queue. You can see in the compose.yaml
file that the worker
service is set to scale to 2 instances. This means that there will be 2 workers processing jobs from the queue. You can set this to your desired number of workers, but we wanted to show how you can increase the number of workers to handle more jobs.
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
To run the application locally, you can use the following command:
docker compose -f compose.dev.yaml up --build
For this sample, you will need to provide the following configuration:
Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
Set a board password and use together with the board username admin
when signing in.
defang config set BOARD_PASSWORD
defang config set QUEUE
Note
Download Defang CLI
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: BullMQ & BullBoard & Redis
Short Description: A sample project with BullMQ, BullBoard, and Redis.
Tags: BullMQ, BullBoard, Redis, Express, Node.js, Message Queue, JavaScript
Languages: nodejs