Basically you should be creating an init script for each java application 
that you start.  It should be the responsibility of that init script to set 
the JAVA_HOME/JAVA_BIN variables.  With this in mind you shouldn't need to 
worry about facts or different JAVA_HOME variables since the init script 
will set this explicitly for each java application you run.  You would want 
to have a java_home or java_bin puppet parameter in your class/define so 
that you can change java versions in hiera for a specific 
node/environment/datacenter.   If you want a "default" version that is the 
only reason I would see for setting JAVA_HOME in your bash_profile.
Have a look at java service wrappers to help automate that init script 
creation.  (This is what jenkins, puppetdb, and many others use).



Corey  

On Wednesday, July 2, 2014 3:06:46 AM UTC-7, Gavin Williams wrote:
>
> Morning all
>
> I'm currently working on a module[1] to support installation and 
> configuration of Apache Karaf[2], a Java OSGi container... 
>
> I've got most of the installation piece sorted, and am starting to work on 
> the configuration side of things. 
> Unfortunately I've hit a bit of a blocker which I'm not sure of the best 
> way to work-around. 
>
> As part of the service installation process, a Java wrapper config file is 
> created. 
> This config file needs to be modified to specify the 'JAVA_HOME' value. 
> However I'm not sure of the best way to calculate this JAVA_HOME value, due 
> to the variable nature of both Java variants (Java 6 vs 7, Oracle vs 
> OpenJDK, release version) and the fact that Java might not be installed at 
> the start of the Puppet run. 
> The intention is to use a template for the config file, so it's modifiable 
> by Puppet. 
>
> Options I can think of: 
>
>    1. Use a fact to provide JAVA_HOME. This fails if Java isn't installed 
>    at the start of the agent run, which is a valid scenario if this module is 
>    also installing Java... 
>    2. Hard code the value based on a pre-determined file path based on 
>    chosen Java distro and version. Not very clean/configurable...
>    3. Update wrapper config file to pull in system env for JAVA_HOME. 
>    However this fails if the system version isn't the one that the app should 
>    use... 
>    
> Am I missing a trick somewhere along the lines, or is hoping to achieve 
> all this - Install Java, Install Karaf, configure Karaf service - in one 
> run asking too much? 
>
> Thoughts/ideas welcome. 
>
> Cheers
> Gavin
>
> [1] https://github.com/fatmcgav/fatmcgav-karaf/tree/develop
> [2] http://karaf.apache.org/index.html
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/9ae083e2-7e5e-47c1-ab99-7f21a114f750%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to