Skip to content
Snippets Groups Projects
Vagrantfile 2.14 KiB
Newer Older
# -*- mode: ruby -*-
# vi: set ft=ruby :

REQUIRED_PLUGINS = %w(vagrant-cachier vagrant-vbguest)
exit unless REQUIRED_PLUGINS.all? do |plugin|
  Vagrant.has_plugin?(plugin) || (
    puts "The #{plugin} plugin is required. Please install it with:"
    puts "$ vagrant plugin install #{plugin}"
    false
  )
end

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
HOSTNAME=`hostname -s`
isLocalMode=true

if HOSTNAME.strip.eql? "dbis-w65107"
#  puts "Server mode"
  isLocalMode=false
else
#  puts "Local mode"
  isLocalMode=true
end

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.boot_timeout = 600

  # Hardware configuration
  # WARNING: Be VERY careful with this settings!!!
  #  -> giving the client more cores can SLOW DOWN the VM (if there is not enough workload on the guest, two less cores on the host...)
  config.vm.provider "virtualbox" do |v|
    v.name = (isLocalMode ? "isochrone-local" : "isochrone")
    v.gui = false
    v.cpus = 1
    v.memory = 2048
    v.customize ["modifyvm", :id, "--cpuexecutioncap", "100"]
    v.customize ["modifyvm", :id, "--ostype", "RedHat_64"]
  end

  # Enable vagrant-cachier plugin
  config.cache.enable :yum

  # Information about the box itself (name from vagrantcloud)
  config.vm.box = "jayunit100/centos7"

  # Setup of shared folders
  config.vm.synced_folder "conf", "/setup/conf"
  config.vm.synced_folder "img", "/setup/img"

  # Setup environment on startup (done using a shell script)
  config.vm.provision "shell", path: "bootstrap.sh", args: ["niko", "secretPhdPassword#2014!", (isLocalMode ? "true" : "false")]

  # Network configuration
  config.vm.network :forwarded_port, guest: 5432, host: 5432, auto_correct: true, id: "postgresql"
  config.vm.network :forwarded_port, guest: 7474, host: 7474, auto_correct: true, id: "neo4j"
  config.vm.network :forwarded_port, guest: 80,   host: 8000, auto_correct: true, id: "httpd"
  unless isLocalMode
  	config.vm.network :forwarded_port, guest: 8080, host: 8080, auto_correct: true, id: "tomcat"
  end
#  config.vm.network :private_network, :ip => '192.168.4.50'
#  config.vm.network :public_network
end