1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00
pgbackrest/test/Vagrantfile

58 lines
1.9 KiB
Ruby

Vagrant.configure(2) do |config|
config.vm.provider :virtualbox do |vb|
vb.memory = 2048
vb.cpus = 8
end
config.vm.box = "bento/ubuntu-16.04"
config.vm.provider :virtualbox do |vb|
vb.name = "backrest-test"
end
# Provision the VM
config.vm.provision "shell", inline: <<-SHELL
# Suppress "dpkg-reconfigure: unable to re-open stdin: No file or directory" warning
export DEBIAN_FRONTEND=noninteractive
# Install Docker
apt-get update
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
sudo usermod -aG docker vagrant
# Install Perl modules
apt-get install -y libdbd-pg-perl libxml-checker-perl libperl-critic-perl
# Install additional modules
apt-get install -y vim htop
# Install Texlive
apt-get install -y texlive
apt-get install -y --no-install-recommends texlive-latex-extra
# Create backrest user and postgres group
groupadd -g5000 postgres
adduser --uid=5001 --ingroup=postgres --disabled-password --gecos "" backrest
# Make postgres the primary group for vagrant user (and preserve vagrant group)
usermod -g postgres vagrant
usermod -a -G vagrant vagrant
# Build VM images
rm -f /backrest/test/.vagrant/docker/*
sudo su - vagrant -c '/backrest/test/test.pl --vm-build'
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