Skip to content

Latest commit

 

History

History

docker-multi-worker-no-kafka

3 Workers

This project contains the following components:

  • Redis: In-memory data structure store used as a database, cache, and message broker.
  • 3 Workers: Task workers responsible for executing scheduled tasks. Each worker can process tasks independently, providing horizontal scalability.
  • Nginx: Loadbalancer and revers proxy at front of 3 worker nodes (application).

Quick Start

Make sure to have Docker Compose installed on your machine, then run the Docker Compose command:

export COMPOSE_PROJECT_NAME=delay-box
docker-compose -p delay-box up -d

This command builds the latest images and starts the services in detached mode.

Wait until all workers are up and running (you'll see a message in their console: "🚀 scheduler is ready!").

Then, run the following command. The task type is SHELL_CMD, which means it will execute on any defined worker nodes at the given timestamp. The payload is a simple OS date command.

sh ./create-task.sh

To get a list of pending tasks (first 100 tasks) from your local machine, run:

curl "http://localhost:8088/api/task"

Clean up

To stop and remove the containers, volumes, and networks created by Docker Compose, run:

docker-compose down -v

Supported Architectures

  • linux/amd64
  • linux/arm64