From 703701a25c1e8095e19749a2726a1f6270e583d8 Mon Sep 17 00:00:00 2001 From: Stephen Lauck Date: Mon, 17 Jun 2013 15:33:20 -0700 Subject: [PATCH 01/13] do not write app.xml if no context file specified --- providers/java_webapp.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/java_webapp.rb b/providers/java_webapp.rb index 9f50a38..ab65548 100644 --- a/providers/java_webapp.rb +++ b/providers/java_webapp.rb @@ -26,7 +26,7 @@ create_hierarchy - create_context_file + create_context_file unless new_resource.context_template.nil? end From 7947b98f2774f8658a235eb5f8c31bce82f09116 Mon Sep 17 00:00:00 2001 From: Stephen Lauck Date: Mon, 17 Jun 2013 15:34:03 -0700 Subject: [PATCH 02/13] move link context to def and only call if resource is present for context --- providers/tomcat.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/providers/tomcat.rb b/providers/tomcat.rb index 2009fdc..df6f1b4 100644 --- a/providers/tomcat.rb +++ b/providers/tomcat.rb @@ -43,10 +43,8 @@ not_if "test -L #{node['tomcat']['context_dir']}/ROOT.xml" end - link "#{node['tomcat']['context_dir']}/#{new_resource.application.name}.xml" do - to "#{new_resource.application.path}/shared/#{new_resource.application.name}.xml" - notifies :restart, resources(:service => "tomcat") - end + link_context_file unless new_resource.context_template.nil? + end action :before_migrate do @@ -60,3 +58,12 @@ action :after_restart do end + +protected + +def link_context_file + link "#{node['tomcat']['context_dir']}/#{new_resource.application.name}.xml" do + to "#{new_resource.application.path}/shared/#{new_resource.application.name}.xml" + notifies :restart, resources(:service => "tomcat") + end +end \ No newline at end of file From 3acfad2268c50496cec4acb8aefa1c4a2df9b121 Mon Sep 17 00:00:00 2001 From: Stephen Lauck Date: Mon, 17 Jun 2013 15:34:21 -0700 Subject: [PATCH 03/13] add resource for context file --- resources/tomcat.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/tomcat.rb b/resources/tomcat.rb index 790a8bf..e630c18 100644 --- a/resources/tomcat.rb +++ b/resources/tomcat.rb @@ -18,3 +18,5 @@ # include Chef::Resource::ApplicationBase + +attribute :context_template, :kind_of => [String, NilClass], :default => nil \ No newline at end of file From 3ec4bf4050d6d9df8598769a06a70d4e1c15b85d Mon Sep 17 00:00:00 2001 From: Tommy Fotak Date: Mon, 16 Sep 2013 17:31:08 -0400 Subject: [PATCH 04/13] [COOK-3563] Replace calls to Chef::Mixin::RecipeDefinitionDSLCore Signed-off-by: Seth Vargo --- README.md | 2 +- providers/java_webapp.rb | 2 +- providers/tomcat.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c8d492c..66a64f0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Other application stacks may be supported at a later date. Requirements ============ -Chef 0.10.0 or higher required (for Chef environment use). +Chef 0.11.0 or higher required (for Chef environment use). The following Opscode cookbooks are dependencies: diff --git a/providers/java_webapp.rb b/providers/java_webapp.rb index 9f50a38..4b551f4 100644 --- a/providers/java_webapp.rb +++ b/providers/java_webapp.rb @@ -17,7 +17,7 @@ # limitations under the License. # -include Chef::Mixin::LanguageIncludeRecipe +include Chef::DSL::IncludeRecipe action :before_compile do end diff --git a/providers/tomcat.rb b/providers/tomcat.rb index 2009fdc..5f3b604 100644 --- a/providers/tomcat.rb +++ b/providers/tomcat.rb @@ -17,7 +17,7 @@ # limitations under the License. # -include Chef::Mixin::LanguageIncludeRecipe +include Chef::DSL::IncludeRecipe action :before_compile do From b958e48847f1774d47ed91095e06c1ecfce9f242 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 16 Sep 2013 17:33:22 -0400 Subject: [PATCH 05/13] Update CHANGELOG --- CHANGELOG.md | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71c993d..b2d0b7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,24 +1,26 @@ -## v2.0.0: +application_java Cookbook CHANGELOG +=================================== +This file is used to list changes made in each version of the application_java cookbook. -### Bug +v2.0.0 +------ +### Bug - [COOK-3306]: Multiple Memory Leaks in Application Cookbook -## v1.1.0: - +v1.1.0 +------ ### Bug +- [COOK-2523]: deployments do not follow standards set by the Deploy provider -- [COOK-2523]: deployments do not follow standards set by the Deploy - provider - -## v1.0.4: - -* [COOK-2271] - ValidationFailed error in `java_webapp` provider - -## v1.0.2: - -* [COOK-1680] - Add deploy action (alias for create) to `java_remote_file` +v1.0.4 +------ +- [COOK-2271] - ValidationFailed error in `java_webapp` provider -## v1.0.0: +v1.0.2 +------ +- [COOK-1680] - Add deploy action (alias for create) to `java_remote_file` -* [COOK-1243] - Initial release - relates to COOK-634. +v1.0.0 +------ +- [COOK-1243] - Initial release - relates to COOK-634. From 041a2407d4ab507f01a157b2512c19b7ed5f560e Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 16 Sep 2013 17:37:34 -0400 Subject: [PATCH 06/13] Updated README format --- README.md | 218 ++++++++++++++++++++++++++---------------------------- 1 file changed, 106 insertions(+), 112 deletions(-) diff --git a/README.md b/README.md index 66a64f0..f5b45ff 100644 --- a/README.md +++ b/README.md @@ -1,172 +1,165 @@ -Description -=========== - +application_java Cookbook +========================= This cookbook is designed to be able to describe and deploy Java web applications. Currently supported: -* Java -* Tomcat +- Java +- Tomcat Note that this cookbook provides the Java-specific bindings for the `application` cookbook; you will find general documentation in that cookbook. Other application stacks may be supported at a later date. -Requirements -============ +Requirements +------------ Chef 0.11.0 or higher required (for Chef environment use). The following Opscode cookbooks are dependencies: -* application -* java -* tomcat +- application +- java +- tomcat -Resources/Providers -========== +Resources/Providers +------------------- The LWRPs provided by this cookbook are not meant to be used by themselves; make sure you are familiar with the `application` cookbook before proceeding. -java\_webapp ------------ +### `java\_webapp` The `java\_webapp` sub-resource LWRP deals with deploying Java webapps delivered as WAR files which will either be retrieved from a remote URL or fetched by some other method and referenced locally. NOTICE: the `application` cookbook was designed around frameworks running on interpreted languages that are deployed in source code, checked out of an SCM using the `deploy_revision` resource. While this cookbook tries to map those concepts to a binary distribution mechanism, it may not map exactly. -# Attribute Parameters - -* database\_master\_role: if a role name is provided, a Chef search will be run to find a node with than role in the same environment as the current role. If a node is found, its IP address will be used when rendering the context file, but see the "Database block parameters" section below -* context\_template: the name of template that will be rendered to create the context file; if specified it will be looked up in the application cookbook. Defaults to "context.xml.erb" from this cookbook -* database: a block containing additional parameters for configuring the database connection (see below) -* war: if provided, will override the default of the basename of the repository - -# Database block parameters +#### Attribute Parameters +- database\_master\_role: if a role name is provided, a Chef search will be run to find a node with than role in the same environment as the current role. If a node is found, its IP address will be used when rendering the context file, but see the "Database block parameters" section below +- context\_template: the name of template that will be rendered to create the context file; if specified it will be looked up in the application cookbook. Defaults to "context.xml.erb" from this cookbook +- database: a block containing additional parameters for configuring the database connection (see below) +- war: if provided, will override the default of the basename of the repository +#### Database block parameters The database block can accept any method, with the following being expected by the stock context.xml.erb: -* driver: a fully-qualified class name of the JDBC driver -* host: hostname or IP address of the database server; if set it will take precedence over the address returned from the search for database\_master\_role -* port: port to use to connect to the database server -* database -* username -* password -* max\_active: used to set the maxActive context parameter -* max\_idle: used to set the maxIdle context parameter -* max\_wait: used to set the maxWait context parameter +- driver: a fully-qualified class name of the JDBC driver +- host: hostname or IP address of the database server; if set it will take precedence over the address returned from the search for database\_master\_role +- port: port to use to connect to the database server +- database +- username +- password +- max\_active: used to set the maxActive context parameter +- max\_idle: used to set the maxIdle context parameter +- max\_wait: used to set the maxWait context parameter You can invoke any other method on the database block, which will result in an entry being created in the `@database` Hash which is passed to the context template. See the examples below for more information. -tomcat ------- - +#### tomcat The `tomcat` sub-resource LWRP configures Tomcat to run the application by creating a symbolic link to the context file. -Attributes -========== - -scm\_provider ------------- +Attributes +---------- +### scm\_provider Supports all standard scm providers (git, svn), and in addition: * Chef::Provider::RemoteFile::Deploy allows downloading from a remote url * Chef::Provider::File::Deploy allows using a package on the filesystem -path ----- - +### path The target location for the application distribution. This should be outside of the tomcat deployment tree. -repository ----------- - +### repository For a git or svn repository, it is the repository URL When using Chef::Provider::RemoteFile::Deploy, it is the URL of the remote file When using Chef::Provider::File::Deploy, it is the path to the local file source -revision --------- - +### revision Name of the path within releases, defaults to the checksum of the downloaded file -Usage -===== +Usage +----- A sample application that needs a database connection: - application "my-app" do - path "/usr/local/my-app" - repository "/nas/distro/my-app.war" - revision "..." - scm_provider Chef::Provider::File::Deploy - - java_webapp do - database_master_role "database_master" - database do - driver 'org.gjt.mm.mysql.Driver' - database 'name' - port 5678 - username 'user' - password 'password' - max_active 1 - max_idle 2 - max_wait 3 - end - end - - tomcat +```ruby +application 'my-app' do + path '/usr/local/my-app' + repository '/nas/distro/my-app.war' + revision '...' + scm_provider Chef::Provider::File::Deploy + + java_webapp do + database_master_role 'database_master' + database do + driver 'org.gjt.mm.mysql.Driver' + database 'name' + port 5678 + username 'user' + password 'password' + max_active 1 + max_idle 2 + max_wait 3 end + end -If your application does not need a database connection (or you need a custom -context file for other reasons), you can specify your own template: + tomcat +end +``` - application "jenkins" do - path "/usr/local/jenkins" - owner node["tomcat"]["user"] - group node["tomcat"]["group"] - repository "http://mirrors.jenkins-ci.org/war/latest/jenkins.war" - revision "6facd94e958ecf68ffd28be371b5efcb5584c885b5f32a906e477f5f62bdb518-1" - scm_provider Chef::Provider::RemoteFile::Deploy +If your application does not need a database connection (or you need a custom context file for other reasons), you can specify your own template: - java_webapp do - context_template "jenkins-context.xml.erb" - end +```ruby +application 'jenkins' do + path '/usr/local/jenkins' + owner node['tomcat']['user'] + group node['tomcat']['group'] + repository 'http://mirrors.jenkins-ci.org/war/latest/jenkins.war' + revision '6facd94e958ecf68ffd28be371b5efcb5584c885b5f32a906e477f5f62bdb518-1' + scm_provider Chef::Provider::RemoteFile::Deploy - tomcat - end + java_webapp do + context_template 'jenkins-context.xml.erb' + end + + tomcat +end +``` You can invoke any method on the database block: - application "my-app" do - path "/usr/local/my-app" - repository "..." - revision "..." - - java_webapp do - database_master_role "database_master" - database do - database 'name' - quorum 2 - replicas %w[Huey Dewey Louie] - end - end +```ruby +application 'my-app' do + path '/usr/local/my-app' + repository '...' + revision '...' + + java_webapp do + database_master_role 'database_master' + database do + database 'name' + quorum 2 + replicas %w[Huey Dewey Louie] end + end +end +``` The corresponding entries will be passed to the context template: - - - - - -License and Author -================== - -Author:: Adam Jacob () -Author:: Andrea Campi () -Author:: Jesse Campbell () -Author:: Joshua Timberman () -Author:: Seth Chisamore () - +```erb + + + + +``` + +License & Authors +----------------- +- Author:: Adam Jacob (adam@opscode.com) +- Author:: Andrea Campi (andrea.campi@zephirworks.com) +- Author:: Jesse Campbell (hikeit@gmail.com) +- Author:: Joshua Timberman (joshua@opscode.com) +- Author:: Seth Chisamore (schisamo@opscode.com) + +```text Copyright 2009-2012, Opscode, Inc. Licensed under the Apache License, Version 2.0 (the "License"); @@ -180,3 +173,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +``` From 1a978a2b19eac219164d1435ecda490f511d0cef Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 30 Sep 2013 21:08:28 -0400 Subject: [PATCH 07/13] Use new CONTRIBUTING.md --- CONTRIBUTING | 29 ------ CONTRIBUTING.md | 257 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 257 insertions(+), 29 deletions(-) delete mode 100644 CONTRIBUTING create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING b/CONTRIBUTING deleted file mode 100644 index 89ac873..0000000 --- a/CONTRIBUTING +++ /dev/null @@ -1,29 +0,0 @@ -If you would like to contribute, please open a ticket in JIRA: - -* http://tickets.opscode.com - -Create the ticket in the COOK project and use the cookbook name as the -component. - -For all code contributions, we ask that contributors sign a -contributor license agreement (CLA). Instructions may be found here: - -* http://wiki.opscode.com/display/chef/How+to+Contribute - -When contributing changes to individual cookbooks, please do not -modify the version number in the metadata.rb. Also please do not -update the CHANGELOG.md for a new version. Not all changes to a -cookbook may be merged and released in the same versions. Opscode will -handle the version updates during the release process. You are welcome -to correct typos or otherwise make updates to documentation in the -README. - -If a contribution adds new platforms or platform versions, indicate -such in the body of the commit message(s), and update the relevant -COOK ticket. When writing commit messages, it is helpful for others if -you indicate the COOK ticket. For example: - - git commit -m '[COOK-1041] Updated pool resource to correctly delete.' - -In the ticket itself, it is also helpful if you include log output of -a successful Chef run, but this is not absolutely required. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3a99897 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,257 @@ +# Contributing to Opscode Cookbooks + +We are glad you want to contribute to Opscode Cookbooks! The first +step is the desire to improve the project. + +You can find the answers to additional frequently asked questions +[on the wiki](http://wiki.opscode.com/display/chef/How+to+Contribute). + +You can find additional information about +[contributing to cookbooks](http://wiki.opscode.com/display/chef/How+to+Contribute+to+Opscode+Cookbooks) +on the wiki as well. + +## Quick-contribute + +* Create an account on our [bug tracker](http://tickets.opscode.com) +* Sign our contributor agreement (CLA) +[ online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L) +(keep reading if you're contributing on behalf of your employer) +* Create a ticket for your change on the + [bug tracker](http://tickets.opscode.com) +* Link to your patch as a rebased git branch or pull request from the + ticket +* Resolve the ticket as fixed + +We regularly review contributions and will get back to you if we have +any suggestions or concerns. + +## The Apache License and the CLA/CCLA + +Licensing is very important to open source projects, it helps ensure +the software continues to be available under the terms that the author +desired. Chef uses the Apache 2.0 license to strike a balance between +open contribution and allowing you to use the software however you +would like to. + +The license tells you what rights you have that are provided by the +copyright holder. It is important that the contributor fully +understands what rights they are licensing and agrees to them. +Sometimes the copyright holder isn't the contributor, most often when +the contributor is doing work for a company. + +To make a good faith effort to ensure these criteria are met, Opscode +requires a Contributor License Agreement (CLA) or a Corporate +Contributor License Agreement (CCLA) for all contributions. This is +without exception due to some matters not being related to copyright +and to avoid having to continually check with our lawyers about small +patches. + +It only takes a few minutes to complete a CLA, and you retain the +copyright to your contribution. + +You can complete our contributor agreement (CLA) +[ online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L). +If you're contributing on behalf of your employer, have your employer +fill out our +[Corporate CLA](https://secure.echosign.com/public/hostedForm?formid=PIE6C7AX856) +instead. + +## Ticket Tracker (JIRA) + +The [ticket tracker](http://tickets.opscode.com) is the most important +documentation for the code base. It provides significant historical +information, such as: + +* Which release a bug fix is included in +* Discussion regarding the design and merits of features +* Error output to aid in finding similar bugs + +Each ticket should aim to fix one bug or add one feature. + +## Using git + +You can get a quick copy of the repository for this cookbook by +running `git clone +git://github.com/opscode-coobkooks/COOKBOOKNAME.git`. + +For collaboration purposes, it is best if you create a Github account +and fork the repository to your own account. Once you do this you will +be able to push your changes to your Github repository for others to +see and use. + +If you have another repository in your GitHub account named the same +as the cookbook, we suggest you suffix the repository with -cookbook. + +### Branches and Commits + +You should submit your patch as a git branch named after the ticket, +such as COOK-1337. This is called a _topic branch_ and allows users to +associate a branch of code with the ticket. + +It is a best practice to have your commit message have a _summary +line_ that includes the ticket number, followed by an empty line and +then a brief description of the commit. This also helps other +contributors understand the purpose of changes to the code. + + [COOK-1757] - platform_family and style + + * use platform_family for platform checking + * update notifies syntax to "resource_type[resource_name]" instead of + resources() lookup + * COOK-692 - delete config files dropped off by packages in conf.d + * dropped debian 4 support because all other platforms have the same + values, and it is older than "old stable" debian release + +Remember that not all users use Chef in the same way or on the same +operating systems as you, so it is helpful to be clear about your use +case and change so they can understand it even when it doesn't apply +to them. + +### Github and Pull Requests + +All of Opscode's open source cookbook projects are available on +[Github](http://www.github.com/opscode-cookbooks). + +We don't require you to use Github, and we will even take patch diffs +attached to tickets on the tracker. However Github has a lot of +convenient features, such as being able to see a diff of changes +between a pull request and the main repository quickly without +downloading the branch. + +If you do choose to use a pull request, please provide a link to the +pull request from the ticket __and__ a link to the ticket from the +pull request. Because pull requests only have two states, open and +closed, we can't easily filter pull requests that are waiting for a +reply from the author for various reasons. + +### More information + +Additional help with git is available on the +[Working with Git](http://wiki.opscode.com/display/chef/Working+with+Git) +wiki page. + +## Functional and Unit Tests + +This cookbook is set up to run tests under +[Opscode's test-kitchen](https://github.com/opscode/test-kitchen). It +uses minitest-chef to run integration tests after the node has been +converged to verify that the state of the node. + +Test kitchen should run completely without exception using the default +[baseboxes provided by Opscode](https://github.com/opscode/bento). +Because Test Kitchen creates VirtualBox machines and runs through +every configuration in the Kitchenfile, it may take some time for +these tests to complete. + +If your changes are only for a specific recipe, run only its +configuration with Test Kitchen. If you are adding a new recipe, or +other functionality such as a LWRP or definition, please add +appropriate tests and ensure they run with Test Kitchen. + +If any don't pass, investigate them before submitting your patch. + +Any new feature should have unit tests included with the patch with +good code coverage to help protect it from future changes. Similarly, +patches that fix a bug or regression should have a _regression test_. +Simply put, this is a test that would fail without your patch but +passes with it. The goal is to ensure this bug doesn't regress in the +future. Consider a regular expression that doesn't match a certain +pattern that it should, so you provide a patch and a test to ensure +that the part of the code that uses this regular expression works as +expected. Later another contributor may modify this regular expression +in a way that breaks your use cases. The test you wrote will fail, +signalling to them to research your ticket and use case and accounting +for it. + +If you need help writing tests, please ask on the Chef Developer's +mailing list, or the #chef-hacking IRC channel. + +## Code Review + +Opscode regularly reviews code contributions and provides suggestions +for improvement in the code itself or the implementation. + +We find contributions by searching the ticket tracker for _resolved_ +tickets with a status of _fixed_. If we have feedback we will reopen +the ticket and you should resolve it again when you've made the +changes or have a response to our feedback. When we believe the patch +is ready to be merged, we will tag the _Code Reviewed_ field with +_Reviewed_. + +Depending on the project, these tickets are then merged within a week +or two, depending on the current release cycle. + +## Release Cycle + +The versioning for Opscode Cookbook projects is X.Y.Z. + +* X is a major release, which may not be fully compatible with prior + major releases +* Y is a minor release, which adds both new features and bug fixes +* Z is a patch release, which adds just bug fixes + +A released version of a cookbook will end in an even number, e.g. +"1.2.4" or "0.8.0". When development for the next version of the +cookbook begins, the "Z" patch number is incremented to the next odd +number, however the next release of the cookbook may be a major or +minor incrementing version. + +Releases of Opscode's cookbooks are usually announced on the Chef user +mailing list. Releases of several cookbooks may be batched together +and announced on the [Opscode Blog](http://www.opscode.com/blog). + +## Working with the community + +These resources will help you learn more about Chef and connect to +other members of the Chef community: + +* [chef](http://lists.opscode.com/sympa/info/chef) and + [chef-dev](http://lists.opscode.com/sympa/info/chef-dev) mailing + lists +* #chef and #chef-hacking IRC channels on irc.freenode.net +* [Community Cookbook site](http://community.opscode.com) +* [Chef wiki](http://wiki.opscode.com/display/chef) +* Opscode Chef [product page](http://www.opscode.com/chef) + + +## Cookbook Contribution Do's and Don't's + +Please do include tests for your contribution. If you need help, ask +on the +[chef-dev mailing list](http://lists.opscode.com/sympa/info/chef-dev) +or the +[#chef-hacking IRC channel](http://community.opscode.com/chat/chef-hacking). +Not all platforms that a cookbook supports may be supported by Test +Kitchen. Please provide evidence of testing your contribution if it +isn't trivial so we don't have to duplicate effort in testing. Chef +10.14+ "doc" formatted output is sufficient. + +Please do indicate new platform (families) or platform versions in the +commit message, and update the relevant ticket. + +If a contribution adds new platforms or platform versions, indicate +such in the body of the commit message(s), and update the relevant +COOK ticket. When writing commit messages, it is helpful for others if +you indicate the COOK ticket. For example: + + git commit -m '[COOK-1041] - Updated pool resource to correctly + delete.' + +Please do use [foodcritic](http://acrmp.github.com/foodcritic) to +lint-check the cookbook. Except FC007, it should pass all correctness +rules. FC007 is okay as long as the dependent cookbooks are *required* +for the default behavior of the cookbook, such as to support an +uncommon platform, secondary recipe, etc. + +Please do ensure that your changes do not break or modify behavior for +other platforms supported by the cookbook. For example if your changes +are for Debian, make sure that they do not break on CentOS. + +Please do not modify the version number in the metadata.rb, Opscode +will select the appropriate version based on the release cycle +information above. + +Please do not update the CHANGELOG.md for a new version. Not all +changes to a cookbook may be merged and released in the same versions. +Opscode will update the CHANGELOG.md when releasing a new version of +the cookbook. From c794c85f14e9cf8cb0d8548215a62699237e2808 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 30 Sep 2013 21:09:11 -0400 Subject: [PATCH 08/13] Update Copyright in README --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f5b45ff..01ea2b2 100644 --- a/README.md +++ b/README.md @@ -26,14 +26,14 @@ Resources/Providers The LWRPs provided by this cookbook are not meant to be used by themselves; make sure you are familiar with the `application` cookbook before proceeding. -### `java\_webapp` -The `java\_webapp` sub-resource LWRP deals with deploying Java webapps delivered as WAR files which will either be retrieved from a remote URL or fetched by some other method and referenced locally. +### `java_webapp` +The `java_webapp` sub-resource LWRP deals with deploying Java webapps delivered as WAR files which will either be retrieved from a remote URL or fetched by some other method and referenced locally. NOTICE: the `application` cookbook was designed around frameworks running on interpreted languages that are deployed in source code, checked out of an SCM using the `deploy_revision` resource. While this cookbook tries to map those concepts to a binary distribution mechanism, it may not map exactly. #### Attribute Parameters -- database\_master\_role: if a role name is provided, a Chef search will be run to find a node with than role in the same environment as the current role. If a node is found, its IP address will be used when rendering the context file, but see the "Database block parameters" section below -- context\_template: the name of template that will be rendered to create the context file; if specified it will be looked up in the application cookbook. Defaults to "context.xml.erb" from this cookbook +- database_master_role: if a role name is provided, a Chef search will be run to find a node with than role in the same environment as the current role. If a node is found, its IP address will be used when rendering the context file, but see the "Database block parameters" section below +- context_template: the name of template that will be rendered to create the context file; if specified it will be looked up in the application cookbook. Defaults to "context.xml.erb" from this cookbook - database: a block containing additional parameters for configuring the database connection (see below) - war: if provided, will override the default of the basename of the repository @@ -41,14 +41,14 @@ NOTICE: the `application` cookbook was designed around frameworks running on int The database block can accept any method, with the following being expected by the stock context.xml.erb: - driver: a fully-qualified class name of the JDBC driver -- host: hostname or IP address of the database server; if set it will take precedence over the address returned from the search for database\_master\_role +- host: hostname or IP address of the database server; if set it will take precedence over the address returned from the search for database_master_role - port: port to use to connect to the database server - database - username - password -- max\_active: used to set the maxActive context parameter -- max\_idle: used to set the maxIdle context parameter -- max\_wait: used to set the maxWait context parameter +- max_active: used to set the maxActive context parameter +- max_idle: used to set the maxIdle context parameter +- max_wait: used to set the maxWait context parameter You can invoke any other method on the database block, which will result in an entry being created in the `@database` Hash which is passed to the context template. See the examples below for more information. @@ -58,7 +58,7 @@ The `tomcat` sub-resource LWRP configures Tomcat to run the application by creat Attributes ---------- -### scm\_provider +### scm_provider Supports all standard scm providers (git, svn), and in addition: * Chef::Provider::RemoteFile::Deploy allows downloading from a remote url * Chef::Provider::File::Deploy allows using a package on the filesystem @@ -160,7 +160,7 @@ License & Authors - Author:: Seth Chisamore (schisamo@opscode.com) ```text -Copyright 2009-2012, Opscode, Inc. +Copyright 2009-2013, Opscode, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From de617ea9c112477f40aa530d22486f0bdf23ce27 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 30 Sep 2013 21:09:53 -0400 Subject: [PATCH 09/13] Version bump to v3.0.0 --- CHANGELOG.md | 8 ++++++++ metadata.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2d0b7f..1429d91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ application_java Cookbook CHANGELOG This file is used to list changes made in each version of the application_java cookbook. +v3.0.0 +------ +### Breaking +- Drops support for Chef 10 + +### Improvement +- **[COOK-3563](https://tickets.opscode.com/browse/COOK-3563)** - Replace calls to `Chef::Mixin::RecipeDefinitionDSLCore` + v2.0.0 ------ ### Bug diff --git a/metadata.rb b/metadata.rb index dd0772d..84dd659 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license "Apache 2.0" description "Deploys and configures Java-based applications" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "2.0.1" +version "3.0.0" %w{ java tomcat }.each do |cb| depends cb From cbb023366bbd666e9026586da7a6aa200c4fe1ec Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 30 Sep 2013 21:10:12 -0400 Subject: [PATCH 10/13] Version bump to v3.0.1 --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 84dd659..a45ce69 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license "Apache 2.0" description "Deploys and configures Java-based applications" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "3.0.0" +version "3.0.1" %w{ java tomcat }.each do |cb| depends cb From 671b32c65111d899c34fa491746fc5ee6bbf0f04 Mon Sep 17 00:00:00 2001 From: Stephen Lauck Date: Mon, 17 Jun 2013 15:33:20 -0700 Subject: [PATCH 11/13] do not write app.xml if no context file specified --- providers/java_webapp.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/java_webapp.rb b/providers/java_webapp.rb index 4b551f4..e449b37 100644 --- a/providers/java_webapp.rb +++ b/providers/java_webapp.rb @@ -26,7 +26,7 @@ create_hierarchy - create_context_file + create_context_file unless new_resource.context_template.nil? end From bfe2d20739d80fba268496971113bfc1dcb25fb3 Mon Sep 17 00:00:00 2001 From: Stephen Lauck Date: Mon, 17 Jun 2013 15:34:03 -0700 Subject: [PATCH 12/13] move link context to def and only call if resource is present for context --- providers/tomcat.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/providers/tomcat.rb b/providers/tomcat.rb index 5f3b604..00d4c96 100644 --- a/providers/tomcat.rb +++ b/providers/tomcat.rb @@ -43,10 +43,8 @@ not_if "test -L #{node['tomcat']['context_dir']}/ROOT.xml" end - link "#{node['tomcat']['context_dir']}/#{new_resource.application.name}.xml" do - to "#{new_resource.application.path}/shared/#{new_resource.application.name}.xml" - notifies :restart, resources(:service => "tomcat") - end + link_context_file unless new_resource.context_template.nil? + end action :before_migrate do @@ -60,3 +58,12 @@ action :after_restart do end + +protected + +def link_context_file + link "#{node['tomcat']['context_dir']}/#{new_resource.application.name}.xml" do + to "#{new_resource.application.path}/shared/#{new_resource.application.name}.xml" + notifies :restart, resources(:service => "tomcat") + end +end \ No newline at end of file From 9dfc05f361e5877ef30da02c476148bec7b4a7a4 Mon Sep 17 00:00:00 2001 From: Stephen Lauck Date: Mon, 17 Jun 2013 15:34:21 -0700 Subject: [PATCH 13/13] add resource for context file --- resources/tomcat.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/tomcat.rb b/resources/tomcat.rb index ffac998..a5a9b3b 100644 --- a/resources/tomcat.rb +++ b/resources/tomcat.rb @@ -18,3 +18,6 @@ # include ApplicationCookbook::ResourceBase + +attribute :context_template, :kind_of => [TrueClass, FalseClass], :default => true +