compose-website/Vagrantfile

82 lines
3 KiB
Text
Raw Permalink Normal View History

2014-09-26 12:57:09 +00:00
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.5.0"
# Size of the CoreOS cluster created by Vagrant
$num_instances=1
# Official CoreOS channel from which updates should be downloaded
$update_channel='stable'
# Setting for VirtualBox VMs
$vb_memory = 1024
$vb_cpus = 1
BASE_IP_ADDR = ENV['BASE_IP_ADDR'] || "192.168.65"
HOSTNAME = ENV['HOSTNAME'] || "indiehosters.dev"
2014-09-26 12:57:09 +00:00
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "coreos-%s" % $update_channel
config.vm.box_version = ">= 308.0.1"
config.vm.box_url = "http://%s.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json" % $update_channel
2014-11-05 12:43:16 +00:00
config.vm.define "backup" do |backup|
backup.vm.provider :virtualbox do |vb|
vb.memory = 512
vb.cpus = 1
vb.check_guest_additions = false
vb.functional_vboxsf = false
end
# plugin conflict
if Vagrant.has_plugin?("vagrant-vbguest") then
backup.vbguest.auto_update = false
end
backup.vm.hostname = "backup.dev"
backup.vm.network :private_network, ip: "192.168.65.100"
end
2014-09-26 12:57:09 +00:00
(1..$num_instances).each do |i|
config.vm.define "core-#{i}" do |core|
2014-10-08 16:55:39 +00:00
core.vm.provider :virtualbox do |vb|
2014-09-26 12:57:09 +00:00
vb.memory = $vb_memory
vb.cpus = $vb_cpus
2014-10-08 16:56:32 +00:00
# On VirtualBox, we don't have guest additions or a functional vboxsf
# in CoreOS, so tell Vagrant that so it can be smarter.
vb.check_guest_additions = false
vb.functional_vboxsf = false
end
# plugin conflict
if Vagrant.has_plugin?("vagrant-vbguest") then
core.vbguest.auto_update = false
2014-09-26 12:57:09 +00:00
end
core.vm.hostname = HOSTNAME
2014-10-10 17:08:14 +00:00
core.hostsupdater.aliases = ["example.dev"]
2014-09-26 12:57:09 +00:00
core.vm.network :private_network, ip: "#{BASE_IP_ADDR}.#{i+1}"
2014-10-17 11:47:40 +00:00
core.vm.synced_folder ".", "/data/indiehosters", id: "coreos-indiehosters", :nfs => true, :mount_options => ['nolock,vers=3,udp']
2014-10-14 14:01:13 +00:00
core.vm.provision :file, source: "./cloud-config", destination: "/tmp/vagrantfile-user-data"
2014-11-05 12:43:16 +00:00
$install_insecure_keys = <<SCRIPT
mkdir ~/.ssh
wget https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -O ~/.ssh/id_rsa.pub
wget https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant -O ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
SCRIPT
core.vm.provision :shell, inline: $install_insecure_keys
2014-11-04 18:07:18 +00:00
core.vm.provision :shell, inline: "mkdir -p /data/runtime/haproxy/approved-certs; cp /data/indiehosters/scripts/unsecure-certs/*.pem /data/runtime/haproxy/approved-certs"
core.vm.provision :shell, path: "./scripts/setup.sh", args: [HOSTNAME]
$start_indiehosters_dev = <<SCRIPT
sudo mkdir -p /data/import/indiehosters.dev/TLS
sudo cp /data/indiehosters/scripts/unsecure-certs/indiehosters.dev.pem /data/import/indiehosters.dev/TLS
sudo systemctl enable static@indiehosters.dev
sudo systemctl start static@indiehosters.dev
SCRIPT
core.vm.provision :shell, inline: $start_indiehosters_dev
2014-09-26 12:57:09 +00:00
end
2014-11-05 12:43:16 +00:00
2014-09-26 12:57:09 +00:00
end
end