2021-02-17 12:17:10 +00:00
|
|
|
|
2014-06-04 23:39:58 +00:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
# vi: set ft=ruby :
|
|
|
|
|
|
|
|
Vagrant.configure("2") do |config|
|
2020-08-10 02:06:59 +00:00
|
|
|
config.vm.box = "debian/buster64"
|
2020-07-08 18:31:35 +00:00
|
|
|
config.vm.provider :virtualbox do |vb|
|
2020-08-10 02:06:59 +00:00
|
|
|
vb.customize ["modifyvm", :id, "--cpus", 4, "--memory", 4096]
|
|
|
|
end
|
|
|
|
config.vm.provider :libvirt do |v|
|
|
|
|
v.memory = 4096
|
|
|
|
v.cpus = 4
|
|
|
|
v.nested = true
|
|
|
|
end
|
|
|
|
config.vm.provider :kvm do |kvm|
|
|
|
|
kvm.memory_size = '4096m'
|
2020-04-11 18:12:40 +00:00
|
|
|
end
|
2017-01-15 15:47:36 +00:00
|
|
|
|
2014-06-06 12:20:26 +00:00
|
|
|
# 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
|
|
|
|
# the machine's box will let anyone log into it. So instead we'll put the
|
|
|
|
# machine on a private network.
|
2016-12-20 21:32:06 +00:00
|
|
|
config.vm.hostname = "mailinabox.lan"
|
2014-06-06 12:20:26 +00:00
|
|
|
config.vm.network "private_network", ip: "192.168.50.4"
|
2020-08-10 02:06:59 +00:00
|
|
|
config.vm.synced_folder ".", "/vagrant", nfs_version: "3"
|
|
|
|
#, :mount_options => ["ro"]
|
2014-06-04 23:39:58 +00:00
|
|
|
|
2021-02-17 12:17:10 +00:00
|
|
|
config.vm.provision "shell", :inline => <<-SH
|
2018-09-03 16:52:03 +00:00
|
|
|
# Set environment variables so that the setup script does
|
|
|
|
# not ask any questions during provisioning. We'll let the
|
|
|
|
# machine figure out its own public IP.
|
2014-08-25 11:54:11 +00:00
|
|
|
export NONINTERACTIVE=1
|
2020-08-10 02:06:59 +00:00
|
|
|
export PUBLIC_IP=192.168.50.4
|
2014-06-08 22:32:52 +00:00
|
|
|
export PUBLIC_IPV6=auto
|
2021-08-02 14:02:54 +00:00
|
|
|
export PRIVATE_IP=192.168.50.4
|
2016-11-30 17:55:18 +00:00
|
|
|
export PRIMARY_HOSTNAME=auto
|
2020-07-08 18:31:35 +00:00
|
|
|
export SKIP_NETWORK_CHECKS=1
|
2014-06-04 23:39:58 +00:00
|
|
|
# Start the setup script.
|
2020-07-08 18:31:35 +00:00
|
|
|
cd /vagrant
|
2014-06-04 23:39:58 +00:00
|
|
|
setup/start.sh
|
2021-02-17 12:17:10 +00:00
|
|
|
# After setup is done, fully open the ssh ports again
|
|
|
|
ufw allow ssh
|
|
|
|
SH
|
|
|
|
config.vm.provision "shell", run: "always", :inline => <<-SH
|
|
|
|
service mailinabox restart
|
2014-06-04 23:39:58 +00:00
|
|
|
SH
|
2021-02-17 12:17:10 +00:00
|
|
|
end
|