[Hemmerling] Software Development with Vagrant & Chef on VirtualBox

Oracle VirtualBox & Vagrant

Oracle VirtualBox

The Tool

  • Oracle VirtualBox - free OpenSource software, for Linux, WinXP, Vista, Win7.
  • License:
    • VirtualBox Personal Use and Evaluation License (PUEL) - “This license applies if you download the full VirtualBox binaries from the Downloads page. It does not apply to the VirtualBox Open Source Edition (OSE), which falls under the GPL instead;”, “In summary, the VirtualBox PUEL allows you to use VirtualBox free of charge 1. for personal use or, alternatively, 2. for product evaluation” → The commercial use of VirtualBox ( without VirtualBox Extension Pack ! ) is just free if you use and compile the OSE edition by yourself.
    • VirtualBox and open source - “Before version 4.0, there were two editions of VirtualBox: a full binary containing all features and an 'Open Source Edition' (OSE) with source code. With version 4.0, there is only one version any more, which is open source, and the closed-source components have been moved to a separate extension pack” → The commercial use of the “VirtualBox Extension Pack” requires a commercial license.
  • “VirtualBox 4.0.6 Oracle VM VirtualBox Extension Pack” - “Support for USB 2.0 devices...”.
    • If your virtual computer supports USB, you may access a USB-2-Ethernet adapter connected to your physical computer, and so you may access a totally different ( sub- ) network by your virtual computer, than that of your physical computer.
  • Virtual Box Guest Additions.
    • “Insert Guest Additios CD” → There is a file in the VirtualBox download offer.
    • Shares: Use “net use x: \\vboxsvr\share” to access a shared folder named share from a DOS-like OS, or “mount -t vboxsf share mount_point” to access it from a Linux OS. This feature requires Guest Additions.
  • W2k host support.
  • PIII host support, on Win7.
      • “Ubuntu/Debian based distributions - Most of the Ubuntu/Debian distributions do not have the “root” user enabled. It is the “sudo” command that will allow you to perform most functions you would do as root. Another option is to execute the “sudo su” command followed by the password: adminuser”.

Resources

  • On a virgin 64-bit Win10Pro after a default installation, just 64-bit Linux is not offered as guest operating system, just 32-bit Linux. If you try to install a 64-bit Linux as guest operating system, VirtualBox refuses by the error message
    VT-x is not available (VERR_VMX_NO_VMX)

Vagrant

Chef & Puppet

  • Vagrant can be configured by “provisioners” ( i.e. Chef, Puppet ): By an SSH shell command on Linux, Chef or Puppet may be used to do complete installation and configuration of Linux and of Linux applications.

Vagrant Tools

Resources

Setup of a Development Environment for the SocraMOB Hackergarten, either in a predefined VirtualBox ( automatized by Vagrant ) or with local Windows Tools

Tools

The Project

      • Vagrant / VirtualBox → chef/ubuntu-13.10-i386 ( A standard Ubuntu 13.04 x32 base install ).
      • Vagrant / VirtualBox → chef/ubuntu-13.10 ( A standard Ubuntu 13.04 x64 base install ).
  • If you boot the virtual machine from VirtualBoxManager, the TTY console “Ubuntu 13.10 vagrant tty1” opens.
    • You may login as:
      • vagrant login: “vagrant”.
      • Password: “vagrant”.
  • On Windows Vista and later, the virtual machines of VirtualBox for the user “Administrator” are stored at “C:\Users\AdministratorVirtualBox\VMs”.

Issues specific to the "SocraMOB Hackergarten" Project

