Vagrantfile 2.61 KB
Newer Older
1 2
Vagrant.require_version ">= 1.5.3"

3 4
VAGRANTFILE_API_VERSION = "2"

5
MEMORY = 4096
6 7
CPU_COUNT = 2

8 9 10 11
# map the name of the git branch that we use for a release
# to a name and a file path, which are used for retrieving
# a Vagrant box from the internet.
openedx_releases = {
12 13 14 15 16
  "open-release/eucalyptus.master" => "eucalyptus-fullstack-2016-09-01",
  "open-release/eucalyptus/1rc1" => "eucalyptus-fullstack-1rc1",
  "open-release/eucalyptus.1rc2" => "eucalyptus-fullstack-2016-08-19",
  "open-release/eucalyptus.1" => "eucalyptus-fullstack-2016-08-25",
  "open-release/eucalyptus.2" => "eucalyptus-fullstack-2016-09-01",
17
  "named-release/dogwood" => {
18 19
    :name => "dogwood-fullstack-rc2", :file => "20151221-dogwood-fullstack-rc2.box",
  },
20 21 22
  "named-release/dogwood.1" => {
    :name => "dogwood-fullstack-rc2", :file => "20151221-dogwood-fullstack-rc2.box",
  },
23 24 25
  "named-release/dogwood.2" => {
    :name => "dogwood-fullstack-rc2", :file => "20151221-dogwood-fullstack-rc2.box",
  },
26 27 28
  "named-release/dogwood.3" => {
    :name => "dogwood-fullstack-rc2", :file => "20151221-dogwood-fullstack-rc2.box",
  },
29
  "named-release/dogwood.rc" => {
30 31
    :name => "dogwood-fullstack-rc2", :file => "20151221-dogwood-fullstack-rc2.box",
  },
32 33
  # Cypress is deprecated and unsupported
  # "named-release/cypress" => {
34
  #   :name => "cypress-fullstack",
35
  # },
36 37 38 39
  # Birch is deprecated and unsupported
  # "named-release/birch.2" => {
  #   :name => "birch-fullstack-2", :file => "birch-2-fullstack.box",
  # },
40
}
41 42
openedx_releases.default = "eucalyptus-fullstack-2016-09-01"

43
openedx_release = ENV['OPENEDX_RELEASE']
44

45
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
46

47
  reldata = openedx_releases[openedx_release]
48
  if Hash == reldata.class
49 50
    boxname = openedx_releases[openedx_release][:name]
    boxfile = openedx_releases[openedx_release].fetch(:file, "#{boxname}.box")
51 52 53 54 55
  else
    boxname = reldata
    boxfile = "#{boxname}.box"
  end

56
  # Creates an edX fullstack VM from an official release
57 58
  config.vm.box     = boxname
  config.vm.box_url = "http://files.edx.org/vagrant-images/#{boxfile}"
59

60
  config.vm.synced_folder  ".", "/vagrant", disabled: true
61
  config.ssh.insert_key = true
62 63

  config.vm.network :private_network, ip: "192.168.33.10"
64
  config.hostsupdater.aliases = ["preview.localhost"]
65 66 67 68

  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--memory", MEMORY.to_s]
    vb.customize ["modifyvm", :id, "--cpus", CPU_COUNT.to_s]
69 70 71 72

    # 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"]
73 74
  end
end