From 838a945862de58bed928e84e0d3875e21d471888 Mon Sep 17 00:00:00 2001 From: Slawosz Slawinski Date: Thu, 13 Mar 2014 17:40:04 +0100 Subject: [PATCH] feat(Vagrantfile): Add Vagrantfile for easy start --- .gitignore | 1 + Documentation/development-tools.md | 12 ++++++++++++ README.md | 4 ++++ Vagrantfile | 27 +++++++++++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 Documentation/development-tools.md create mode 100644 Vagrantfile diff --git a/.gitignore b/.gitignore index 2ca1c3eed..26fc7695d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /machine* /bin /src +.vagrant diff --git a/Documentation/development-tools.md b/Documentation/development-tools.md new file mode 100644 index 000000000..08473988e --- /dev/null +++ b/Documentation/development-tools.md @@ -0,0 +1,12 @@ +# Development tools + +## Vagrant + +For fast start you can use Vagrant. `vagrant up` will make etcd build and running on virtual machine. Required Vagrant version is 1.5.0. + +Next lets set a single key and then retrieve it: + +``` +curl -L http://127.0.0.1:4001/v2/keys/mykey -XPUT -d value="this is awesome" +curl -L http://127.0.0.1:4001/v2/keys/mykey +``` diff --git a/README.md b/README.md index b500720c2..56eba30b1 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,10 @@ _NOTE_: you need go 1.2+. Please check your installation with go version ``` +See the [development tools documentation][development-tools.md] for alternative build methods like using Vagrant. + +[development-tools.md]: https://github.com/coreos/etcd/blob/master/Documentation/development-tools.md + ### Running First start a single machine cluster of etcd: diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 000000000..c41a26ef5 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,27 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : +# +Vagrant.require_version '>= 1.5.0' +Vagrant.configure("2") do |config| + config.vm.box = "precise64" + config.vm.box_url = "http://files.vagrantup.com/precise64.box" + + config.vm.network :forwarded_port, host: 4001, guest: 4001 + config.vm.network :forwarded_port, host: 7001, guest: 7001 + + # Fix docker not being able to resolve private registry in VirtualBox + config.vm.provider :virtualbox do |vb, override| + vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] + vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] + end + + config.vm.provision "docker" do |d| + d.build_image "/vagrant", args: '-t etcd' + d.run "etcd", args: "-p 4001:4001 -p 7001:7001", demonize: true + end + + # plugin conflict + if Vagrant.has_plugin?("vagrant-vbguest") + config.vbguest.auto_update = false + end +end