Vagrantfile 2.54 KB
Newer Older
Valera Rozuvan committed
1
VAGRANTFILE_API_VERSION = "2"
2
Vagrant.require_version ">= 1.4"
Valera Rozuvan committed
3

4 5 6
MEMORY = 2048
CPU_COUNT = 2

7
$script = <<SCRIPT
8 9 10 11
if [ ! -d /edx/app/edx_ansible ]; then
    echo "Error: Base box is missing provisioning scripts." 1>&2
    exit 1
fi
12
export PYTHONUNBUFFERED=1
13 14
source /edx/app/edx_ansible/venvs/edx_ansible/bin/activate
cd /edx/app/edx_ansible/edx_ansible/playbooks
15 16 17 18 19

# Need to ensure that the configuration repo is updated
# The vagrant-devstack.yml playbook will also do this, but only
# after loading the playbooks into memory.  If these are out of date,
# this can cause problems (e.g. looking for templates that no longer exist).
20
/edx/bin/update configuration master
21

22
ansible-playbook -i localhost, -c local vagrant-devstack.yml --tags=deploy
23 24
SCRIPT

25 26
edx_platform_mount_dir = "edx-platform"
forum_mount_dir = "cs_comments_service"
27
ora_mount_dir = "ora"
28 29 30

if ENV['VAGRANT_MOUNT_BASE']

31 32
  edx_platform_mount_dir = ENV['VAGRANT_MOUNT_BASE'] + "/" + edx_platform_mount_dir
  forum_mount_dir = ENV['VAGRANT_MOUNT_BASE'] + "/" + forum_mount_dir
33
  ora_mount_dir = ENV['VAGRANT_MOUNT_BASE'] + "/" + ora_mount_dir
34 35 36

end

Valera Rozuvan committed
37
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
38

39
  # Creates an edX devstack VM from an official release
40 41
  config.vm.box     = "gugelhupf-devstack"
  config.vm.box_url = "http://files.edx.org/vagrant-images/20140210-gugelhupf-devstack.box"
42 43 44 45 46 47

  config.vm.network :private_network, ip: "192.168.33.10"
  config.vm.network :forwarded_port, guest: 8000, host: 8000
  config.vm.network :forwarded_port, guest: 8001, host: 8001
  config.vm.network :forwarded_port, guest: 4567, host: 4567

48 49 50 51 52
  # Enable X11 forwarding so we can interact with GUI applications
  if ENV['VAGRANT_X11']
      config.ssh.forward_x11 = true
  end
  
53 54
  config.vm.synced_folder "#{edx_platform_mount_dir}", "/edx/app/edxapp/edx-platform", :create => true, nfs: true
  config.vm.synced_folder "#{forum_mount_dir}", "/edx/app/forum/cs_comments_service", :create => true, nfs: true
55
  config.vm.synced_folder "#{ora_mount_dir}", "/edx/app/ora/ora", :create => true, nfs: true
56

57 58 59
  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--memory", MEMORY.to_s]
    vb.customize ["modifyvm", :id, "--cpus", CPU_COUNT.to_s]
60 61 62 63

    # Allow DNS to work for Ubuntu 12.10 host
    # http://askubuntu.com/questions/238040/how-do-i-fix-name-service-for-vagrant-client
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
64 65
  end

66 67
  # Assume that the base box has the edx_ansible role installed
  # We can then tell the Vagrant instance to update itself.
68
  config.vm.provision "shell", inline: $script
69

70
end