This system is a distributed implementation of the Paxos consensus algorithm in Go, orchestrated using Docker and Docker Compose to simulate multiple nodes. The primary goal of the system is to achieve consensus across distributed nodes, with each node playing a specific role such as a Proposer, Acceptor, or Learner. More details on the implementation and the Algorithm can be found in REPORT
It is built with Docker and Docker Compose, enabling the setup of multiple nodes for testing. The project includes two test cases, each managed by a separate Docker Compose file. A Makefile is provided to streamline building, running, and cleaning up the test environment.
Ensure you have the following installed on your machine:
The Makefile in this project provides several commands to manage the Docker environment. Below is a list of commands and their descriptions.
To build the Docker image for this project:
make build
This command builds a Docker image named prj4
as specified in the Makefile. Run this command once, or after making changes to the Dockerfile.
There are two test cases defined in separate Docker Compose files:
docker-compose-testcase-1.yml
docker-compose-testcase-2.yml
To run each test case, use the following commands:
make test1
This command:
- Builds the Docker image if it hasn’t been built already.
- Uses
docker-compose-testcase-1.yml
to bring up the required containers for the first test case.
make test2
This command:
- Builds the Docker image if needed.
- Uses
docker-compose-testcase-2.yml
to bring up the required containers for the second test case.
After running a test case, use these commands to stop and remove containers for each test case:
make down-test1
make down-test2
These commands will stop the containers defined in the respective Docker Compose files, freeing up resources.
To run both test cases one after the other, use:
make test
This command:
- Runs
make test1
, thenmake down-test1
to stop containers for the first test case. - Runs
make test2
, thenmake down-test2
to stop containers for the second test case.
To fully clean up the environment, removing images, unused volumes, networks, and containers:
make clean
This command:
- Stops any running containers for both test cases.
- Removes the Docker image (
prj4
). - Prunes unused Docker volumes, networks, and containers to ensure a fresh start.
To view a list of all available Makefile commands:
make help
This command displays the available targets in the Makefile and their descriptions.
- Running
make test
will automatically handle both test cases sequentially, making it convenient for complete test cycles. - The
make clean
command is powerful and will remove unused Docker resources, so use it carefully in multi-project environments.