[chef] Re: Re: Re: Problems with Tomcat cookbook


Chronological Thread 
  • From: Greg Barker < >
  • To: " " < >
  • Subject: [chef] Re: Re: Re: Problems with Tomcat cookbook
  • Date: Fri, 23 Jan 2015 10:50:35 -0800

Sean -

Why not put that in the README? That way people won't waste any time writing PRs that are never gonna get accepted.

Is the rewrite to make it driven by LWRP instead of attributes?

Greg

On Fri, Jan 23, 2015 at 9:37 AM, Vincenzo D'Amore < " target="_blank"> > wrote:
Hi, 

as far as I understood, if the attribute run_base_instance is set to false, the cookbook try to install the list of tomcat instances specified in the "instances" attribute.

The attribute name is required for the instance provider, when run_base_instance is set to true, the name attribute is set automatically to "base".
On the other hand, when run_base_instance is set to false, you must specify the name.
So, how have you configured the "instances" attribute?

I'm not a chef/ruby expert so read my comment with the due precaution, but I have tried to use the tomcat cookbook, and when I faced with first problems, I have debugged the scripts.
IMHO, there were several problems using tomcat cookbook, many attributes available are bugged and crash the cookbook. 
For example: try to add a ssl certificate.
There is a syntax error in the recipe users.
When you try use the cookbook, you will find few limitation, like: it is impossible add new aliases into the server.xml config, you cannot customise logger.properties files, and so on.
I my opinion, one of the biggest problem is that the cookbook is completely based on the default package management available on the host platform.
It means that it should be aware of the deployment configuration used by debian packages or centos, etc. 

At last, frustrated by this cookbook, I have abandoned this cookbook and decided to write a new one https://supermarket.chef.io/cookbooks/tomee  based on Apache TomEE, which is much newer and interesting project http://tomee.apache.org/index.html

Apache TomEE, pronounced "Tommy", is an all-Apache Java EE 6 Web Profile certified stack where Apache Tomcat is top dog. Apache TomEE is assembled from a vanilla Apache Tomcat zip file. We start with Apache Tomcat, add our jars and zip up the rest. The result is Tomcat with added EE features - TomEE.

Basically tomee cookbook installs tomcat 7 (one of the latest version). Tomee it starts in almost 2 seconds (yes), and can do everything can be done by tomcat.
If you have time you could try tomee.

Best regards,
Vincenzo



On Fri, Jan 23, 2015 at 5:24 PM, Stefán Freyr Stefánsson < " target="_blank"> > wrote:

I've created a minimal cookbook that sets the necessary attributes and calls the tomcat cookbook (the one we forked since the official one doesn't really work without some annoying hacks).


https://github.com/StFS/tomcat-cookbook-test


It includes a Gemfile and a Berksfile as well as a .lock files.

The test-kitchen config file (.kitchen.yml) defines two platforms (centos 7.0 and ubuntu 14.04) and a single suite that just runs the default recipe. The default recipe includes the apt cookbook (to update the packages on the ubuntu box) and then it includes the default tomcat recipe.


The attributes define a single custom instance and specify that the base instance should not be run.


Both platforms fail. The CentOS platform fails with the error message that I included in my previous mail (see below) and the Ubuntu platform fails with a similar message but not quite the same.

Here is the error message for the Ubuntu platform:

           ================================================================================
           Error executing action `create` on resource 'link[/var/lib/tomcat7-csa/webapps]'
           ================================================================================
           
           Errno::EISDIR
           -------------
           Is a directory @ unlink_internal - /var/lib/tomcat7-csa/webapps
           
           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cookbooks/tomcat/providers/instance.rb
           
            80:       link "#{new_resource.base}/#{name}" do
            81:         to new_resource.instance_variable_get("@#{attr}")
       
            83:     end
           
           Compiled Resource:
       
           # Declared in /tmp/kitchen/cookbooks/tomcat/providers/instance.rb:80:in `block (2 levels) in class_from_file'
           
           link("/var/lib/tomcat7-csa/webapps") do
             action :create
             retries 0
       
             default_guard_interpreter :default
             to "/var/lib/tomcat7-csa/webapps"
             link_type :symbolic"
             target_file "/var/lib/tomcat7-csa/webapps"
             declared_type :link
             cookbook_name :tomcat
           end

So it fails in a similar way (unable to link) but for a different directory (/var/lib/tomcat7-csa/webapps) than the CentOS run (which failed on the /usr/share/tomcat/bin​ directory).

Again, any help with this would be greatly appreciated.


-Stefan Freyr.



From: Stefán Freyr Stefánsson < " target="_blank"> >
Sent: Friday, January 23, 2015 1:31 PM
To: " target="_blank">
Subject: [chef] Problems with Tomcat cookbook
 

Hi.


We're using the Tomcat cookbook which is stored in the opscode github account.


Well, actually we are using our own fork of that in which we've applied some of the numerous outstanding pull requests.


So this brings me to my question. It seems that the Opscode Tomcat cookbook (https://github.com/opscode-cookbooks/tomcat) isn't getting a lot of attention. It has 33 open pull requests, some of which make perfect sense (at least to me) but they don't even have a comment on them regarding whether they'll get merged or not.


There is still _some_ activity. A pull request was merged a month ago so it's not totally dead.


I also found an email on this list from last August about an organized hack session (http://lists.opscode.com/sympa/arc/chef/2014-08/msg00026.html) although it has no replies and I don't know what came out of that.


Right now we're working on setting up a non-standard instance of tomcat through this recipe and it's not really going great.


I've set the default["tomcat"]["run_base_instance"] attribute to false and I've added a block with our own Tomcat instance. However, the recipe fails when trying to configure Tomcat with the following error:

           ================================================================================
           Error executing action `create` on resource 'link[/usr/share/tomcat/bin]'
           ================================================================================
           
           Errno::EISDIR
           -------------
           Is a directory - /usr/share/tomcat/bin
           
           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cookbooks/tomcat/providers/instance.rb
           
            74:       link "#{new_resource.base}/#{dir}" do
            75:         to "#{node['tomcat']['base']}/#{dir}"
            76:       end
            77:     end
           
           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cookbooks/tomcat/providers/instance.rb:74:in `block (2 levels) in class_from_file'
           
           link("/usr/share/tomcat/bin") do
             provider Chef::Provider::Link
             action :create
             retries 0
             retry_delay 2
             guard_interpreter :default
             to "/usr/share/tomcat/bin"
             link_type :symbolic
             target_file "/usr/share/tomcat/bin"
             cookbook_name :tomcat
           end
           
​It looks like the cookbook is trying to create a link (/usr/share/tomcat/bin) which points to itself. Not only that, but the location already exists as a directory so even if it were pointing to something that made sense, it wouldn't be able to create it as it already exists.

I'll try to create a self-contained example demonstrating the problem using Test Kitchen, but in the meantime, if anybody knows what's going on here I'd appreciate any help with this.

-Stefan Freyr.





--




Archive powered by MHonArc 2.6.16.

§