Using `artifact` cookbook with Tomcat

I’m using the artifact cookbook (https://supermarket.chef.io/cookbooks/artifact https://supermarket.chef.io/cookbooks/artifact<https://supermarket.chef.io/cookbooks/artifact https://supermarket.chef.io/cookbooks/artifact>) to deploy Tomcat applications. The resulting directory structure looks a bit like this:

…/webapps
/foo
/current -> /var/lib/tomcat7/webapps/releases/1.0
/releases
/1.0
….

So far I have been unable to find the right set of server.xml and foo.xml (context) settings to get Tomcat to recognize that the app isn’t under /webapps/foo but rather is under /webapps/foo/current

Is anyone else using the artifact cookbook to deploy Tomcat wars, and if so, how are you configuring your host appbase, context path and context docbase?

Thanks,
Mark

You could explode the war somewhere else and symlink the current folder
into the webapps/foo where tomcat expects to find things.

On Sun, Feb 15, 2015 at 5:18 PM, Mark Nichols chef@zanshin.net wrote:

I’m using the artifact cookbook (
artifact versions<
artifact versions>) to deploy Tomcat
applications. The resulting directory structure looks a bit like this:

../webapps
/foo
/current -> /var/lib/tomcat7/webapps/releases/1.0
/releases
/1.0
….

So far I have been unable to find the right set of server.xml and foo.xml
(context) settings to get Tomcat to recognize that the app isn’t under
/webapps/foo but rather is under /webapps/foo/current

Is anyone else using the artifact cookbook to deploy Tomcat wars, and if
so, how are you configuring your host appbase, context path and context
docbase?

Thanks,
Mark

--
Thanks,

Mark

On Feb 15, 2015, at 4:32 PM, Mark Pimentel markpimentel22@gmail.com wrote:

You could explode the war somewhere else and symlink the current folder into the webapps/foo where tomcat expects to find things.

I tried that, and it does work. However, I wasn’t happy with the idea of having a “staging” area where the apps lived that Tomcat was symlinked to. We’ve gotten into binds in the past by having non-standard setups.

The whole current symlink is already a departure (at least for Tomcat).

My hope is that I can use artifact to expand the app and somehow configure Tomcat to find the expanded war.

On the surface this seems to be what a context xml file was designed for. However I can’t get past the appbase defined on the host. The error I get says:

WARNING: A docBase /var/lib/tomcat7/webapps/foo/current inside the host appBase has been specified, and will be ignored

This happens whether or not I have appbase set to nil (“”) or webapps. Nor does it matter where I put the context: I’ve tried in server.xml and in a foo.xml file under /etc/tomcat7/Catalina/localhost

— Mark

Le 2015-02-15 23:43, Mark Nichols a écrit :

On Feb 15, 2015, at 4:32 PM, Mark Pimentel markpimentel22@gmail.com wrote: You could explode the war somewhere else and symlink the current folder into the webapps/foo where tomcat expects to find things.

I tried that, and it does work. However, I wasn't happy with the idea of having a "staging" area where the apps lived that Tomcat was symlinked to. We've gotten into binds in the past by having non-standard setups.

The whole current symlink is already a departure (at least for Tomcat).

My hope is that I can use artifact to expand the app and somehow configure Tomcat to find the expanded war.

On the surface this seems to be what a context xml file was designed for. However I can't get past the appbase defined on the host. The error I get says:

WARNING: A docBase /var/lib/tomcat7/webapps/foo/current inside the host appBase has been specified, and will be ignored

This happens whether or not I have appbase set to nil ("") or webapps. Nor does it matter where I put the context: I've tried in server.xml and in a foo.xml file under /etc/tomcat7/Catalina/localhost

-- Mark

If it can help we use artifact in a staging area, render log4j.xml
template and some other and then call the manager deploy url giving the
staging /current path to let tomcat deploy it in its appBase.

extract from it where app_infos['artifactId'] give use the application
context root:

http_request "Call to Tomcat deploy API deploy_url" do
action :get
message
"path=/#{app_infos['artifactId']}&update=true&war=file:#{deploy_tmp_dir}/#{app_infos['artifactId']}/current"
url "http://localhost:8080/manager/text/deploy"
headers({"AUTHORIZATION" => "Basic
#{Base64.encode64("deploy_user:its_password")}"})
end

Hope it helps