Development Environment Setup for Danube Broker
This document guides you through setting up the development environment, running danube broker instances, and be able to effectively contribute to the code.
Prerequisites
Before you get started, make sure you have the following installed:
-
Rust: Ensure you have Rust installed. You can download and install it from the Rust website.
-
Docker: Install Docker if you haven’t already. Follow the installation instructions on the Docker website.
Contributing to the Repository
-
Fork the Repository:
-
Go to the Danube Broker GitHub repository.
-
Click the "Fork" button on the top right corner of the page to create your own copy of the repository.
-
Clone Your Fork:
Once you have forked the repository, clone your forked repository:
- Add the Original Repository as a Remote (optional but recommended for keeping up-to-date):
Building the Project
- Build the Project:
To build the Danube Broker:
Running ETCD
- Start ETCD:
Use the Makefile to start an ETCD instance. This will run ETCD in a Docker container.
- Clean Up ETCD:
To stop and remove the ETCD instance and its data:
Running a Single Broker Instance
- Start ETCD:
Ensure ETCD is running. If not, use the make etcd
command to start it.
- Run the Broker:
Use the following command to start a single broker instance:
Running Multiple Broker Instances
- Start ETCD:
Ensure ETCD is running. Use:
- Run Multiple Brokers:
Use the following Makefile command to start multiple broker instances:
This will start brokers on ports 6650, 6651, and 6652. Logs for each broker will be saved in temp/
directory.
- Clean Up Broker Instances:
To stop all running broker instances:
Reading Logs
Logs for each broker instance are stored in the temp/
directory. You can view them using:
Replace <port>
with the actual port number (6650, 6651, or 6652).
Inspecting ETCD Metadata
- Set Up
etcdctl
:
Export the following environment variables:
- Inspect Metadata:
Use etcdctl
commands to inspect metadata. For example, to list all keys:
To get a specific key:
Makefile Targets Summary
make etcd
: Starts an ETCD instance in Docker.make etcd-clean
: Stops and removes the ETCD instance and its data.make brokers
: Builds and starts broker instances on predefined ports.make brokers-clean
: Stops and removes all running broker instances.
Troubleshooting
- ETCD Not Starting: Check Docker logs and ensure no other service is using port 2379.
- Broker Not Starting: Ensure ETCD is running and accessible at the specified address and port.