82 lines
2.5 KiB
Ruby
82 lines
2.5 KiB
Ruby
# -*- mode: ruby -*-
|
|
# vi: set ft=ruby sw=2 ts=2 :
|
|
|
|
# Set this to custom url if using a fork
|
|
cloudron_setup_url = 'https://git.cloudron.io/cloudron/box/raw/master/scripts/cloudron-setup'
|
|
|
|
Vagrant.configure(2) do |config|
|
|
# Minimum requirement for Cloudron is 16.04
|
|
config.vm.box = "ubuntu/xenial64"
|
|
|
|
# Mosh is super nice, why not?
|
|
enable_mosh = false
|
|
if enable_mosh
|
|
(60000..61000).each do |p|
|
|
config.vm.network "forwarded_port", guest: p, host: p, protocol: 'udp'
|
|
end
|
|
end
|
|
|
|
# Create a forwarded port mapping which allows access to a specific port
|
|
# within the machine from a port on the host machine. In the example below,
|
|
# accessing "localhost:8080" will access port 80 on the guest machine.
|
|
# config.vm.network "forwarded_port", guest: 80, host: 8080
|
|
# config.vm.network "forwarded_port", guest: 443, host: 8081
|
|
|
|
config.vm.network "private_network", ip: "192.168.100.100"
|
|
|
|
# Set hostname for the box
|
|
config.vm.hostname = "cloudron.cloud"
|
|
|
|
# Share an additional folder to the guest VM. The first argument is
|
|
# the path on the host to the actual folder. The second argument is
|
|
# the path on the guest to mount the folder. And the optional third
|
|
# argument is a set of non-required options.
|
|
# config.vm.synced_folder "~/.ssh", "~/.ssh/vagrant_data"
|
|
|
|
config.vm.provider "virtualbox" do |vb|
|
|
# Display the VirtualBox GUI when booting the machine
|
|
vb.gui = false
|
|
|
|
# Customize the amount of memory on the VM:
|
|
vb.memory = "2048"
|
|
end
|
|
|
|
# disk_filepath "~/VirtualBox\ VMs/#{:name}/disk1.vdi"
|
|
disk_filepath = 'disk1.vdi'
|
|
if ARGV[0] == "up" && ! File.exists?(disk_filepath)
|
|
# Create vdi
|
|
config.vm.provider :virtualbox do |vb|
|
|
vb.customize [
|
|
'createhd',
|
|
'--filename', disk_filepath,
|
|
'--format', 'VDI',
|
|
# 20GB
|
|
'--size', 20 * 1024
|
|
]
|
|
|
|
vb.customize [
|
|
'storageattach', :id,
|
|
'--storagectl', 'IDE',
|
|
'--port', 1, '--device', 0,
|
|
'--type', 'hdd', '--medium',
|
|
disk_filepath
|
|
]
|
|
end
|
|
|
|
# Run script to map new disk
|
|
config.vm.provision "shell", inline: <<-SHELL
|
|
pvcreate /dev/sdb
|
|
vgextend VolGroup /dev/sdb
|
|
lvextend /dev/VolGroup/lv_root /dev/sdb
|
|
resize2fs /dev/VolGroup/lv_root
|
|
SHELL
|
|
end
|
|
|
|
# Set up Cloudron on provision. If using a fork, change this URL
|
|
config.vm.provision "shell", inline: <<-SHELL
|
|
wget #{cloudron_setup_url}
|
|
chmod +x cloudron-setup
|
|
./cloudron-setup --domain cloudron.cloud --provider generic --tls-provider fallback --dns-provider noop
|
|
SHELL
|
|
end
|