v0.1
Triton trusted Consul v0.1
Consul in Docker, designed for availability and durability.
Prep your environment
- Get a Joyent account and add your SSH key.
- Install and the Docker Engine (including
docker
anddocker-compose
) on your laptop or other environment, along with the Joyent CloudAPI CLI tools (including thesmartdc
andjson
tools). - Configure your Docker CLI and Compose for use with Joyent:
curl -O https://raw.githubusercontent.com/joyent/sdc-docker/master/tools/sdc-docker-setup.sh && chmod +x sdc-docker-setup.sh
./sdc-docker-setup.sh -k us-east-1.api.joyent.com <ACCOUNT> ~/.ssh/<PRIVATE_KEY_FILE>
Start a trusted Consul raft
- Clone or download this repo
cd
into the cloned or downloaded directory- Execute
bash start.sh
to start everything up - The Consul dashboard should automatically open in your browser, or follow the links output by the
start.sh
script
Use this in your own composition
Detailed example to come....
How it works
This demo actually sets up two independent Consul services:
- A single-node instance used only for bootstrapping the raft
- A three-node instance that other applications can point to
A running raft has no dependency on the bootstrap instance. New raft instances do need to connect to the bootstrap instance to find the raft, creating a failure gap that is discussed below. If a raft instance fails, the data is preserved among the other instances and the overall availability of the service is preserved because any single instance can authoritatively answer for all instances. Applications that depend on the Consul service should re-try failed requests until they get a response.
Each raft instance will constantly re-register with the bootstrap instance. If the boostrap instance or its data is lost, a new bootstrap instance can be started and all existing raft instances will re-register with it. In a scenario where the bootstrap instance is unavailable, it will be impossible to start raft instances until the bootstrap instance has been restarted and at least one existing raft member has reregistered.
Triton-specific availability advantages
Some details about how Docker containers work on Triton have specific bearing on the durability and availability of this service:
- Docker containers are first-order objects on Triton. They run on bare metal, and their overall availability is similar or better than what you expect of a virtual machine in other environments.
- Docker containers on Triton preserve their IP and any data on disk when they reboot.
- Linked containers in Docker Compose on Triton are actually distributed across multiple unique physical nodes for maximum availability in the case of node failures.
Credit where it's due
This project builds on the fine examples set by Jeff Lindsay's (Glider Labs) Consul in Docker work. It also, obviously, wouldn't be possible without the outstanding work of the Hashicorp team that made consul.io.