An academic exercise in building a distributed system, named in honor of Turing Award Winner Leslie Lamport. The purpose of this project is to explore the complexities involved with building a distributed computing system. The origins of this project are a 2016 presentation for the Distributed Computing Denver Meetup group.
To get your local development environment setup, follow these steps:
- Download Git and follow the first time Git setup
- Take a moment to walkthrough the Getting Started to install Go into your local development environment
- Read through the "How to Write Go Code" to setup your GOPATH and workspace
- Clone this repository:
git clone https://github.com/Distributed-Computing-Denver/lamport.git
Lamport uses Git tags to provide developers with a way to see incremental features being added to the project. A new developer will want to fetch the lowest numbered tag/feature. The wiki will be updated to provide users context on the feature that was added, as well as some design decisions that imfluenced the choices.
Once you've cloned the repository as outlined above, and made sure to setup your workspace, navigate to the root folder of the project and run:
go build
Assuming you've setup your Go workspace correctly, an exectuable file named "lamport" is created. You can now start lamport by running:
./lamport
Please note that you need an instance of a Zookeeper server running if Lamport is using the Zookeeper library for leader election in order for Lamport to start successfully.
You can get information about Lamport's command line flags by running:
./lamport -h
Coming soon will be build scripts and infrastructure as code that will allow you to get Lamport and it's depedencies up and running (pull requests are very much welcome). The idea is that operations folks can run Lamport to get a feel for running a distributed system. Lamport intends to be fully operationalized as each feature is added. Stay tuned for more details.
Lamport is configured via a TOML configuration file. The application defaults to lamport.toml, though you can specify a different configuration file via a command line arg. The following values are defined in the file:
- ElectionLibrary - The library to use for leader elections. This value must be either "Raft" or "Zookeeper". The default is Zookeeper.
- Host - The hostname that Lamport runs on and uses to advertise connections. The default is 127.0.0.1
- LamportPort - The port name that the Lamport server uses to connect. The default is 5936.
- RaftDir - The directory the Raft library uses to store data about the state of the Raft cluster. The default is .raftDir.
- RaftPort - The port the Raft library uses to communicate on. The default is 8500.
To run tests for lamport you'll need to install Apache Zookeeper locally, and add the 'bin' directory of the distribution to the $PATH variable of the user running the tests. One this is done, you can execute tests by running the following command:
go test ./...
The tests will spin up a local instance of Zookeeper, and clean up any changes made to Zookeeper within the test suite.
MIT