commit
8fba3d56b7
|
@ -1,27 +1,50 @@
|
||||||
# Vagrant Consul Demo
|
# Vagrant Consul Demo
|
||||||
|
|
||||||
This demo provides a very simple Vagrantfile that creates two nodes,
|
This demo provides a very simple `Vagrantfile` that creates two Consul
|
||||||
one at "172.20.20.10" and another at "172.20.20.11". Both are running
|
server nodes, one at *172.20.20.10* and another at *172.20.20.11*. Both are
|
||||||
a standard Debian 7 distribution, and Consul is pre-installed.
|
running a standard Debian * distribution, and Consul is pre-installed.
|
||||||
|
|
||||||
To get started, you can start the cluster by just doing:
|
To get started, you can start the nodes by just doing:
|
||||||
|
|
||||||
$ vagrant up
|
```
|
||||||
|
vagrant up
|
||||||
|
```
|
||||||
|
|
||||||
|
> NOTE: If you prefer a different Vagrant box, you can set the `DEMO_BOX_NAME`
|
||||||
|
> environment variable before Starting Vagrant like this:
|
||||||
|
> `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:
|
||||||
|
|
||||||
$ vagrant status
|
```
|
||||||
|
vagrant status
|
||||||
Current machine states:
|
Current machine states:
|
||||||
n1 running (vmware_fusion)
|
|
||||||
n2 running (vmware_fusion)
|
n1 running (virtualbox)
|
||||||
|
n2 running (virtualbox)
|
||||||
|
```
|
||||||
|
|
||||||
At this point the two nodes are running and you can SSH in to play with them:
|
At this point the two nodes are running and you can SSH in to play with them:
|
||||||
|
|
||||||
$ vagrant ssh n1
|
```
|
||||||
...
|
vagrant ssh n1
|
||||||
$ vagrant ssh n2
|
consul version
|
||||||
...
|
Consul v0.7.1
|
||||||
|
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
|
||||||
|
exit
|
||||||
|
```
|
||||||
|
|
||||||
To learn more about starting Consul, joining nodes and interacting with the agent,
|
and
|
||||||
checkout the [getting started guide](https://www.consul.io/intro/getting-started/install.html).
|
|
||||||
|
|
||||||
|
```
|
||||||
|
vagrant ssh n2
|
||||||
|
consul version
|
||||||
|
Consul v0.7.1
|
||||||
|
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
|
||||||
|
exit
|
||||||
|
```
|
||||||
|
|
||||||
|
## Where to Next?
|
||||||
|
|
||||||
|
To learn more about starting Consul, joining nodes to a cluster, and
|
||||||
|
interacting with the agent, check out the [Getting Started guide](https://www.consul.io/intro/getting-started/install.html).
|
||||||
|
|
|
@ -8,7 +8,7 @@ sudo apt-get install -y unzip curl
|
||||||
|
|
||||||
echo Fetching Consul...
|
echo Fetching Consul...
|
||||||
cd /tmp/
|
cd /tmp/
|
||||||
curl 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/0.7.1/consul_0.7.1_linux_amd64.zip -o consul.zip
|
||||||
|
|
||||||
echo Installing Consul...
|
echo Installing Consul...
|
||||||
unzip consul.zip
|
unzip consul.zip
|
||||||
|
@ -20,11 +20,15 @@ sudo chmod a+w /etc/consul.d
|
||||||
|
|
||||||
SCRIPT
|
SCRIPT
|
||||||
|
|
||||||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
# Specify a custom Vagrant box for the demo
|
||||||
|
DEMO_BOX_NAME = ENV['DEMO_BOX_NAME'] || "debian/jessie64"
|
||||||
|
|
||||||
|
# Vagrantfile API/syntax version.
|
||||||
|
# NB: Don't touch unless you know what you're doing!
|
||||||
VAGRANTFILE_API_VERSION = "2"
|
VAGRANTFILE_API_VERSION = "2"
|
||||||
|
|
||||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
config.vm.box = "debian/wheezy64"
|
config.vm.box = DEMO_BOX_NAME
|
||||||
|
|
||||||
config.vm.provision "shell", inline: $script
|
config.vm.provision "shell", inline: $script
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue