Replace Virtualbox usage with KVM
This commit is contained in:
parent
c0cd056d1b
commit
729162fe72
12
Vagrantfile
vendored
12
Vagrantfile
vendored
@ -2,7 +2,7 @@
|
|||||||
# vi: set ft=ruby :
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
config.vm.box = "ubuntu/xenial64"
|
config.vm.box = "promenade/ubuntu1604"
|
||||||
config.vm.box_check_update = false
|
config.vm.box_check_update = false
|
||||||
|
|
||||||
config.vm.provision :shell, privileged: true, inline:<<EOS
|
config.vm.provision :shell, privileged: true, inline:<<EOS
|
||||||
@ -13,10 +13,12 @@ apt-get update -qq
|
|||||||
apt-get install -y -qq --no-install-recommends chrony
|
apt-get install -y -qq --no-install-recommends chrony
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
config.vm.provider "virtualbox" do |vb|
|
config.vm.synced_folder ".", "/vagrant", :nfs => true
|
||||||
vb.cpus = 2
|
|
||||||
vb.memory = "2048"
|
config.vm.provider "libvirt" do |lv|
|
||||||
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
|
lv.cpus = 2
|
||||||
|
lv.memory = "2048"
|
||||||
|
lv.nested = true
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.define "n0" do |c|
|
config.vm.define "n0" do |c|
|
||||||
|
@ -4,8 +4,16 @@
|
|||||||
|
|
||||||
### Deployment using Vagrant
|
### Deployment using Vagrant
|
||||||
|
|
||||||
Make sure you have [Vagrant](https://vagrantup.com) and
|
Deployment using Vagrant uses KVM instead of Virtualbox due to better
|
||||||
[VirtualBox](https://www.virtualbox.org/wiki/Downloads) installed.
|
performance of disk and networking, which both have significant impact on the
|
||||||
|
stability of the etcd clusters.
|
||||||
|
|
||||||
|
Make sure you have [Vagrant](https://vagrantup.com) installed, then
|
||||||
|
run `./tools/full-vagrant-setup.sh`, which will do the following:
|
||||||
|
|
||||||
|
* Install Vagrant libvirt plugin and its dependencies
|
||||||
|
* Install NFS dependencies for Vagrant volume sharing
|
||||||
|
* Install [packer](https://packer.io) and build a KVM image for Ubuntu 16.04
|
||||||
|
|
||||||
Generate the per-host configuration, certificates and keys to be used:
|
Generate the per-host configuration, certificates and keys to be used:
|
||||||
|
|
||||||
|
24
tools/build-vagrant-box.sh
Executable file
24
tools/build-vagrant-box.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
WORKDIR=$(mktemp -d)
|
||||||
|
|
||||||
|
function cleanup {
|
||||||
|
rm -rf "${WORKDIR}"
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y --no-install-recommends \
|
||||||
|
curl \
|
||||||
|
unzip
|
||||||
|
|
||||||
|
git clone https://github.com/jakobadam/packer-qemu-templates.git ${WORKDIR}
|
||||||
|
|
||||||
|
cd ${WORKDIR}/ubuntu
|
||||||
|
|
||||||
|
packer build -var-file=ubuntu1604.json ubuntu-vagrant.json
|
||||||
|
|
||||||
|
vagrant box add promenade/ubuntu1604 box/libvirt/ubuntu1604-1.box
|
9
tools/full-vagrant-setup.sh
Executable file
9
tools/full-vagrant-setup.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(dirname $0)
|
||||||
|
|
||||||
|
$SCRIPT_DIR/install-vagrant-nfs-deps.sh
|
||||||
|
$SCRIPT_DIR/install-vagrant-libvirt.sh
|
||||||
|
$SCRIPT_DIR/install-packer.sh
|
21
tools/install-packer.sh
Executable file
21
tools/install-packer.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
PACKER_VERSION=${PACKER_VERSION:-1.0.3}
|
||||||
|
|
||||||
|
WORKDIR=$(mktemp -d)
|
||||||
|
|
||||||
|
function cleanup {
|
||||||
|
rm -rf "${WORKDIR}"
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
cd ${WORKDIR}
|
||||||
|
|
||||||
|
curl -Lo packer.zip https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip
|
||||||
|
|
||||||
|
unzip packer.zip
|
||||||
|
|
||||||
|
sudo mv packer /usr/local/bin/
|
22
tools/install-vagrant-libvirt.sh
Executable file
22
tools/install-vagrant-libvirt.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
|
||||||
|
sudo apt-get build-dep -y \
|
||||||
|
ruby-libvirt
|
||||||
|
|
||||||
|
sudo apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
dnsmasq \
|
||||||
|
ebtables \
|
||||||
|
libvirt-bin \
|
||||||
|
libvirt-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
libxslt-dev \
|
||||||
|
qemu \
|
||||||
|
ruby-dev \
|
||||||
|
zlib1g-dev
|
||||||
|
|
||||||
|
vagrant plugin install vagrant-libvirt
|
9
tools/install-vagrant-nfs-deps.sh
Executable file
9
tools/install-vagrant-nfs-deps.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y --no-install-recommends \
|
||||||
|
nfs-common \
|
||||||
|
nfs-kernel-server \
|
||||||
|
portmap
|
Loading…
Reference in New Issue
Block a user