[chef] Re: Run as root or as vagrant user


Chronological Thread 
  • From: "Mark H. Nichols" < >
  • To:
  • Subject: [chef] Re: Run as root or as vagrant user
  • Date: Tue, 14 May 2013 15:18:35 -0500


On May 10, 2013, at 5:46 PM, AJ Christensen < "> > wrote:

Try the 'environment' parameter to the bash script resource (it's
actually from the Execute resource, but this inherits that)

bash 'foo' do
 environment 'MAVEN_OPTS' => '-Xms1024m -Xmx2048m -XX:MaxPermSize=500m'
end

I added the "environment" setting to my recipe, resulting in this code:

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

However, I'm still getting a Java Heap space error. 

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:01.567s
[INFO] Finished at: Tue May 14 20:13:36 UTC 2013
[INFO] Final Memory: 105M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project jboss-as-clustering-infinispan: Fatal error compiling: Error while executing the compiler. InvocationTargetException: Java heap space -> [Help 1]

From the output it appears that the "environment" setting is not working, as the memory is shown as 121M and not the 1024M minimum asked for.

Is it not possible to use Maven to build something during a Chef run?




etc.

Maybe consider structuring it a little different as well? Write a
shell script or similar, included in your code-base which wraps your
'mvn install', then just run that from Chef. That way you can re-run
or developers could run it if you're hooning around by hand anyway.
Just a thought :)

Ultimately I'd like to have two recipes in the cookbook. One to install a pre-built JBoss AS 7.1.3 binary, and a second one to build it on the fly. The second one would all developers to tweak the build to add or remove debugging options as needed. I am using :shell provisioning elsewhere in my setup. I'm not convinced that using that method would get around this problem however.

-- Mark




Archive powered by MHonArc 2.6.16.

§