- From: Sascha Bates <
>
- To:
- Subject: [chef] Re: Re: Re: Re: Trying to start/stop tomcat from my own cookbook
- Date: Sun, 12 May 2013 08:45:37 -0500
The execute block will
start your process as that user, but I'm not positive that it will
source the user environment files. You are much better off putting the
JAVA_HOME, etc into your custom script.
I'd put it like this:
If you are going to make your script the authority, don't depend on Chef
to do half the work, but ensure your script sources the files you need
or contains the environment variables it requires
OR
You might consider reconstructing your script into a chef recipe/def
that will 1) download a remote file, 2) stop the tomcat app 3) deploy
the file 4) start the tomcat app
In this fashion, you can set up tomcat as a service and trigger service
start stops from Chef.
Many of us in the community have wrestled with Java apps and would be
happy to help you refactor your recipe into something that takes better
advantage of Chef's primitives.
tl;dr discussion about tomcat deploy strategies:
---------------------------
Here is an example of the pattern I'm talking about: https://gist.github.com/sbates/5563535
This is a link to a definition I threw together for deploying Tomcat
apps in a dev env from Artifactory. Note that this is not a
production-ready pattern. It just runs, notices if there's a new war to
deploy and then stops the service, deletes the old war, and notifies the
"deploy" to run which basically copies in the new war and restarts the
service.
The important part of this to look at is notifications to stop, delete
and deploy. That pattern is really what you're looking to manage with
Chef or your deploy script.
You can also manage your war file manipulations with tools like Bryan
Berry's Ark resource (http://community.opscode.com/cookbooks/ark) or the
Riot Games Artifact cookbook
(https://github.com/RiotGames/artifact-cookbook) if you have complex
needs. I can also elaborate on why I wrote some separate code instead
of re-using community code in a separate email if anyone wants.
Bryan has also written a library for managing JVM Args:
https://github.com/bryanwb/jvmargs
I hope some of this helps and doesn't further confuse.
Sascha
Morgan Blackthorne wrote:
"
type="cite">
I would log in as the user and check to make sure that
those values are set. Also, if it's in .bashrc and startup.sh is using
/bin/sh, then they likely won't get loaded-- you might need to move it
to something like .profile (I forget exactly what startup file(s) sh
loads but I believe .bashrc / .bash_profile isn't included).
|
- [chef] Trying to start/stop tomcat from my own cookbook, Chandan Maheshwari, 05/10/2013
- [chef] Re: Trying to start/stop tomcat from my own cookbook, Chandan Maheshwari, 05/12/2013
- [chef] Re: Trying to start/stop tomcat from my own cookbook, Morgan Blackthorne, 05/12/2013
- [chef] Re: Re: Trying to start/stop tomcat from my own cookbook, Chandan Maheshwari, 05/12/2013
- [chef] Re: Re: Re: Trying to start/stop tomcat from my own cookbook, Morgan Blackthorne, 05/12/2013
- [chef] Re: Re: Re: Re: Trying to start/stop tomcat from my own cookbook, Chandan Maheshwari, 05/12/2013
- [chef] Re: Re: Re: Re: Trying to start/stop tomcat from my own cookbook, Sascha Bates, 05/12/2013
- [chef] Re: Re: Re: Re: Re: Trying to start/stop tomcat from my own cookbook, Chandan Maheshwari, 05/12/2013
- [chef] Re: Re: Re: Re: Re: Re: Trying to start/stop tomcat from my own cookbook, Sascha Bates, 05/12/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Trying to start/stop tomcat from my own cookbook, Morgan Blackthorne, 05/12/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Re: Trying to start/stop tomcat from my own cookbook, Chandan Maheshwari, 05/12/2013
- [chef] Re: Trying to start/stop tomcat from my own cookbook, Sascha Bates, 05/12/2013
- [chef] Re: Re: Trying to start/stop tomcat from my own cookbook, Chandan Maheshwari, 05/12/2013
- [chef] Re: Trying to start/stop tomcat from my own cookbook, Sascha Bates, 05/12/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Trying to start/stop tomcat from my own cookbook, Chandan Maheshwari, 05/12/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Trying to start/stop tomcat from my own cookbook, Paul Graydon, 05/12/2013
- [chef] Re: Re: Re: Re: Re: Re: Re: Re: Trying to start/stop tomcat from my own cookbook, Chandan Maheshwari, 05/12/2013
Archive powered by MHonArc 2.6.16.