Skip to content

a demo stack to see Nomad & Consul Connect capabilities

Notifications You must be signed in to change notification settings

learn-nomad-consul/demo-stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nomad & Consul Connect demo stack

archi

Requirements

  • virtualbox
  • vagrant

This project uses Ansible but you don't need it on your host : it's installed on a VM by Vagrant and provisions everything from there.

tech stack

  • Packer : bake a custom image with everything instance agnostic installed and setup

  • Cloud-init : set everything instance specific

  • Vagrant : start the VMs

  • Consul & Consul Connect : service discovery, internal DNS & service mesh

  • Nomad : orchestration

  • Jaeger : distributed tracing

  • Prometheus (monitoring)

  • Fluent-bit & Loki (logs)

  • Grafana (visualization)

  • Terraform (manage Nomad & Consul in a fully declarative way)

Run

We'll use the same custom baked image for every VM.

It's based on the "hashicorp/bionic64" (it's an ubuntu) image and installs on it

  • consul
  • cni-plugins (used by consul connect)
  • nomad
  • terraform
vagrant plugin install vagrant-cloudinit
vagrant up

That's it ! Have a cup of coffee while looking at Vagrant upping the VMs and setting everything for you.

Setup Nomad & Consul services

vagrant ssh ci

cd ~/consul/
terraform init
terraform apply

cd ~/nomad/
terraform init
terraform apply

Check

NB : the ssh password is vagrant

Consul :

ssh -L localhost:8500:localhost:8500 -i ./.vagrant/machines/monitoring/virtualbox/private_key vagrant@172.16.2.10

open http://localhost:8500

Nomad :

ssh -L localhost:4646:localhost:4646 -i ./.vagrant/machines/monitoring/virtualbox/private_key vagrant@172.16.2.10

open http://localhost:4646

Jaeger :

ssh -L localhost:16686:localhost:16686 -i ./.vagrant/machines/monitoring/virtualbox/private_key vagrant@172.16.2.10

then http://localhost:16686

Prometheus :

ssh -L localhost:9090:localhost:9090 -i ./.vagrant/machines/monitoring/virtualbox/private_key vagrant@172.16.2.10

then http://localhost:9090

Grafana :

ssh -L localhost:3000:localhost:3000 -i ./.vagrant/machines/monitoring/virtualbox/private_key vagrant@172.16.2.10

then http://localhost:3000

App :

curl 172.16.1.10:9090
"==> echo 1"

curl 172.16.1.10:9090/v2
"==> echo 2"

Nota Bene

Due to a current issue in Nomad, upgrading the Connect stanza of a job needs to do

nomad job stop <nameOfTheJob>
nomad run ./job.hcl