diff --git a/.vagrant-puppet/manifests/finalize.sh b/.vagrant-puppet/manifests/finalize.sh index ab43f5140..7d095ccb0 100644 --- a/.vagrant-puppet/manifests/finalize.sh +++ b/.vagrant-puppet/manifests/finalize.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + installJquery () { # The npm module jquery won't install via puppet because of an mysterious error # when node-gyp rebuilding the dependent contextify module @@ -10,8 +12,17 @@ installJquery () { mountIcinga2webConfd () { # Remount /vagrant/config with appropriate permissions since the group apache is missing initially - mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g apache`,dmode=775,fmode=775 v-icinga2web-conf.d /vagrant/config + mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g apache`,dmode=775,fmode=775 /vagrant/config /vagrant/config +} + +startServicesWithNonLSBCompliantExitStatusCodes () { + # Unfortunately the ido2db init script is not LSB compliant and hence not started via puppet + service ido2db-mysql start || true + service ido2db-pgsql start || true } installJquery mountIcinga2webConfd +startServicesWithNonLSBCompliantExitStatusCodes + +exit 0 diff --git a/README.md b/README.md index fe587e3c5..57db19b24 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ ## Vagrant + +> **Note** that the deployment of the virtual machine is tested against Vagrant starting with version 1.1. +> Unfortunately older versions will not work. + The Icinga 2 Web project ships with a Vagrant virtual machine that integrates the source code with various services and example data in a controlled environment. This enables developers and users to test Livestatus, status.dat, diff --git a/Vagrantfile b/Vagrantfile index 3b22d18d2..99900bc73 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,7 +1,7 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -Vagrant::Config.run do |config| +Vagrant.configure("2") do |config| # All Vagrant configuration is done here. The most common configuration # options are documented and commented below. For a complete reference, # please see the online documentation at vagrantup.com. @@ -13,24 +13,59 @@ Vagrant::Config.run do |config| # doesn't already exist on the user's system. config.vm.box_url = "http://vagrant-boxes.icinga.org/centos-64-x64-vbox4212.box" - # Boot with a GUI so you can see the screen. (Default is headless) - # config.vm.boot_mode = :gui + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + config.vm.network :forwarded_port, guest: 80, host: 8080, + # Port collision auto-correction must be manually enabled for each forwarded port, + # since it is often surprising when it occurs and can lead the Vagrant user to + # think that the port wasn't properly forwarded. During a vagrant up or vagrant reload, + # Vagrant will output information about any collisions detections and auto corrections made, + # so you can take notice and act accordingly. + auto_correct: true - # Assign this VM to a host-only network IP, allowing you to access it - # via the IP. Host-only networks can talk to the host machine as well as - # any other machines on the same network, but cannot be accessed (through this - # network interface) by any external networks. - # config.vm.network :hostonly, "192.168.33.10" + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network :private_network, ip: "192.168.33.10" - # Assign this VM to a bridged network, allowing you to connect directly to a - # network using the host's network device. This makes the VM appear as another - # physical device on your network. - # config.vm.network :bridged + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network :public_network - # Forward a port from the guest to the host, which allows for outside - # computers to access the VM, whereas host only networking does not. - config.vm.forward_port 80, 8080 + # If true, then any SSH connections made will enable agent forwarding. + # Default value: false + # config.ssh.forward_agent = true + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + config.vm.synced_folder "./config", "/vagrant/config" + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider :virtualbox do |vb| + # # Don't boot with headless mode + # vb.gui = true + # + # # Use VBoxManage to customize the VM. For example to change memory: + # vb.customize ["modifyvm", :id, "--memory", "1024"] + # end + # + # View the documentation for the provider you're using for more + # information on available options. + config.vm.provider "virtualbox" do |vb| + vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate//vagrant/config", "1"] + end + + # Enable provisioning with Puppet stand alone. Puppet manifests + # are contained in a directory path relative to this Vagrantfile. + # You will need to create the manifests directory and a manifest in + # the file base.pp in the manifests_path directory. + # # An example Puppet manifest to provision the message of the day: # # # group { "puppet": @@ -43,17 +78,11 @@ Vagrant::Config.run do |config| # # content => "Welcome to your Vagrant-built virtual machine! # # Managed by Puppet.\n" # # } - - # Share an additional folder to the guest VM. The first argument is - # an identifier, the second is the path on the guest to mount the - # folder, and the third is the path on the host to the actual folder. - config.vm.share_folder "v-icinga2web-conf.d", "/vagrant/config", "./config" - config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-icinga2web-conf.d", "1"] - - # Enable provisioning with Puppet stand alone. Puppet manifests - # are contained in a directory path relative to this Vagrantfile. - # You will need to create the manifests directory and a manifest in - # the file default.pp in the manifests_path directory. + # + # config.vm.provision :puppet do |puppet| + # puppet.manifests_path = "manifests" + # puppet.manifest_file = "init.pp" + # end config.vm.provision :puppet do |puppet| puppet.module_path = ".vagrant-puppet/modules" puppet.manifests_path = ".vagrant-puppet/manifests"