Commit fed952b8 authored by ale's avatar ale
Browse files

update Vagrant test env for etcd 2

parent 27b8ee93
......@@ -5,6 +5,10 @@
# if you want to use local packages, in which case the 'etcd' and
# 'autoradio' packages should be placed in the same directory as this
# file.
#
# If you have an APT proxy available, you can set the APT_PROXY environment
# variable to its host:port address, and the VMs will use it to retrieve
# Debian packages. This will make the setup step faster.
API_VERSION = "2"
......@@ -19,12 +23,33 @@ cat >/etc/hosts <<EOF
EOF
SCRIPT
# Static configuration for etcd.
$setup_etcd = <<SCRIPT
cat >/etc/default/etcd <<EOF
START=1
ETCD_INITIAL_CLUSTER_STATE=new
ETCD_INITIAL_CLUSTER=node1=http://192.168.50.2:2380,node2=http://192.168.50.3:2380,node3=http://192.168.50.4:2380
EOF
SCRIPT
# Setup apt proxy.
$setup_apt_proxy = <<SCRIPT
cat >/etc/apt/apt.conf.d/000apt-proxy <<EOF
Acquire::http::Proxy "http://#{ENV['APT_PROXY']}/";
Acquire::http::Pipeline-Depth "23";
EOF
SCRIPT
Vagrant.configure(API_VERSION) do |config|
config.vm.box = "debian-wheezy-64"
config.vm.box_url = "http://basebox.libera.cc/debian-wheezy-64.box"
config.vm.box = "wheezy"
config.vm.box_url = "http://www.incal.net/ale/debian-wheezy-64.box"
config.vm.provision "shell", inline: $setup_host_file
if !ENV['APT_PROXY'].nil?
config.vm.provision "shell", inline: $setup_apt_proxy
end
config.vm.provision "shell" do |s|
if ENV['LOCAL'].nil?
s.path = "bootstrap.sh"
......@@ -37,22 +62,19 @@ Vagrant.configure(API_VERSION) do |config|
config.vm.define "node1" do |m|
m.vm.hostname = "node1"
m.vm.network "private_network", ip: "192.168.50.2"
m.vm.provision "shell",
inline: "echo BOOTSTRAP=1 > /etc/default/etcd"
m.vm.provision "shell", inline: $setup_etcd
end
config.vm.define "node2" do |m|
m.vm.hostname = "node2"
m.vm.network "private_network", ip: "192.168.50.3"
m.vm.provision "shell",
inline: "echo ETCD_SERVER=node1 > /etc/default/etcd"
m.vm.provision "shell", inline: $setup_etcd
end
config.vm.define "node3" do |m|
m.vm.hostname = "node3"
m.vm.network "private_network", ip: "192.168.50.4"
m.vm.provision "shell",
inline: "echo ETCD_SERVER=node1 > /etc/default/etcd"
m.vm.provision "shell", inline: $setup_etcd
# Create a test mountpoint.
m.vm.provision "shell",
......
......@@ -11,24 +11,28 @@ EOF
most_recent_match() {
local pattern="$1"
ls -t ${pattern} | head -1
ls -1rv ${pattern} | head -1
}
# Install the required packages.
export DEBIAN_FRONTEND=noninteractive
apt-get -q update
yes N 2>/dev/null | apt-get install -q -y runit icecast2 libcap2-bin liquidsoap
dpkg -i $(most_recent_match /vagrant/etcd_*.deb)
dpkg -i $(most_recent_match /vagrant/autoradio_*.deb)
etcd_pkg=$(most_recent_match '/vagrant/etcd_*.deb')
echo "Found etcd package: ${etcd_pkg}" >&2
dpkg -i ${etcd_pkg}
autoradio_pkg=$(most_recent_match '/vagrant/autoradio_*.deb')
echo "Found autoradio package: ${autoradio_pkg}" >&2
dpkg -i ${autoradio_pkg}
# Install the configuration.
DOMAIN="${DOMAIN:-$1}"
if [ -n "${DOMAIN}" ]; then
echo "Autoconfigured with domain: ${DOMAIN}" 1>&2
echo "Autoconfigured with domain: ${DOMAIN}" >&2
echo "DOMAIN=${DOMAIN}" > /etc/default/autoradio
fi
echo "REDIRECTORD_OPTIONS=\"--enable-icecast-proxy\"" >> /etc/default/autoradio
echo "All done (?)" 1>&2
echo "All done (?)" >&2
exit 0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment