2015-12-29 20:57:10 +02:00
|
|
|
Vagrant.configure(2) do |config|
|
|
|
|
config.vm.provider :virtualbox do |vb|
|
|
|
|
vb.memory = 2048
|
|
|
|
vb.cpus = 8
|
|
|
|
end
|
|
|
|
|
2017-03-15 04:05:17 +02:00
|
|
|
config.vm.box = "ubuntu/xenial64"
|
|
|
|
config.vm.box_version = "20170311.0.0"
|
2015-12-29 20:57:10 +02:00
|
|
|
|
|
|
|
config.vm.provider :virtualbox do |vb|
|
2016-10-03 15:15:29 +02:00
|
|
|
vb.name = "pgbackrest-test"
|
2015-12-29 20:57:10 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# Provision the VM
|
|
|
|
config.vm.provision "shell", inline: <<-SHELL
|
2017-04-10 18:31:30 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
2016-10-03 15:15:29 +02:00
|
|
|
echo 'Build Begin' && date
|
|
|
|
|
2016-09-08 23:29:26 +02:00
|
|
|
# Suppress "dpkg-reconfigure: unable to re-open stdin: No file or directory" warning
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2017-03-15 04:05:17 +02:00
|
|
|
# Assign a host name
|
|
|
|
sed -i 's/^127\.0\.0\.1\t.*/127\.0\.0\.1\tlocalhost pgbackrest-test/' /etc/hosts
|
|
|
|
hostnamectl set-hostname pgbackrest-test
|
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
2016-10-03 15:15:29 +02:00
|
|
|
echo 'Update Apt' && date
|
2016-05-26 20:03:32 +02:00
|
|
|
apt-get update
|
2016-10-03 15:15:29 +02:00
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
|
|
|
echo 'Synchronize Date' && date
|
2017-03-15 04:05:17 +02:00
|
|
|
apt-get install -y ntpdate
|
|
|
|
ntpdate pool.ntp.org
|
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
|
|
|
echo 'Install Perl Modules' && date
|
|
|
|
apt-get install -y libdbd-pg-perl libxml-checker-perl libperl-critic-perl libdevel-nytprof-perl
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
|
|
|
echo 'Install Build Tools' && date
|
|
|
|
apt-get install -y devscripts build-essential lintian git txt2man debhelper
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
|
|
|
echo 'Build Devel::Cover' && date
|
|
|
|
apt-get install -y libpod-coverage-perl libtest-differences-perl libhtml-parser-perl libtemplate-perl
|
|
|
|
git clone --branch debian/1.23-2 \
|
|
|
|
https://anonscm.debian.org/git/pkg-perl/packages/libdevel-cover-perl.git /root/libdevel-cover-perl
|
|
|
|
cd /root/libdevel-cover-perl && debuild --no-lintian -i -us -uc -b > /dev/null
|
|
|
|
dpkg -i /root/libdevel-cover-perl_1.23-2_amd64.deb
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
2016-10-03 15:15:29 +02:00
|
|
|
echo 'Install Docker' && date
|
2016-05-26 20:03:32 +02:00
|
|
|
apt-get install -y apt-transport-https ca-certificates
|
|
|
|
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
|
|
|
|
echo 'deb https://apt.dockerproject.org/repo ubuntu-xenial main' > /etc/apt/sources.list.d/docker.list
|
|
|
|
apt-get update
|
|
|
|
apt-get install -y linux-image-extra-$(uname -r)
|
|
|
|
apt-get install -y docker-engine
|
|
|
|
service docker start
|
2017-03-15 04:05:17 +02:00
|
|
|
sudo usermod -aG docker ubuntu
|
2016-05-26 20:03:32 +02:00
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
|
|
|
echo 'Install Dev Utilities' && date
|
2016-06-12 15:00:16 +02:00
|
|
|
apt-get install -y vim htop
|
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
2016-10-03 15:15:29 +02:00
|
|
|
echo 'Install TeX Live' && date
|
|
|
|
apt-get install -y --no-install-recommends texlive-latex-base texlive-latex-extra texlive-fonts-recommended
|
|
|
|
apt-get install -y texlive-font-utils
|
2016-06-12 15:00:16 +02:00
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
2016-10-03 15:15:29 +02:00
|
|
|
echo 'Create Postgres Group & pgBackRest User' && date
|
2016-06-12 15:00:16 +02:00
|
|
|
groupadd -g5000 postgres
|
2017-03-15 04:05:17 +02:00
|
|
|
adduser --uid=5001 --ingroup=ubuntu --disabled-password --gecos "" backrest
|
2016-06-12 15:00:16 +02:00
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
2016-10-03 15:15:29 +02:00
|
|
|
echo 'Build VM Images' && date
|
2017-03-01 16:36:33 +02:00
|
|
|
rm -rf /backrest/test/.vagrant/docker/*
|
|
|
|
rm -rf /backrest/test/.vagrant/libc/*
|
|
|
|
rm -rf /backrest/test/.vagrant/package/*
|
2017-03-15 04:05:17 +02:00
|
|
|
sudo su - ubuntu -c '/backrest/test/test.pl --vm-build'
|
2016-10-03 15:15:29 +02:00
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
2016-10-03 15:15:29 +02:00
|
|
|
echo 'Build End' && date
|
2015-12-29 20:57:10 +02:00
|
|
|
SHELL
|
|
|
|
|
|
|
|
# Don't share the default vagrant folder
|
|
|
|
config.vm.synced_folder ".", "/vagrant", disabled: true
|
|
|
|
|
|
|
|
# Mount backrest path for testing
|
|
|
|
config.vm.synced_folder "..", "/backrest"
|
|
|
|
end
|