Frage

I have the following vagrant file with a shell provisioner that works great on Windows 7 VirtualBox but fails when running on my macbook pro OSX 10.9.2

To be more specific, the provisioner "seems" to fail to install the requirements.txt. If I SSH into the box and re-run the bootstrap.sh as root it works. I understand the long error messages would be helpful, but I think the question is geared at understanding why a virtual box setup would work on one environment and not the other. Especially, when launching such a simple shell script.

Any thoughts or suggestions are much appreciated!

Vagrant File

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.hostname = "test-box"

  config.vm.box = "hashicorp/precise64"

  config.vm.provision :shell, :path => "bootstrap.sh"
end

bootstrap.sh

#!/usr/bin/env bash

apt-get update
apt-get install -y build-essential curl git libffi-dev python-dev python-pip \
libxml2-dev libxslt1-dev python-software-properties g++ make

pip install --upgrade distribute
pip install -r /vagrant/requirements.txt

requirements.txt

Scrapy>=0.18.2
Twisted>=13.1.0
lxml>=3.2.3
queuelib>=1.0
w3lib>=1.3
War es hilfreich?

Lösung

The memory allocated to a VM is relative to the HOST's available memory. In this case, the MBP has 4gb and the VM was defaulted to about 300mb. This was not enough to successfully install the requirements.txt. A fix would be to increase the min memory needed in the Vagrant file, for example:

config.vm.provider :virtualbox do |vb|

vb.memory = 2048
vb.cpus = 2

end

The lesson in this is to make sure to set the Vagrant file with as much detail as possible to accurately replicate across systems.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top