A demo repository of Consul Template and the Consult ruby gem
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
consul-template
.gitignore
Dockerfile-ubuntu
Gemfile
Gemfile.lock
README.md
demo-template.yml
docker-compose.yml
render.rb

README.md

Consul Template and Consult Demo

The purpose of this repository is to serve as a baseline demonstration of templating configuration out from Consul and Vault, using Consul Template and Consult.

Getting Started

Make sure you have Docker CE installed. Then, clone this repo and do the following:

$ docker-compose build
$ docker-compose up

This will boot three containers, one for Vault, one for Consul, and one basic Ubuntu container to execute commands against Consul and Vault. The latest version of each container will be pulled. Run docker-compose ps to see your running containers.

Accessing Consul

Accessing Vault

The Vault root token is set to 11111111-2222-3333-4444-555555555555.

Prepare some data

Access the Ubuntu container and store some data in Consul and Vault.

$ docker exec -it consul-vault-templating_ubuntu_1 /bin/bash
$ vault kv put secret/launch_codes password=h4v3-1-b33n-pwned
$ consul kv put hello veracross

Now you are ready to template this data out.

Consul Template

A functioning example of Consul Template is in the consul-template directory.

Relevant files:

  • consul-template/demo-template.yml.tmpl

To try it:

$ cd /demo/consul-template
$ consul-template -template "demo-template.yml.tmpl:demo-template.yml:cat demo-template.yml" -vault-renew-token=false

Consult

Consult is a ruby library, somewhat similar to Consul Template.

Relevant files:

  • config/consult.yml
  • render.rb

To try it:

$ cd /demo
$ bundle install
$ ./render.rb