Vagrant Issues

  • Even with VirtualBox 4.3.8, often the mounting of the file system and so the complete Vagrant installation fails :-(. When I changed the RAM memory from 384 MB to 1024 MB, the mouting failed at least once.
  • I am not shure if the installation process of Grunt-CLI was successful.
    • An expert told me that the ”?????????” lines do not indicate an error. Is that true ?
    • Is this a solution to install Grund-CLI again manually?:
      • Login by “vagrant ssh”.
      • Execute “sudo npm install -g grunt-cli”.
    • Message:
      ==> default: 200 https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz
      ==> default: npm
      ==> default:
      ==> default: http
      ==> default: 200 https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz
      ==> default: /usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
      ==> default: grunt-cli@0.1.13 /usr/local/lib/node_modules/grunt-cli
      ==> default: ????????? resolve@0.3.1
      ==> default: ????????? nopt@1.0.10 (abbrev@1.0.5)
      ==> default: ????????? findup-sync@0.1.3 (glob@3.2.11, lodash@2.4.1)
  • The installation process of “npm install” aborts on the Vagrant system.
    • Error message:
      > phantomjs@1.9.7-8 install /vagrant/node_modules/karma-phantomjs-launcher/node_modules/phantomjs
      > node install.js
      
      Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-i686.tar.bz2
      Saving to /tmp/phantomjs/phantomjs-1.9.7-linux-i686.tar.bz2
      Receiving...
      Received 13201K total.
      Extracting tar contents (via spawned process)
      Copying extracted folder /tmp/phantomjs/phantomjs-1.9.7-linux-i686.tar.bz2-extract-1401467600229/phant
      686 -> /vagrant/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom
      Writing location.js file
      Done. Phantomjs binary available at /vagrant/node_modules/karma-phantomjs-launcher/node_modules/phanto
      n/phantomjs
      npm WARN prefer global grunt-cli@0.1.13 should be installed with -g
      
      > Agora@1.0.0 prepublish /vagrant
      > sh ./prepublish.sh
      
      fatal: Not a git repository (or any parent up to mount point /vagrant)
      Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
      npm ERR! Agora@1.0.0 prepublish: `sh ./prepublish.sh`
      npm ERR! `sh "-c" "sh ./prepublish.sh"` failed with 128
      npm ERR!
  • When “npm install” aborts on the Vagrant system,
    • ”/vagrant/npm-debug.log” contains the informations:
      2033 silly exec sh "-c" "sh ./prepublish.sh"
      2034 silly sh,-c,sh ./prepublish.sh,/vagrant spawning
      2035 info Agora@1.0.0 Failed to exec prepublish script
      2036 error Agora@1.0.0 prepublish: `sh ./prepublish.sh`
      2036 error `sh "-c" "sh ./prepublish.sh"` failed with 128
      2037 error Failed at the Agora@1.0.0 prepublish script.
      2037 error This is most likely a problem with the Agora package,
      2037 error not with npm itself.
      2037 error Tell the author that this fails on your system:
      2037 error     sh ./prepublish.sh
      2037 error You can get their info via:
      2037 error     npm owner ls Agora
      2037 error There is likely additional logging output above.
      2038 error System Linux 3.11.0-12-generic
      2039 error command "/usr/bin/nodejs" "/usr/bin/npm" "install"
      2040 error cwd /vagrant
      2041 error node -v v0.10.15
      2042 error npm -v 1.2.18
      2043 error code ELIFECYCLE
      2044 verbose exit [ 1, true ]

Issues when using a local Software Installation

  • With local installation of the tool on Windows, one of the tasks for setting up the environment is to install Grunt and its Grunt CLI by “npm install -g grunt-cli”
    • Error message, if you for example mistyped the installation command by adding a space between “grunt” and ”-cli”, causing “grunt” to be installed, instead of the required “grunt-cli”:
      > Agora@1.0.0 test C:\Users\Public\projects\my_agora
      > grunt
      npm : 'grunt' is not recognized as an internal or external command,
      operable program or batch file.
      npm ERR! Test failed.  See above for more details.
      npm
      
  • The installation works fine on the local software development system on Windows. But the final test of the local software development system on Windows, by “npm test”:
    • It hangs on my system with local Windows tools. The last message is “Running 'karma:once' (karma) task” :-(.
    • With the Vagrant system, I never came up to this point :-(.

General Vagrant Issues

Vagrant does not run on legacy Hardware :-(

  • On my legacy Win7 computer with “Athlon XP2400” CPU, 3 GB RAM, with Vagrant 1.6.2: Calling “vagrant” ( with or without parameters ) fails by the error message:
    vagrant : Exception 0xc000001d 0x1003f 0x0
    
    PC=
    0x4791be
    time.init
    (
    )
        
    C:/Users/Mitchell/code/3rdparty/go/src/pkg/time/format.go
    :
    1151
     +
    0x12e
    os.init
    (
    )
        
    C:/Users/Mitchell/code/3rdparty/go/src/pkg/os/types_windows.go
    :
    104
     +
    0x57
    path/filepath.init
    (
    )
        
    C:/Users/Mitchell/code/3rdparty/go/src/pkg/path/filepath/symlink_windows.go
    :
    69
     +
    0x52
    github.com/mitchellh/osext.init
    (
    )
        
    C:/Users/Mitchell/code/go/src/github.com/mitchellh/osext/osext_windows.go
    :
    34
     +
    0x48
    main.init
    (
    )
        
    c:/Users/Mitchell/code/mitchellh/vagrant-installers/substrate/launcher/main.go
    :
    134
     +
    0x3d
    eax     
    0x0
    ebx     
    0x0
    ecx     
    0x0
    edx     
    0x115f3560
    edi     
    0x362110
    esi     
    0x4e1a28
    ebp     
    0x4e1a20
    esp     
    0x362100
    eip     
    0x4791be
    eflags  
    0x10202
    cs      
    0x1b
    fs      
    0x3b
    gs      
    0x0
    

General Issues

  • Issue “Port Forwarding”:
    • Wireshark Wiki "Mongo" - “The well known TCP port for Mongo traffic is 27017”.
    • Error message during installation:
      vagrant : Vagrant cannot forward the specified ports on this VM, since they
      would collide with some other application that is already listening
      on these ports. The forwarded port to 27017 is already in use
      on the host machine.
      
      To fix this, modify your current projects Vagrantfile to use another
      port. Example, where '1234' would be replaced by a unique host port:
      
        config.vm.network :forwarded_port, guest: 27017, host: 1234
        config.vm.network :forwarded_port, guest: 28017, host: 1235
        config.vm.network :forwarded_port, guest: 17124, host: 1236
      
      Sometimes, Vagrant will attempt to auto-correct this for you. In this
      case, Vagrant was unable to. This is usually because the guest machine
      is in a state which doesn't allow modifying port forwarding.
      
  • Issue with VirtualBox Guest Additions 4.3.10 and 4.3.12:
  • Login with “vagrant ssh” fails on Windows without installation of special additional tools.
    • Install Git and add the “bin” folder of the Git installation ( e.g. “C:\Program Files\Git\bin” ) to the system path, to enable Vagrant to use the SSH client of Git.
    • Error message with “vagrant up” without installed SSH client:
      vagrant : `ssh` executable not found in any directories in the %PATH% variable. Is an
      SSH client installed? Try installing Cygwin, MinGW or Git, all of which
      contain an SSH client. Or use the PuTTY SSH client with the following
      authentication information shown below:
      
      Host: 127.0.0.1
      Port: 2222
      Username: vagrant
      Private key: C:/Users/Administrator/.vagrant.d/insecure_private_key
      

Resources

 
en/vagrant.html.txt · Last modified: 2017/10/20 13:01 (external edit) · []
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki