Example using application_java?

Does anyone have an example that uses application_java?
We are deploying about 15 different war files into tomcat from a maven
repository (running nexus), there is a DB role that would need rails
migrations performed.
There is a simple example for deploying jenkins, but it doesn’t get
into migrations at all…

We’re currently deploying tomcat with the tomcat6 cookbook, dropping
the dependent jar files in with our own custom cookbook as we’d
originally wanted to avoid the methods that the tomcat and java
cookbook used for jar distribution.

Thanks all,
-Jesse

Jesse,

On Tue, May 29, 2012 at 9:11 PM, Jesse Campbell hikeit@gmail.com wrote:

Does anyone have an example that uses application_java?
We are deploying about 15 different war files into tomcat from a maven
repository (running nexus), there is a DB role that would need rails
migrations performed.
There is a simple example for deploying jenkins, but it doesn't get
into migrations at all..

We're currently deploying tomcat with the tomcat6 cookbook, dropping
the dependent jar files in with our own custom cookbook as we'd
originally wanted to avoid the methods that the tomcat and java
cookbook used for jar distribution.

documentation can/should be improved, but there is something in the
application cookbook.
There is nothing framework-specific to migrations anyway; as many
other feature in the application cookbook, it maps directly to the
deploy resource; its documentation applies.

Except... the Java cookbook does not use deploy at this time; it
didn't in the previous version, and unfortunately it still does not.

It's not very clear to me how migrations would fit in the workflow of
a typical Java shop. In fact I've brainstormed about application_java
with miscellaneous people and we haven't even touched on
migrations--not high-priority enough, I guess.

I'm curious: you mention Rails migrations? Do you also have a Rails
app, or do you use it just for managing migrations?
Could you maybe use application_ruby for that part, and then somehow
orchestrate the deployment interactions?

Andrea

On Tue, May 29, 2012 at 10:20 PM, Andrea Campi <andrea.campi@zephirworks.com

wrote:

Jesse,

On Tue, May 29, 2012 at 9:11 PM, Jesse Campbell hikeit@gmail.com wrote:

Does anyone have an example that uses application_java?
We are deploying about 15 different war files into tomcat from a maven
repository (running nexus), there is a DB role that would need rails
migrations performed.
There is a simple example for deploying jenkins, but it doesn't get
into migrations at all..

We're currently deploying tomcat with the tomcat6 cookbook, dropping
the dependent jar files in with our own custom cookbook as we'd
originally wanted to avoid the methods that the tomcat and java
cookbook used for jar distribution.

documentation can/should be improved, but there is something in the
application cookbook.
There is nothing framework-specific to migrations anyway; as many
other feature in the application cookbook, it maps directly to the
deploy resource; its documentation applies.

Except... the Java cookbook does not use deploy at this time; it
didn't in the previous version, and unfortunately it still does not.

It's not very clear to me how migrations would fit in the workflow of
a typical Java shop. In fact I've brainstormed about application_java
with miscellaneous people and we haven't even touched on
migrations--not high-priority enough, I guess.

As for migrations in java flyway and liquibase come into mind:
http://code.google.com/p/flyway/

Don't have a concrete (and chefifyed) example though...

Torben

I'm curious: you mention Rails migrations? Do you also have a Rails

app, or do you use it just for managing migrations?
Could you maybe use application_ruby for that part, and then somehow
orchestrate the deployment interactions?

Andrea

We deploy our rails apps in war/java containers using something called
Warbler (this comes from the developers, I haven't investigated it
myself). The dev group wants us to implement capistrano, but i feel
like that is like saying we should use puppet for this one thing...
we're a chef shop, do it the chef way is how I want to respond... but
so far I haven't found what i need.
We may continue using Bryan's tomcat6, and use his maven LWRP for
deploying the wars... but i think even that may leave us without a
migrations plan...
perhaps there is a way to use some aspects of the deploy resource to
orchestrate migrations... i'll investigate later in the week (for now
I just need to get things running once to get the PMs off my back).

-Jesse

On Tue, May 29, 2012 at 4:20 PM, Andrea Campi
andrea.campi@zephirworks.com wrote:

Jesse,

On Tue, May 29, 2012 at 9:11 PM, Jesse Campbell hikeit@gmail.com wrote:

Does anyone have an example that uses application_java?
We are deploying about 15 different war files into tomcat from a maven
repository (running nexus), there is a DB role that would need rails
migrations performed.
There is a simple example for deploying jenkins, but it doesn't get
into migrations at all..

We're currently deploying tomcat with the tomcat6 cookbook, dropping
the dependent jar files in with our own custom cookbook as we'd
originally wanted to avoid the methods that the tomcat and java
cookbook used for jar distribution.

documentation can/should be improved, but there is something in the
application cookbook.
There is nothing framework-specific to migrations anyway; as many
other feature in the application cookbook, it maps directly to the
deploy resource; its documentation applies.

Except... the Java cookbook does not use deploy at this time; it
didn't in the previous version, and unfortunately it still does not.

It's not very clear to me how migrations would fit in the workflow of
a typical Java shop. In fact I've brainstormed about application_java
with miscellaneous people and we haven't even touched on
migrations--not high-priority enough, I guess.

I'm curious: you mention Rails migrations? Do you also have a Rails
app, or do you use it just for managing migrations?
Could you maybe use application_ruby for that part, and then somehow
orchestrate the deployment interactions?

Andrea

On Wed, May 30, 2012 at 12:37 AM, Jesse Campbell hikeit@gmail.com wrote:

