2015-12-29 20:57:10 +02:00
|
|
|
Vagrant.configure(2) do |config|
|
|
|
|
config.vm.provider :virtualbox do |vb|
|
2017-10-22 19:11:03 +02:00
|
|
|
vb.memory = 4096
|
2015-12-29 20:57:10 +02:00
|
|
|
vb.cpus = 8
|
|
|
|
end
|
|
|
|
|
2017-03-15 04:05:17 +02:00
|
|
|
config.vm.box = "ubuntu/xenial64"
|
2018-02-04 01:27:38 +02:00
|
|
|
config.vm.box_version = "20180126.0.0"
|
2017-06-09 23:51:41 +02:00
|
|
|
|
|
|
|
# vagrant plugin install vagrant-disksize
|
2017-06-25 00:04:02 +02:00
|
|
|
# config.disksize.size = '64GB'
|
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-07-26 19:40:09 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
|
|
|
echo 'Use Google DNS' && date
|
|
|
|
echo 'supersede domain-name-servers 8.8.8.8;' >> /etc/dhcp/dhclient.conf
|
|
|
|
/etc/init.d/networking restart
|
|
|
|
|
2018-04-19 00:47:43 +02:00
|
|
|
# Set time sync settings so builds don't fail with clock drift errors
|
2017-11-02 14:14:13 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
2018-04-19 00:47:43 +02:00
|
|
|
echo 'Time Sync Settings' && date
|
|
|
|
/etc/init.d/virtualbox-guest-utils stop
|
|
|
|
/usr/sbin/VBoxService --timesync-set-on-restore 1 --timesync-interval 5000 --timesync-set-threshold 1
|
|
|
|
/etc/init.d/virtualbox-guest-utils start
|
2017-11-02 14:14:13 +02:00
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
|
|
|
echo 'Install Perl Modules' && date
|
2017-06-12 16:52:32 +02:00
|
|
|
apt-get install -y libdbd-pg-perl libio-socket-ssl-perl libxml-libxml-perl libxml-checker-perl libperl-critic-perl \
|
2018-04-08 16:19:24 +02:00
|
|
|
libdevel-nytprof-perl libyaml-libyaml-perl
|
2017-04-10 18:31:30 +02:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
|
|
|
echo 'Install Build Tools' && date
|
2018-04-16 21:52:17 +02:00
|
|
|
apt-get install -y devscripts build-essential lintian git txt2man debhelper libssl-dev lcov cloc
|
2017-04-10 18:31:30 +02:00
|
|
|
|
2017-06-12 16:52:32 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
|
|
|
echo 'Install AWS CLI' && date
|
|
|
|
apt-get install -y python-pip
|
|
|
|
pip install --upgrade awscli
|
|
|
|
|
|
|
|
# Configure AWS CLI
|
2018-02-04 01:27:38 +02:00
|
|
|
sudo -i -u vagrant aws configure set region us-east-1
|
|
|
|
sudo -i -u vagrant aws configure set aws_access_key_id accessKey1
|
|
|
|
sudo -i -u vagrant aws configure set aws_secret_access_key verySecretKey1
|
2017-06-12 16:52:32 +02:00
|
|
|
|
|
|
|
# Create test alias for AWS CLI
|
2018-02-04 01:27:38 +02:00
|
|
|
echo '' >> /home/vagrant/.profile
|
|
|
|
echo '# Test alias for AWS CLI' >> /home/vagrant/.profile
|
2017-06-12 16:52:32 +02:00
|
|
|
echo 'alias s3-test="export PYTHONWARNINGS=ignore && aws s3 --endpoint-url=https://172.17.0.2 --no-verify-ssl"' \
|
2018-02-04 01:27:38 +02:00
|
|
|
>> /home/vagrant/.profile
|
2017-06-12 16:52:32 +02:00
|
|
|
|
2017-04-10 18:31:30 +02:00
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
2017-06-24 16:59:00 +02:00
|
|
|
echo 'Install Devel::Cover' && date
|
|
|
|
dpkg -i /backrest/test/package/u16-libdevel-cover-perl_1.23-2_amd64.deb
|
2017-04-10 18:31:30 +02:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------------------------------------------
|
2016-10-03 15:15:29 +02:00
|
|
|
echo 'Install Docker' && date
|
2017-08-11 02:52:29 +02:00
|
|
|
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
|
|
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
|
|
|
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
2016-05-26 20:03:32 +02:00
|
|
|
apt-get update
|
2017-08-11 02:52:29 +02:00
|
|
|
apt-get install -y docker-ce
|
2018-02-04 01:27:38 +02:00
|
|
|
sudo usermod -aG docker vagrant
|
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
|
2018-02-04 01:27:38 +02:00
|
|
|
adduser --uid=5001 --ingroup=vagrant --disabled-password --gecos "" pgbackrest
|
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/*
|
2018-02-04 01:27:38 +02:00
|
|
|
sudo su - vagrant -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
|