1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00
pgbackrest/test/Vagrantfile
David Steele 1659598cfe Create a master list of errors in build/error.yaml.
The C and Perl errors lists are created automatically by Build.pm so they stay up to date.
2018-02-08 16:11:47 -05:00

117 lines
5.7 KiB
Ruby

Vagrant.configure(2) do |config|
config.vm.provider :virtualbox do |vb|
vb.memory = 4096
vb.cpus = 8
end
config.vm.box = "ubuntu/xenial64"
config.vm.box_version = "20180126.0.0"
# vagrant plugin install vagrant-disksize
# config.disksize.size = '64GB'
config.vm.provider :virtualbox do |vb|
vb.name = "pgbackrest-test"
end
# Provision the VM
config.vm.provision "shell", inline: <<-SHELL
#---------------------------------------------------------------------------------------------------------------------------
echo 'Build Begin' && date
# Suppress "dpkg-reconfigure: unable to re-open stdin: No file or directory" warning
export DEBIAN_FRONTEND=noninteractive
# 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
#---------------------------------------------------------------------------------------------------------------------------
echo 'Update Apt' && date
apt-get update
#---------------------------------------------------------------------------------------------------------------------------
echo 'Synchronize Date' && date
apt-get install -y ntpdate
ntpdate pool.ntp.org
#---------------------------------------------------------------------------------------------------------------------------
echo 'Use Google DNS' && date
echo 'supersede domain-name-servers 8.8.8.8;' >> /etc/dhcp/dhclient.conf
/etc/init.d/networking restart
# If builds fail with 'modification time in the future', the following command will sync the vm clock with the host
#---------------------------------------------------------------------------------------------------------------------------
echo 'Start Time Sync Service' && date
sudo /usr/sbin/VBoxService --timesync-set-start
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Perl Modules' && date
apt-get install -y libdbd-pg-perl libio-socket-ssl-perl libxml-libxml-perl libxml-checker-perl libperl-critic-perl \
libdevel-nytprof-perl libyaml-perl
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Build Tools' && date
apt-get install -y devscripts build-essential lintian git txt2man debhelper libssl-dev
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install AWS CLI' && date
apt-get install -y python-pip
pip install --upgrade awscli
# Configure AWS CLI
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
# Create test alias for AWS CLI
echo '' >> /home/vagrant/.profile
echo '# Test alias for AWS CLI' >> /home/vagrant/.profile
echo 'alias s3-test="export PYTHONWARNINGS=ignore && aws s3 --endpoint-url=https://172.17.0.2 --no-verify-ssl"' \
>> /home/vagrant/.profile
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Devel::Cover' && date
dpkg -i /backrest/test/package/u16-libdevel-cover-perl_1.23-2_amd64.deb
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Docker' && date
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"
apt-get update
apt-get install -y docker-ce
sudo usermod -aG docker vagrant
#---------------------------------------------------------------------------------------------------------------------------
echo 'Install Dev Utilities' && date
apt-get install -y vim htop
#---------------------------------------------------------------------------------------------------------------------------
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
#---------------------------------------------------------------------------------------------------------------------------
echo 'Create Postgres Group & pgBackRest User' && date
groupadd -g5000 postgres
adduser --uid=5001 --ingroup=vagrant --disabled-password --gecos "" pgbackrest
#---------------------------------------------------------------------------------------------------------------------------
echo 'Build VM Images' && date
rm -rf /backrest/test/.vagrant/docker/*
rm -rf /backrest/test/.vagrant/libc/*
rm -rf /backrest/test/.vagrant/package/*
sudo su - vagrant -c '/backrest/test/test.pl --vm-build'
#---------------------------------------------------------------------------------------------------------------------------
echo 'Build End' && date
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