demo: Adding a basic vagrant file for a simple cluster
This commit is contained in:
parent
477a7e3177
commit
4209f378a3
|
@ -0,0 +1,27 @@
|
|||
# Vagrant Consul Demo
|
||||
|
||||
This demo provides a very simple Vagrantfile that creates two nodes,
|
||||
one at "172.20.20.10" and another at "172.20.20.11". Both are running
|
||||
a standard Ubuntu 12.04 distribution, and Consul is pre-installed.
|
||||
|
||||
To get started, you can start the cluster by just doing:
|
||||
|
||||
$ vagrant up
|
||||
|
||||
Once it is finished, you should be able to see the following:
|
||||
|
||||
$ vagrant status
|
||||
Current machine states:
|
||||
n1 running (vmware_fusion)
|
||||
n2 running (vmware_fusion)
|
||||
|
||||
At this point the two nodes are running and you can SSH in to play with them:
|
||||
|
||||
$ vagrant ssh n1
|
||||
...
|
||||
$ vagrant ssh n2
|
||||
...
|
||||
|
||||
To learn more about starting Consul, joining nodes and interacting with the agent,
|
||||
checkout the [getting started guide](http://www.consul.io/intro/getting-started/install.html).
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
$script = <<SCRIPT
|
||||
|
||||
echo Installing depedencies...
|
||||
sudo apt-get install -y unzip
|
||||
|
||||
echo Fetching Consul...
|
||||
cd /tmp/
|
||||
wget https://dl.bintray.com/mitchellh/consul/0.1.0_linux_amd64.zip -O consul.zip
|
||||
|
||||
echo Installing Consul...
|
||||
unzip consul.zip
|
||||
sudo chmod +x consul
|
||||
sudo mv consul /usr/bin/consul
|
||||
|
||||
SCRIPT
|
||||
|
||||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
||||
VAGRANTFILE_API_VERSION = "2"
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
config.vm.box = "hashicorp/precise64"
|
||||
|
||||
config.vm.provision "shell", inline: $script
|
||||
|
||||
config.vm.define "n1" do |n1|
|
||||
n1.vm.network "private_network", ip: "172.20.20.10"
|
||||
end
|
||||
|
||||
config.vm.define "n2" do |n2|
|
||||
n2.vm.network "private_network", ip: "172.20.20.11"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue