Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 041a240

Browse files
committed
Updated README format
1 parent b958e48 commit 041a240

File tree

1 file changed

+106
-112
lines changed

1 file changed

+106
-112
lines changed

README.md

Lines changed: 106 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,172 +1,165 @@
1-
Description
2-
===========
3-
1+
application_java Cookbook
2+
=========================
43
This cookbook is designed to be able to describe and deploy Java web applications. Currently supported:
54

6-
* Java
7-
* Tomcat
5+
- Java
6+
- Tomcat
87

98
Note that this cookbook provides the Java-specific bindings for the `application` cookbook; you will find general documentation in that cookbook.
109

1110
Other application stacks may be supported at a later date.
1211

13-
Requirements
14-
============
1512

13+
Requirements
14+
------------
1615
Chef 0.11.0 or higher required (for Chef environment use).
1716

1817
The following Opscode cookbooks are dependencies:
1918

20-
* application
21-
* java
22-
* tomcat
19+
- application
20+
- java
21+
- tomcat
2322

24-
Resources/Providers
25-
==========
2623

24+
Resources/Providers
25+
-------------------
2726
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.
2827

29-
java\_webapp
30-
-----------
3128

29+
### `java\_webapp`
3230
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.
3331

3432
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.
3533

36-
# Attribute Parameters
37-
38-
* 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
39-
* 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
40-
* database: a block containing additional parameters for configuring the database connection (see below)
41-
* war: if provided, will override the default of the basename of the repository
42-
43-
# Database block parameters
34+
#### Attribute Parameters
35+
- 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
36+
- 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
37+
- database: a block containing additional parameters for configuring the database connection (see below)
38+
- war: if provided, will override the default of the basename of the repository
4439

40+
#### Database block parameters
4541
The database block can accept any method, with the following being expected by the stock context.xml.erb:
4642

47-
* driver: a fully-qualified class name of the JDBC driver
48-
* 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
49-
* port: port to use to connect to the database server
50-
* database
51-
* username
52-
* password
53-
* max\_active: used to set the maxActive context parameter
54-
* max\_idle: used to set the maxIdle context parameter
55-
* max\_wait: used to set the maxWait context parameter
43+
- driver: a fully-qualified class name of the JDBC driver
44+
- 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
45+
- port: port to use to connect to the database server
46+
- database
47+
- username
48+
- password
49+
- max\_active: used to set the maxActive context parameter
50+
- max\_idle: used to set the maxIdle context parameter
51+
- max\_wait: used to set the maxWait context parameter
5652

5753
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.
5854

59-
tomcat
60-
------
61-
55+
#### tomcat
6256
The `tomcat` sub-resource LWRP configures Tomcat to run the application by creating a symbolic link to the context file.
6357

64-
Attributes
65-
==========
66-
67-
scm\_provider
68-
------------
6958

59+
Attributes
60+
----------
61+
### scm\_provider
7062
Supports all standard scm providers (git, svn), and in addition:
7163
* Chef::Provider::RemoteFile::Deploy allows downloading from a remote url
7264
* Chef::Provider::File::Deploy allows using a package on the filesystem
7365

74-
path
75-
----
76-
66+
### path
7767
The target location for the application distribution. This should be outside of the tomcat deployment tree.
7868

79-
repository
80-
----------
81-
69+
### repository
8270
For a git or svn repository, it is the repository URL
8371
When using Chef::Provider::RemoteFile::Deploy, it is the URL of the remote file
8472
When using Chef::Provider::File::Deploy, it is the path to the local file source
8573

86-
revision
87-
--------
88-
74+
### revision
8975
Name of the path within releases, defaults to the checksum of the downloaded file
9076

91-
Usage
92-
=====
9377

78+
Usage
79+
-----
9480
A sample application that needs a database connection:
9581

96-
application "my-app" do
97-
path "/usr/local/my-app"
98-
repository "/nas/distro/my-app.war"
99-
revision "..."
100-
scm_provider Chef::Provider::File::Deploy
101-
102-
java_webapp do
103-
database_master_role "database_master"
104-
database do
105-
driver 'org.gjt.mm.mysql.Driver'
106-
database 'name'
107-
port 5678
108-
username 'user'
109-
password 'password'
110-
max_active 1
111-
max_idle 2
112-
max_wait 3
113-
end
114-
end
115-
116-
tomcat
82+
```ruby
83+
application 'my-app' do
84+
path '/usr/local/my-app'
85+
repository '/nas/distro/my-app.war'
86+
revision '...'
87+
scm_provider Chef::Provider::File::Deploy
88+
89+
java_webapp do
90+
database_master_role 'database_master'
91+
database do
92+
driver 'org.gjt.mm.mysql.Driver'
93+
database 'name'
94+
port 5678
95+
username 'user'
96+
password 'password'
97+
max_active 1
98+
max_idle 2
99+
max_wait 3
117100
end
101+
end
118102

119-
If your application does not need a database connection (or you need a custom
120-
context file for other reasons), you can specify your own template:
103+
tomcat
104+
end
105+
```
121106

122-
application "jenkins" do
123-
path "/usr/local/jenkins"
124-
owner node["tomcat"]["user"]
125-
group node["tomcat"]["group"]
126-
repository "http://mirrors.jenkins-ci.org/war/latest/jenkins.war"
127-
revision "6facd94e958ecf68ffd28be371b5efcb5584c885b5f32a906e477f5f62bdb518-1"
128-
scm_provider Chef::Provider::RemoteFile::Deploy
107+
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:
129108

130-
java_webapp do
131-
context_template "jenkins-context.xml.erb"
132-
end
109+
```ruby
110+
application 'jenkins' do
111+
path '/usr/local/jenkins'
112+
owner node['tomcat']['user']
113+
group node['tomcat']['group']
114+
repository 'http://mirrors.jenkins-ci.org/war/latest/jenkins.war'
115+
revision '6facd94e958ecf68ffd28be371b5efcb5584c885b5f32a906e477f5f62bdb518-1'
116+
scm_provider Chef::Provider::RemoteFile::Deploy
133117

134-
tomcat
135-
end
118+
java_webapp do
119+
context_template 'jenkins-context.xml.erb'
120+
end
121+
122+
tomcat
123+
end
124+
```
136125

137126
You can invoke any method on the database block:
138127

139-
application "my-app" do
140-
path "/usr/local/my-app"
141-
repository "..."
142-
revision "..."
143-
144-
java_webapp do
145-
database_master_role "database_master"
146-
database do
147-
database 'name'
148-
quorum 2
149-
replicas %w[Huey Dewey Louie]
150-
end
151-
end
128+
```ruby
129+
application 'my-app' do
130+
path '/usr/local/my-app'
131+
repository '...'
132+
revision '...'
133+
134+
java_webapp do
135+
database_master_role 'database_master'
136+
database do
137+
database 'name'
138+
quorum 2
139+
replicas %w[Huey Dewey Louie]
152140
end
141+
end
142+
end
143+
```
153144

154145
The corresponding entries will be passed to the context template:
155146

156-
<Context docBase="<%= @war %>" path="/">
157-
<!-- <%= @database['quorum'] %> -->
158-
<!-- <%= @database['replicas'].join(',') %> -->
159-
</Context>
160-
161-
License and Author
162-
==================
163-
164-
Author:: Adam Jacob (<[email protected]>)
165-
Author:: Andrea Campi (<[email protected]>)
166-
Author:: Jesse Campbell (<[email protected]>)
167-
Author:: Joshua Timberman (<[email protected]>)
168-
Author:: Seth Chisamore (<[email protected]>)
169-
147+
```erb
148+
<Context docBase="<%= @war %>" path="/">
149+
<!-- <%= @database['quorum'] %> -->
150+
<!-- <%= @database['replicas'].join(',') %> -->
151+
</Context>
152+
```
153+
154+
License & Authors
155+
-----------------
156+
- Author:: Adam Jacob ([email protected])
157+
- Author:: Andrea Campi ([email protected])
158+
- Author:: Jesse Campbell ([email protected])
159+
- Author:: Joshua Timberman ([email protected])
160+
- Author:: Seth Chisamore ([email protected])
161+
162+
```text
170163
Copyright 2009-2012, Opscode, Inc.
171164
172165
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,
180173
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
181174
See the License for the specific language governing permissions and
182175
limitations under the License.
176+
```

0 commit comments

Comments
 (0)