2015-08-17 06:37:14 +02:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
|
|
|
|
VAGRANTFILE_API_VERSION = "2"
|
|
|
|
|
2016-02-08 06:09:48 +01:00
|
|
|
def command?(name)
|
|
|
|
`which #{name}`
|
|
|
|
$?.success?
|
|
|
|
end
|
|
|
|
|
2015-08-17 06:37:14 +02:00
|
|
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
|
|
|
2015-08-18 02:05:53 +02:00
|
|
|
# For LXC. VirtualBox hosts use a different box, described below.
|
2015-08-17 06:37:14 +02:00
|
|
|
config.vm.box = "fgrehm/trusty64-lxc"
|
|
|
|
|
2015-08-18 02:05:53 +02:00
|
|
|
# The Zulip development environment runs on 9991 on the guest.
|
2015-08-17 06:37:14 +02:00
|
|
|
config.vm.network "forwarded_port", guest: 9991, host: 9991, host_ip: "127.0.0.1"
|
|
|
|
|
|
|
|
config.vm.synced_folder ".", "/vagrant", disabled: true
|
|
|
|
config.vm.synced_folder ".", "/srv/zulip"
|
|
|
|
|
2016-01-10 01:31:37 +01:00
|
|
|
# Specify LXC provider before VirtualBox provider so it's preferred.
|
|
|
|
config.vm.provider "lxc" do |lxc|
|
2016-02-08 06:09:48 +01:00
|
|
|
if command? "lxc-ls"
|
|
|
|
LXC_VERSION = `lxc-ls --version`.strip unless defined? LXC_VERSION
|
|
|
|
if LXC_VERSION >= "1.1.0"
|
|
|
|
# Allow start without AppArmor, otherwise Box will not Start on Ubuntu 14.10
|
|
|
|
# see https://github.com/fgrehm/vagrant-lxc/issues/333
|
|
|
|
lxc.customize 'aa_allow_incomplete', 1
|
|
|
|
end
|
2016-01-10 01:31:37 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-17 19:18:40 +02:00
|
|
|
config.vm.provider "virtualbox" do |vb, override|
|
2015-08-17 06:37:14 +02:00
|
|
|
override.vm.box = "ubuntu/trusty64"
|
2015-08-18 02:05:53 +02:00
|
|
|
# 2GiB seemed reasonable here. The VM OOMs with only 1024MiB.
|
2015-08-17 20:14:52 +02:00
|
|
|
vb.memory = 2048
|
2015-08-17 06:37:14 +02:00
|
|
|
end
|
2015-08-17 20:14:52 +02:00
|
|
|
|
2015-08-19 04:14:50 +02:00
|
|
|
$provision_script = <<SCRIPT
|
|
|
|
set -x
|
|
|
|
set -e
|
2015-11-26 04:29:13 +01:00
|
|
|
/usr/bin/python /srv/zulip/provision.py
|
2015-08-19 04:14:50 +02:00
|
|
|
SCRIPT
|
|
|
|
|
|
|
|
config.vm.provision "shell",
|
|
|
|
# We want provision.py to be run with the permissions of the vagrant user.
|
|
|
|
privileged: false,
|
|
|
|
inline: $provision_script
|
2015-08-17 06:37:14 +02:00
|
|
|
end
|