You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This cookbook is designed to be able to describe and deploy Java web applications. Currently supported:
5
4
6
-
* Java
7
-
* Tomcat
5
+
- Java
6
+
- Tomcat
8
7
9
8
Note that this cookbook provides the Java-specific bindings for the `application` cookbook; you will find general documentation in that cookbook.
10
9
11
10
Other application stacks may be supported at a later date.
12
11
13
-
Requirements
14
-
============
15
12
13
+
Requirements
14
+
------------
16
15
Chef 0.11.0 or higher required (for Chef environment use).
17
16
18
17
The following Opscode cookbooks are dependencies:
19
18
20
-
* application
21
-
* java
22
-
* tomcat
19
+
- application
20
+
- java
21
+
- tomcat
23
22
24
-
Resources/Providers
25
-
==========
26
23
24
+
Resources/Providers
25
+
-------------------
27
26
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.
28
27
29
-
java\_webapp
30
-
-----------
31
28
29
+
### `java\_webapp`
32
30
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.
33
31
34
32
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.
35
33
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
44
39
40
+
#### Database block parameters
45
41
The database block can accept any method, with the following being expected by the stock context.xml.erb:
46
42
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
56
52
57
53
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
54
59
-
tomcat
60
-
------
61
-
55
+
#### tomcat
62
56
The `tomcat` sub-resource LWRP configures Tomcat to run the application by creating a symbolic link to the context file.
63
57
64
-
Attributes
65
-
==========
66
-
67
-
scm\_provider
68
-
------------
69
58
59
+
Attributes
60
+
----------
61
+
### scm\_provider
70
62
Supports all standard scm providers (git, svn), and in addition:
71
63
* Chef::Provider::RemoteFile::Deploy allows downloading from a remote url
72
64
* Chef::Provider::File::Deploy allows using a package on the filesystem
73
65
74
-
path
75
-
----
76
-
66
+
### path
77
67
The target location for the application distribution. This should be outside of the tomcat deployment tree.
78
68
79
-
repository
80
-
----------
81
-
69
+
### repository
82
70
For a git or svn repository, it is the repository URL
83
71
When using Chef::Provider::RemoteFile::Deploy, it is the URL of the remote file
84
72
When using Chef::Provider::File::Deploy, it is the path to the local file source
85
73
86
-
revision
87
-
--------
88
-
74
+
### revision
89
75
Name of the path within releases, defaults to the checksum of the downloaded file
90
76
91
-
Usage
92
-
=====
93
77
78
+
Usage
79
+
-----
94
80
A sample application that needs a database connection:
95
81
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
117
100
end
101
+
end
118
102
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:
0 commit comments