Browse Source

Add something that kinda works, but not really

Need to finish getting disk resizing to work
master
IamTheFij 4 years ago
parent
commit
916600c77b
  1. 81
      Vagrantfile
  2. 3
      cloudron_logs.sh
  3. 3
      restart_cloudron.sh

81
Vagrantfile

@ -0,0 +1,81 @@
# -*- 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

3
cloudron_logs.sh

@ -0,0 +1,3 @@
#! /bin/bash
vagrant ssh -c 'journalctl -u box -af'

3
restart_cloudron.sh

@ -0,0 +1,3 @@
#! /bin/bash
vagrant ssh -c 'systemctl restart box'
Loading…
Cancel
Save