We deploy our rails apps in war/java containers using something called
Warbler (this comes from the developers, I haven't investigated it
myself). The dev group wants us to implement capistrano, but i feel
like that is like saying we should use puppet for this one thing...
we're a chef shop, do it the chef way is how I want to respond... but
so far I haven't found what i need.
We may continue using Bryan's tomcat6, and use his maven LWRP for
deploying the wars... but i think even that may leave us without a
migrations plan...
perhaps there is a way to use some aspects of the deploy resource to
orchestrate migrations... i'll investigate later in the week (for now
I just need to get things running once to get the PMs off my back).

For a quick and dirty fix, you could try subscribing to the
java_remote_file resource.
I haven't actually tried this so YMMV, but it should be doable.

I'd start with something like this:

assuming you have a:

application "app-test" do
...
end

then in your recipe add something like:

execute "migrate app-test" do
command "rake db:migrate" # or whatever shell command you need to run
action :nothing
subscribes :run, resources(:java_remote_file => "app-test")
end

Maybe it will work on the first attempt :slight_smile:
If it won't, run it with chef-client -l debug and email me the log
(private email) and I'll walk you through the rest.
Once we get you set up, I'll document it for the next poor soul.

Andrea

I'll give that a try in the next week or two and see how far I get. We
have a deadline for go-live, and migration doesn't have to be ready
for the first deploy, so I'll have to wait until things are up before
I can revisit it.

Thanks!!!

On Wed, May 30, 2012 at 3:03 AM, Andrea Campi
andrea.campi@zephirworks.com wrote:

On Wed, May 30, 2012 at 12:37 AM, Jesse Campbell hikeit@gmail.com wrote:

We deploy our rails apps in war/java containers using something called
Warbler (this comes from the developers, I haven't investigated it
myself). The dev group wants us to implement capistrano, but i feel
like that is like saying we should use puppet for this one thing...
we're a chef shop, do it the chef way is how I want to respond... but
so far I haven't found what i need.
We may continue using Bryan's tomcat6, and use his maven LWRP for
deploying the wars... but i think even that may leave us without a
migrations plan...
perhaps there is a way to use some aspects of the deploy resource to
orchestrate migrations... i'll investigate later in the week (for now
I just need to get things running once to get the PMs off my back).

For a quick and dirty fix, you could try subscribing to the
java_remote_file resource.
I haven't actually tried this so YMMV, but it should be doable.

I'd start with something like this:

assuming you have a:

application "app-test" do
...
end

then in your recipe add something like:

execute "migrate app-test" do
command "rake db:migrate" # or whatever shell command you need to run
action :nothing
subscribes :run, resources(:java_remote_file => "app-test")
end

Maybe it will work on the first attempt :slight_smile:
If it won't, run it with chef-client -l debug and email me the log
(private email) and I'll walk you through the rest.
Once we get you set up, I'll document it for the next poor soul.

Andrea

Hi,

I'm having the same problem.

Could sb. please give me an example, how to deploy a Java .war using application_java?
It's driving me nuts..
I always end up with the same problem as this poor guy: Error using application cookbook to deploy hello.war · GitHub

Thanks!
Steffen

On May 29, 2012, at 9:11 PM, Jesse Campbell hikeit@gmail.com wrote:

Does anyone have an example that uses application_java?
We are deploying about 15 different war files into tomcat from a maven
repository (running nexus), there is a DB role that would need rails
migrations performed.
There is a simple example for deploying jenkins, but it doesn't get
into migrations at all..

We're currently deploying tomcat with the tomcat6 cookbook, dropping
the dependent jar files in with our own custom cookbook as we'd
originally wanted to avoid the methods that the tomcat and java
cookbook used for jar distribution.

Thanks all,
-Jesse

On Thu, Aug 9, 2012 at 3:45 PM, Steffen Gebert st+opscode@st-g.de wrote:

Hi,

I'm having the same problem.

Could sb. please give me an example, how to deploy a Java .war using
application_java?
It's driving me nuts..
I always end up with the same problem as this poor guy:
https://gist.github.com/2959823

The same error? That's strange.
Can you do a run with chef-client -l debug and post it somewhere
online / attach it / send it to me.

The only resource that could raise that error is this one:

You could try specifying the action explicitly:

template "#{new_resource.path}/shared/#{new_resource.application.name}.xml" do
action :create
… leave the rest unchanged
end

But that's just a hunch—the log will make it clearer.

Andrea

Hi Andrea,

thanks for your offer to help!

I've pasted the log here:

and the recipe here: chef-gitblit/recipes/default.rb at master · StephenKing/chef-gitblit · GitHub

Changing the application_java cookbook as suggested also didn't help.

Thanks!
Steffen

On Aug 9, 2012, at 4:19 PM, Andrea Campi andrea.campi@zephirworks.com wrote:

On Thu, Aug 9, 2012 at 3:45 PM, Steffen Gebert st+opscode@st-g.de wrote:

Hi,

I'm having the same problem.

Could sb. please give me an example, how to deploy a Java .war using
application_java?
It's driving me nuts..
I always end up with the same problem as this poor guy:
Error using application cookbook to deploy hello.war · GitHub

The same error? That's strange.
Can you do a run with chef-client -l debug and post it somewhere
online / attach it / send it to me.

The only resource that could raise that error is this one:
application_java/providers/java_webapp.rb at master · poise/application_java · GitHub
You could try specifying the action explicitly:

template "#{new_resource.path}/shared/#{new_resource.application.name}.xml" do
action :create
… leave the rest unchanged
end

But that's just a hunch—the log will make it clearer.

Andrea