Getting Started with Consul

Consul is a tool that provides Service Discovery, Distributed Failure Detection, and a Key/Value Store with support for multiple datacenters. In this course, you'll learn how to use Consul to build scalable and reliable infrastructure.
Course info
Rating
(59)
Level
Intermediate
Updated
Aug 17, 2016
Duration
4h 16m
Table of contents
Course Overview
Why Consul?
Monitoring Nodes
Service Discovery
Dynamic LB Config with consul-template
Reactive Configuration via Key/Value Store
Health Checking
Description
Course info
Rating
(59)
Level
Intermediate
Updated
Aug 17, 2016
Duration
4h 16m
Description

Application development is increasingly moving toward small, cohesive services instead of monolithic applications. In this course, Getting Started with Consul, you'll learn how to use Consul to build scalable and reliable infrastructure. You'll see how Service Discovery affords the ability to easily wire up services to talk to each other. With Distributed Failure Detection, your infrastructure can react in real-time to changes in the health of your services. Traffic will be routed to healthy nodes and services giving unhealthy nodes the chance to self-heal. Consul provides this and a revolutionary means of configuring applications via a Key/Value Store. No more need for static configuration files. And the best part is that Consul supports this across all of your Datacenters providing a consistent framework. When you're finished with this course, you will have a great understanding of the benefits that Consul provides and you'll be able to bring this revolutionary functionality to your organization. Software required: Vagrant.

About the author
About the author

Wes Higbee is passionate about helping companies achieve remarkable results with technology and software. He’s had extensive experience developing software and working with teams to improve how software is developed to meet business objectives. Wes launched Full City Tech to leverage his expertise to help companies delight customers.

More from the author
What Is DevOps: Executive Briefing
Beginner
22m
Nov 2, 2018
Implementing a Self-hosted Docker Registry
Intermediate
4h 8m
Jun 5, 2018
Webpack: Transpiling and Bundling JavaScript
Intermediate
4h 55m
Jan 30, 2018
More courses by Wes Higbee
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hello, my name is Wes Higbee. Welcome to my course Getting Started with Consul. Let's face it, configuring software these days to connect our services together especially with the explosion of services that we now have to support, it's just not fun. Hard coding IP addresses or host names into config files and then trying to update those when it's time to change and deploy new versions of our software, it's nothing but a hassle. And with the advent of Docker, and the explosion of services that we're likely to have in the future, the need to be able to discover services is becoming a critical part of the infrastructure to host our software. Consul happens to be one of the best tools to help you discover your services and connect them together dynamically. In this course I will take you through everything you need to get up and running with Consul quickly to understand how Consul provides service discovery to see the integrated DNS and HTTP APIs that are built into Consul to take a look at the integrated health checking and even see how we can configure applications' other aspects like settings and features in our applications, how we can configure these with Consul's key value store. By the end of the course you'll know everything you need to get Consul up and running and to be able to use it to connect your software components together to discover services. The only prerequisite is that you have an interest in this subject and maybe some interest and/or experience with running commands in a shell. If this sounds like what you're looking for, then join me as I take you through getting started with Consul.

Service Discovery
Wow did we build out a lot of infrastructure on the last module. We have all these nodes up and running. We have Consul agents running on them and we have them all communicating with each other so we can monitor the status of our nodes. In this module we'll turn our attention to service discovery which is the other half of this equation. So we've built out a catalog of nodes and we can see how we can access those nodes, find out about their status right here inside of this beautiful Consul Web UI. So naturally it makes sense to turn to the service catalog next and get this flushed out. Let's back up a bit here in our diagram. The bottom two nodes, our server and our desktop. Those are both pretty much set up as we need them right now. First we're going to turn our attention to building out the web servers. Those web servers will have NGINX running on them and we'll do that via Docker just to keep things simple. And don't worry Docker's already installed on that base image so you don't have to do anything to set it up. We'll run NGINX on port 8080. We already have the Consul agent on this node so we don't need to worry about that. And then we'll go ahead and duplicate this node two more times so we have web two and three set up the exact same way. So our web servers will be sitting here waiting for some traffic so we'll throw our load balancer in front by firing up HAProxy, listening in on port 80 and again via Docker. We already have Consul on this node so we don't need to worry about that. And then we'll take a look all along the way of what it looks like for a user to interact with our load balancer and make request to our pool of web servers. Let's get started.

Dynamic LB Config with consul-template
Our web services are up and running. Now let's take the time to set up our load balancer. We've already got the health checks in place and the service registered for the load balancer. Let's fire this puppy up and get this health check passing. To do this, let's first zoom in on what's going on in this node so we can follow our process. So right now on our load balancer, we have the consul agent up and running and on that load balancer node we would like to get HAProxy installed and running. And again to simplify this we use docker, just like we did with nginx to make it a one line command to fire this puppy up. HAProxy takes a config file, so we'll need to create this config file for it to read, for it to know what exactly it's supposed to do. And we'll start out with a static config file to begin with, like we would before we moved to tier legged consul. And then after we get this in place, we'll come back to this diagram and talk about how we can integrate consul and HAProxy.

Health Checking
We've already seen health checking and its integration with service discovery. So we know how the plumbing works. In this module, we're going to dive deeper and look at more of the types of health checking we can perform and create some of our own custom health checks.