mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-03-03 14:52:21 +02:00
* Containers now use a squid proxy for apt/yum to speed builds. * Obsolete containers are removed by the <br-option>--vm-force</br-option> option. * Greatly reduced the quantity of Docker containers built by default. Containers are only built for PostgreSQL versions specified in db-minimal and those required to build documentation. Additional containers can be built with --db-version=all or by specifying a version, e.g. --db-version=9.4.
81 lines
3.3 KiB
Ruby
81 lines
3.3 KiB
Ruby
Vagrant.configure(2) do |config|
|
|
config.vm.provider :virtualbox do |vb|
|
|
vb.memory = 2048
|
|
vb.cpus = 8
|
|
end
|
|
|
|
config.vm.box = "boxcutter/ubuntu1604"
|
|
|
|
config.vm.provider :virtualbox do |vb|
|
|
vb.name = "backrest-test"
|
|
end
|
|
|
|
# Provision the VM
|
|
config.vm.provision "shell", inline: <<-SHELL
|
|
# 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 squid proxy (to speed container builds)
|
|
apt-get install -y squid3
|
|
mkdir -m 700 /var/lib/squid
|
|
chown proxy /var/lib/squid
|
|
cp /etc/squid/squid.conf /etc/squid/squid.conf.old
|
|
echo 'http_port 172.17.0.1:3128' > /etc/squid/squid.conf
|
|
echo 'maximum_object_size 100 MB' >> /etc/squid/squid.conf
|
|
echo 'cache_replacement_policy heap LFUDA' >> /etc/squid/squid.conf
|
|
echo 'refresh_pattern . 0 20% 4320' >> /etc/squid/squid.conf
|
|
echo 'acl docker_network src 172.17.0.0/16' >> /etc/squid/squid.conf
|
|
echo 'http_access allow docker_network' >> /etc/squid/squid.conf
|
|
echo 'cache_dir ufs /var/lib/squid 4096 16 256' >> /etc/squid/squid.conf
|
|
echo 'cache_mem 16 MB' >> /etc/squid/squid.conf
|
|
service squid restart
|
|
|
|
# Install Texlive
|
|
mkdir /root/texlive
|
|
wget -q -O - http://mirror.hmc.edu/ctan/systems/texlive/tlnet/install-tl-unx.tar.gz \
|
|
| tar zxv -C /root//texlive --strip-components=1
|
|
echo "collection-basic 1" >> /root/texlive/texlive.profile
|
|
echo "collection-latex 1" >> /root/texlive/texlive.profile
|
|
/root/texlive/install-tl -profile=/root/texlive/texlive.profile
|
|
|
|
echo 'PATH=/usr/local/texlive/2016/bin/x86_64-linux:$PATH' >> /etc/profile
|
|
echo 'export PATH' >> /etc/profile
|
|
|
|
/usr/local/texlive/2016/bin/x86_64-linux/tlmgr install caption xcolor listings parskip helvetic ltablex titlesec \
|
|
epstopdf courier sectsty pgf ms
|
|
|
|
apt-get install -y ghostscript
|
|
|
|
# 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
|
|
sudo -u vagrant /backrest/test/test.pl --vm-build --vm-force
|
|
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
|