Add all supported deployments; adjust box sizes to reflect a very bad case scenario

This commit is contained in:
David 2021-08-14 16:50:50 +01:00
parent a4c5f14237
commit 2c975e43cc
No known key found for this signature in database
GPG key ID: 913FE0F2477D7D6B

74
Vagrantfile vendored
View file

@ -2,46 +2,66 @@
# -*- mode: ruby -*- # -*- mode: ruby -*-
# vi: set ft=ruby : # vi: set ft=ruby :
ip = 2
machines = [
{
'iso' => "debian/buster64",
'host' => "buster"
},
{
'iso' => "generic/ubuntu2004",
'host' => "focal"
}
]
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.box = "debian/buster64"
config.vm.provider :virtualbox do |vb| config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--cpus", 4, "--memory", 4096] vb.customize ["modifyvm", :id, "--cpus", 1, "--memory", 512]
end end
config.vm.provider :libvirt do |v| config.vm.provider :libvirt do |v|
v.memory = 4096 v.memory = 512
v.cpus = 4 v.cpus = 1
v.nested = true v.nested = true
end end
config.vm.provider :kvm do |kvm| config.vm.provider :kvm do |kvm|
kvm.memory_size = '4096m' kvm.memory_size = '512m'
end end
# Network config: Since it's a mail server, the machine must be connected # Network config: Since it's a mail server, the machine must be connected
# to the public web. However, we currently don't want to expose SSH since # to the public web. However, we currently don't want to expose SSH since
# the machine's box will let anyone log into it. So instead we'll put the # the machine's box will let anyone log into it. So instead we'll put the
# machine on a private network. # machine on a private network.
config.vm.hostname = "mailinabox.lan"
config.vm.network "private_network", ip: "192.168.50.4"
config.vm.synced_folder ".", "/vagrant", nfs_version: "3" config.vm.synced_folder ".", "/vagrant", nfs_version: "3"
#, :mount_options => ["ro"]
config.vm.provision "shell", :inline => <<-SH (0..1).each do |n|
# Set environment variables so that the setup script does node = machines[n]
# not ask any questions during provisioning. We'll let the config.vm.define node['host'] do |m|
# machine figure out its own public IP. m.vm.box = node['iso']
export NONINTERACTIVE=1 m.vm.hostname = "#{node['host']}.mailinabox.lan"
export PUBLIC_IP=192.168.50.4 m.vm.network "private_network", ip: "192.168.168.#{ip+n}"
export PUBLIC_IPV6=auto
export PRIVATE_IP=192.168.50.4 m.vm.provision "shell", :inline => <<-SH
export PRIMARY_HOSTNAME=auto # Make sure we have IPv6 loopback (::1)
export SKIP_NETWORK_CHECKS=1 sysctl -w net.ipv6.conf.lo.disable_ipv6=0
# Start the setup script. # Set environment variables so that the setup script does
cd /vagrant # not ask any questions during provisioning. We'll let the
setup/start.sh # machine figure out its own public IP.
# After setup is done, fully open the ssh ports again export NONINTERACTIVE=1
ufw allow ssh export PUBLIC_IP=192.168.168.#{ip+n}
SH export PUBLIC_IPV6=auto
config.vm.provision "shell", run: "always", :inline => <<-SH export PRIVATE_IP=192.168.168.#{ip+n}
service mailinabox restart export PRIMARY_HOSTNAME=\"#{node['host']}.mailinabox.lan\"
SH export SKIP_NETWORK_CHECKS=1
# Start the setup script.
cd /vagrant
setup/start.sh
# After setup is done, fully open the ssh ports again
ufw allow ssh
SH
m.vm.provision "shell", run: "always", :inline => <<-SH
service mailinabox restart
SH
end
end
end end