[chef] Run as root or as vagrant user


Chronological Thread 
  • From: Mark H. Nichols < >
  • To: " " < >
  • Subject: [chef] Run as root or as vagrant user
  • Date: Fri, 10 May 2013 17:38:20 -0500

I am creating a recipe to build JBoss AS 7.1.3 from source. The recipe works until the Maven build runs out of Java heap space. On the virtual machine I've set MAVEN_OPTS and JAVA_OPTS via a .bashrc file:

MAVEN_OPTS='-Xms1024m -Xmx2048m -XX:MaxPermSize=500m'
JAVA_OPTS='-Xms1024m -Xmx2048m -XX:MaxPermSize=512m -noverify'


export MAVEN_OPTS JAVA_OPTS …


However these environment settings are for the 'vagrant' user on the VM and I suspect that the chef solo provisioner runs things as 'root'.

I tried adding an export of JAVA_OPTS and MAVEN_OPTS to the recipe to force the memory setting regardless of the active user:

… 
bash "mvn install -DskipTests" do
  code <<-EOH
  cd /home/vagrant/src/jbossas
  export MAVEN_OPTS='-Xms1024m -Xmx2048m -XX:MaxPermSize=500m'
  export JAVA_OPTS='-Xms1024m -Xmx2048m -XX:MaxPermSize=512m -noverify'
  /usr/local/maven3/bin/mvn install -DskipTests -Dcheckstyle.skip=true
  EOH
end
… 

But that too resulted in an "out of Java heap space" error.

Obviously I am missing something. How do I ensure that my recipe has the heap space it requires?

Thanks,
Mark Nichols



Archive powered by MHonArc 2.6.16.

§