Browse Source

Demo: configurable Consul version

- Add CONSUL_DEMO_VERSION env var for specifying Consul version
pull/2651/head
Brian Shumate 8 years ago
parent
commit
0c9b9a4874
No known key found for this signature in database
GPG Key ID: B2E211633F870928
  1. 13
      demo/vagrant-cluster/README.md
  2. 18
      demo/vagrant-cluster/Vagrantfile

13
demo/vagrant-cluster/README.md

@ -11,7 +11,7 @@ vagrant up
``` ```
> NOTE: If you prefer a different Vagrant box, you can set the `DEMO_BOX_NAME` > NOTE: If you prefer a different Vagrant box, you can set the `DEMO_BOX_NAME`
> environment variable before Starting Vagrant like this: > environment variable before starting `vagrant` like this:
> `DEMO_BOX_NAME="ubuntu/xenial64" vagrant up` > `DEMO_BOX_NAME="ubuntu/xenial64" vagrant up`
Once it is finished, you should be able to see the following: Once it is finished, you should be able to see the following:
@ -29,7 +29,7 @@ At this point the two nodes are running and you can SSH in to play with them:
``` ```
vagrant ssh n1 vagrant ssh n1
consul version consul version
Consul v0.7.1 Consul v0.7.2
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents) Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
exit exit
``` ```
@ -39,12 +39,17 @@ and
``` ```
vagrant ssh n2 vagrant ssh n2
consul version consul version
Consul v0.7.1 Consul v0.7.2
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents) Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
exit exit
``` ```
> NOTE: This demo will install the latest Consul release version by default,
> but if you prefer a different version, you can set the `CONSUL_DEMO_VERSION`
> environment variable before starting `vagrant` like this:
> `CONSUL_DEMO_VERSION=0.6.4 vagrant up`
## Where to Next? ## Where to Next?
To learn more about starting Consul, joining nodes to a cluster, and To learn more about starting Consul, joining nodes into a cluster, and
interacting with the agent, check out the [Getting Started guide](https://www.consul.io/intro/getting-started/install.html). interacting with the agent, check out the [Getting Started guide](https://www.consul.io/intro/getting-started/install.html).

18
demo/vagrant-cluster/Vagrantfile vendored

@ -1,16 +1,17 @@
# -*- mode: ruby -*- # -*- mode: ruby -*-
# vi: set ft=ruby : # vi: set ft=ruby :
$script = <<SCRIPT $script = <<SCRIPT
echo Installing dependencies... echo "Installing dependencies ..."
sudo apt-get update sudo apt-get update
sudo apt-get install -y unzip curl sudo apt-get install -y unzip curl
echo Fetching Consul... echo "Fetching Consul version ${CONSUL_DEMO_VERSION} ..."
cd /tmp/ cd /tmp/
curl -s https://releases.hashicorp.com/consul/0.7.1/consul_0.7.1_linux_amd64.zip -o consul.zip curl -s https://releases.hashicorp.com/consul/${CONSUL_DEMO_VERSION}/consul_${CONSUL_DEMO_VERSION}_linux_amd64.zip -o consul.zip
echo Installing Consul... echo "Installing Consul version ${CONSUL_DEMO_VERSION} ..."
unzip consul.zip unzip consul.zip
sudo chmod +x consul sudo chmod +x consul
sudo mv consul /usr/bin/consul sudo mv consul /usr/bin/consul
@ -20,8 +21,11 @@ sudo chmod a+w /etc/consul.d
SCRIPT SCRIPT
# Specify a Consul version
CONSUL_DEMO_VERSION = ENV['CONSUL_DEMO_VERSION'] || "0.7.2"
# Specify a custom Vagrant box for the demo # Specify a custom Vagrant box for the demo
DEMO_BOX_NAME = ENV['DEMO_BOX_NAME'] || "debian/jessie64" DEMO_BOX_NAME = ENV['DEMO_BOX_NAME'] || "debian/jessie64"
# Vagrantfile API/syntax version. # Vagrantfile API/syntax version.
# NB: Don't touch unless you know what you're doing! # NB: Don't touch unless you know what you're doing!
@ -30,7 +34,9 @@ VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = DEMO_BOX_NAME config.vm.box = DEMO_BOX_NAME
config.vm.provision "shell", inline: $script config.vm.provision "shell",
inline: $script,
env: {'CONSUL_DEMO_VERSION' => CONSUL_DEMO_VERSION}
config.vm.define "n1" do |n1| config.vm.define "n1" do |n1|
n1.vm.hostname = "n1" n1.vm.hostname = "n1"

Loading…
Cancel
Save