capitomcat 0.0.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile +3 -0
  4. data/LICENSE.md +202 -0
  5. data/README.md +81 -258
  6. data/capitomcat.gemspec +13 -11
  7. data/examples/native/Gemfile +4 -0
  8. data/examples/native/README.md +1 -0
  9. data/examples/native/lib/native/application.rb +80 -0
  10. data/examples/native/lib/native/tasks/tomcat_webapp.cap +26 -0
  11. data/examples/native/lib/native.rb +3 -0
  12. data/examples/native/templates/context.xml.erb +1 -0
  13. data/examples/recipe/customizing/Capfile +26 -0
  14. data/examples/recipe/customizing/README.md +1 -0
  15. data/examples/recipe/customizing/config/deploy/dev.rb +39 -0
  16. data/examples/recipe/customizing/config/deploy/production.rb +39 -0
  17. data/examples/recipe/customizing/config/deploy/staging.rb +39 -0
  18. data/examples/recipe/customizing/config/deploy.rb +40 -0
  19. data/examples/recipe/customizing/lib/capistrano/tasks/tomcat_webapp.cap +49 -0
  20. data/examples/recipe/customizing/templates/context.xml.erb +1 -0
  21. data/examples/recipe/multistage/Capfile +26 -0
  22. data/examples/recipe/multistage/README.md +1 -0
  23. data/examples/recipe/multistage/config/deploy/dev.rb +39 -0
  24. data/examples/recipe/multistage/config/deploy/production.rb +39 -0
  25. data/examples/recipe/multistage/config/deploy/staging.rb +39 -0
  26. data/examples/recipe/multistage/config/deploy.rb +40 -0
  27. data/examples/recipe/multistage/lib/capistrano/tasks/tomcat_webapp.cap +23 -0
  28. data/examples/recipe/multistage/templates/context.xml.erb +1 -0
  29. data/examples/recipe/singlestage/Capfile +26 -0
  30. data/examples/recipe/singlestage/README.md +1 -0
  31. data/examples/recipe/singlestage/lib/capistrano/tasks/tomcat_webapp.cap +29 -0
  32. data/examples/recipe/singlestage/templates/context.xml.erb +1 -0
  33. data/lib/capitomcat/deploy.rb +1 -0
  34. data/lib/capitomcat/tasks/deploy.cap +226 -0
  35. data/lib/capitomcat/version.rb +3 -0
  36. data/lib/capitomcat.rb +3 -104
  37. data/template/context.xml.erb +1 -0
  38. metadata +62 -31
  39. data/Rakefile +0 -5
  40. data/examples/README.md +0 -1
  41. data/examples/multistage/Capfile +0 -25
  42. data/examples/multistage/README.md +0 -1
  43. data/examples/multistage/config/deploy/dev.rb +0 -4
  44. data/examples/multistage/config/deploy/prod.rb +0 -4
  45. data/examples/multistage/config/deploy/stg.rb +0 -4
  46. data/examples/multistage/config/deploy.rb +0 -16
  47. data/examples/multistage/template/context.xml.erb +0 -1
  48. data/examples/singlestage/Capfile +0 -24
  49. data/examples/singlestage/config/deploy.rb +0 -16
  50. data/examples/singlestage/template/context.xml.erb +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 460283b08a3d25fe8c961e9916697ab59642bf16
4
- data.tar.gz: 00f4e1a87866891dac1dae87a6598adc738d958f
3
+ metadata.gz: 71e850702b1a69ff16b95de895257ce85269f6cb
4
+ data.tar.gz: 6b3d1d7bcb74b28c972f5b10822c7f57b4bc0818
5
5
  SHA512:
6
- metadata.gz: cdafda575dcf154b73f551c165e631768d67207d3873fb8693aee9ceabe25d0aef2a77e0da1467a8f532236dbf1a28b8e488f291f58fcc2a4a92564c44798c01
7
- data.tar.gz: f524e15d3483dcbf0e99745d9484e9819939873aa9e9acee4a0df97107596e9d5ad6e8abd0b368dba7e091dfded7496757b3bd8a042f67beb0b31b72b25686c1
6
+ metadata.gz: ddcc76f7281c0fdcf7fa8c5a1ad9b1db21a211470199e7d0c69b352aca63141fd69e41d15e6115ee16d94c2221a85ee3246e7c33dd5e5216f5356e670c267c04
7
+ data.tar.gz: f0f1ac92e088ee63758ae209cb2807d94748fdc5320db8406826031ce3b7828e199a061193838b1141e25849722aa022775d284931c1616e84517e12bcd8a31e
data/.gitignore CHANGED
@@ -29,6 +29,7 @@ spec/reports
29
29
  test/tmp
30
30
  test/version_tmp
31
31
  tmp
32
+ Gemfile.lock
32
33
 
33
34
  # YARD artifacts
34
35
  .yardoc
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2014 Sunggun Yu
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/README.md CHANGED
@@ -1,7 +1,39 @@
1
- Capistrano Recipe for Tomcat
2
- ========================
3
-
4
- https://rubygems.org/gems/capitomcat
1
+ # Capitomcat
2
+ [![Gem Version](https://badge.fury.io/rb/capitomcat.png)](http://badge.fury.io/rb/capitomcat)
3
+
4
+ Capitomcat is library for creating Capistrano Tomcat recipe.
5
+ Capitomcat includes basic tasks for Tomcat deployment. You can create easily your own Capistrano 3 recipe for Tomcat with Capitomcat.
6
+
7
+ ##Requirement
8
+ ###Gem Dependency
9
+ * Ruby >= 1.9
10
+ * Capistrano >= 3.0.1
11
+
12
+ ### Authentication & Authorisation setting for Remote Servers
13
+ By the recommendation of Capistrano 3, Capitomcat use SSH Key and NOPASSWD instead of asking password.
14
+
15
+ for more details, please refer to [Authentication & Authorisation][1] page on Capistrano website.
16
+ [1]: http://capistranorb.com/documentation/getting-started/authentication-and-authorisation/
17
+ ####User account setting
18
+ ```` sh
19
+ root@remote $ adduser <your_deploy_user_name>
20
+ root@remote $ passwd -l <your_deploy_user_name>
21
+ ````
22
+ or
23
+ ```` sh
24
+ root@remote $ adduser --home /home/deploy --disabled-password deploy
25
+ ````
26
+
27
+ ####SSH Key setting
28
+ Add your SSH key into `authorized_keys` file of `deploy` user on your remote server.
29
+
30
+ ####NOPASSWD Setting for SUDO
31
+ Folowing NOPASSWD setting is required. please add following setting into your `/etc/sudoers` file.
32
+ ```` sh
33
+ %your_deploy_user_name ALL=NOPASSWD:/etc/init.d/tomcat7 <Your tomcat command>
34
+ %your_deploy_user_name ALL=NOPASSWD: /bin/chown
35
+ %your_deploy_user_name ALL=(<your_tomcat_user> : <your_tomcat_user_group>) NOPASSWD: ALL
36
+ ````
5
37
 
6
38
  ##Installation
7
39
  To use Capitomcat in your Capistrano script, you need install as RubyGem
@@ -11,275 +43,66 @@ Please refer to [Download Ruby](http://www.ruby-lang.org/en/downloads/) page on
11
43
  ###Install RubyGems
12
44
  Please refer to [Download RubyGems](http://rubygems.org/pages/download) page on the RubyGems official website.
13
45
  ###Install Capistrano
14
- <pre>
15
- $ gem install capistrano
16
- $ gem install capistrano-ext
17
- </pre>
46
+ Capitomcat v1.0.0 supports Capistrano 3. (Capitomcat v0.0.x supports Capistrano 2)
47
+ ``` sh
48
+ $ gem install capistrano -v 3.0.1
49
+ ```
18
50
  ###Install Capitomcat
19
- ####Install from RubyGems
20
- <pre>
21
- $ gem install capitomcat
22
- </pre>
23
-
24
- ####Install manually
25
- * Check-out the source code
26
- <pre>
27
- $ git clone git@github.com:sunggun-yu/capitomcat.git
28
- </pre>
29
- * Build gem
30
- <pre>
31
- $ cd capitomcat
32
- $ gem build capitomcat.gemspec
33
- </pre>
34
- * Install gem
35
- <pre>
51
+ ``` sh
36
52
  $ gem install capitomcat
37
- </pre>
53
+ ```
38
54
 
39
55
  ##Configuration
40
- You have to add the following options in your `Capfile` or `deploy.rb`
56
+ ### Role Configuration
41
57
  <pre>
42
- role :app
43
- set :user
44
- set :password
45
- set :tomcat_user
46
- set :tomcat_cmd_user
47
- set :tomcat_port
48
- set :local_war_file
49
- set :context_template_file
50
- set :context_name`
51
- set :remote_docBase
52
- set :remote_context_file
53
- set :remote_tomcat_cmd
54
- set :remote_tomcat_work_dir
55
- set :stages
58
+ role :app, %w{deploy@dev01 deploy@dev02}
56
59
  </pre>
57
- * `:app` - The application servers that you want to deploy
58
- * `:user` - User name which is going to run Capistrano script.
59
- * `:password` - Password of `:user`.
60
- * `:tomcat_user` - The owner of Tomcat home directory.
61
- * `:tomcat_cmd_user` - The user that runs tomcat scripts : ex) /etc/init.d/tomcat
62
- * `:tomcat_port` - Port number of Tomcat server. this value is needed to check whether Tomcat process is running.
63
- * `:local_war_file` - The WAR file which will upload to remote tomcat server.
64
- * `:context_template_file` - Path for the template file in your local, which is application's Tomcat context. also, following ERB variable are should be included in the template file.
65
- * context.xml.erb
60
+ ### Required configuration for Capitomcat
66
61
  <pre>
67
- &lt;Context path="/<%= context_name %>" docBase="<%= remote_docBase %>" /&gt;
62
+ set :use_sudo, true
63
+
64
+ # Remote Tomcat server setting section
65
+ set :tomcat_user, 'tomcat7'
66
+ set :tomcat_user_group, 'tomcat7'
67
+ set :tomcat_port, '8080'
68
+ set :tomcat_cmd, '/etc/init.d/tomcat7'
69
+ set :use_tomcat_user_cmd, false
70
+ set :tomcat_war_file, '/var/app/war/test-web.war'
71
+ set :tomcat_context_path, '/test-web'
72
+ set :tomcat_context_file, '/var/lib/tomcat7/conf/Catalina/localhost/test-web.xml'
73
+ set :tomcat_work_dir, '/var/lib/tomcat7/work/Catalina/localhost/test-web'
74
+
75
+ # Deploy setting section
76
+ set :local_war_file, '/tmp/test-web.war'
77
+ set :context_template_file, File.expand_path('../templates/context.xml.erb', __FILE__).to_s
78
+ set :use_context_update, false
79
+ set :use_parallel, false
80
+ set :use_context_update, false
68
81
  </pre>
69
- * `<%= context_name %>` - This variable is for the ***path*** attribute in the context file. It will be replaced to `:context_name`
70
- * `<%= remote_docBase %>` - This variable is for the ***docBase*** attribute in the context file.It will be replaced to `:remote_docBase`
71
- - `:context_name` - Root context name of application.
72
- - `:remote_docBase` - The pathname to the web application archive file (if this web application is being executed directly from the WAR file)
73
- - `:remote_context_file` - Application's context file path for Tomcat on your remote servers. basically, context file is located in `/your/tomcat/home/conf/Catalina/localhost/appname.xml`
74
- - `:remote_tomcat_cmd` - Tomcat's star, stop command. for example, `/etc/init.d/tomcat` or `/your/tomcat/home/bin/catalina.sh` can be used. please make sure not to include `start` or `stop` parameter.
75
- - `:remote_tomcat_work_dir` - Tomcat work directory for application. this directory will be used at `capitomcat:cleanWorkDir` task
76
82
 
77
- ### Multistage setting
78
- If you want to use Multistage deployment, You should add following option in your `Capfile` or `deploy.rb`
79
- also, please refer to [Multistage Extension](https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension).
80
- - `:stages` -
83
+ ###Task
84
+ You can get task name of Capitomcat by run `cap -T`
81
85
  <pre>
82
- # Application Stage Section
83
- set :stages, %w(dev stg prod)
86
+ cap capitomcat:deploy # Capitomcat Recipe for Tomcat web application deployment
84
87
  </pre>
85
88
 
86
- ### Examples
87
- #### Single Stage
88
- /your/capistrano/project/***Capfile***
89
- ```
90
- require 'capitomcat'
91
-
92
- # Application host section
93
- role :app, "dev01", "dev02"
94
-
95
- # User section
96
- set :user, "stg"
97
- set :password, "password"
98
- set :tomcat_user, "tomcat"
99
- set :tomcat_cmd_user, "root"
100
-
101
- # Local file section
102
- set :local_war_file, "/tmp/app.war"
103
- set :context_template_file, "./template/context.xml.erb"
104
-
105
- # Remote setting section
106
- set :context_name, "app"
107
- set :remote_docBase, "/tmp/test/earl/war/abc.war"
108
- set :remote_context_file, "/tmp/test/tomcat/conf/Catalina/localhost/app.xml"
109
- set :remote_tomcat_cmd, "/tmp/test/etc/init.d/tomcat7"
110
- set :remote_tomcat_work_dir, "/opt/tomcat/work/Catalina/localhost/app"
111
- ```
112
-
113
- #### Multi Stage
114
- Project structure.
115
- ```
116
- / your/capistrano/project/
117
- |-- config
118
- | |-- deploy
119
- | | |-- dev.rb
120
- | | |-- stg.rb
121
- | | `-- prod.rb
122
- | `-- deploy.rb
123
- `-- Capfile
124
- ```
125
- Also, the file name under config/deploy are should be matched in `set :stages`
126
-
127
- * /your/capistrano/project/***Capfile***
128
-
129
- ```
130
- require 'capitomcat'
131
- require 'capistrano/ext/multistage'
132
-
133
- # Application Stage Section
134
- set :stages, %w(dev stg prod)
135
-
136
- # User section
137
- set :user, "stg"
138
- set :password, "password"
139
- set :tomcat_user, "tomcat"
140
- set :tomcat_cmd_user, "root"
141
-
142
- # Local file section
143
- set :local_war_file, "/tmp/app.war"
144
- set :context_template_file, "./template/context.xml.erb"
145
-
146
- # Remote setting section
147
- set :context_name, "app"
148
- set :remote_docBase, "/tmp/test/earl/war/abc.war"
149
- set :remote_context_file, "/tmp/test/tomcat/conf/Catalina/localhost/app.xml"
150
- set :remote_tomcat_cmd, "/tmp/test/etc/init.d/tomcat7"
151
- set :remote_tomcat_work_dir, "/opt/tomcat/work/Catalina/localhost/app"
152
- ```
153
-
154
- * /your/capistrano/project/***config/deploy/dev.rb***
155
-
156
- ```
157
- # Application host section for DEV
158
- role :app, "dev-host-1", "dev-host-2"
159
- ```
89
+ ###***Documentation is still working on...***
160
90
 
161
- * /your/capistrano/project/***config/deploy/stg.rb***
91
+ &hearts;For more details, please refer to example recipes.&hearts;
162
92
 
163
- ```
164
- # Application host section for stg
165
- role :app, "stg-host-1", "stg-host-2"
166
- ```
167
-
168
- * /your/capistrano/project/***config/deploy/prod.rb***
169
-
170
- ```
171
- # Application host section for Production
172
- role :app, "prod-host-1", "prod-host-2"
173
- ```
174
-
175
- ##Available Tasks
176
- To get a list of all capistrano tasks, run `cap -T` with user password:
93
+ ## License
177
94
  <pre>
178
- cap capitomcat:cleanWorkDir # Cleaning-up Tomcat work directory
179
- cap capitomcat:start # Start capitomcat.
180
- cap capitomcat:stop # Stop capitomcat.
181
- cap capitomcat:updateContext # Update and upload context file
182
- cap capitomcat:uploadWar # Upload WAR file
183
- </pre>
184
-
185
- ### capitomcat:cleanWorkDir
186
- This Task will remove Application's Tomcat work directory. Please make sure you should start/restart Tomcat after this task has executed.
187
- ### capitomcat:start
188
- This Task will start your Tomcat server using `:remote_tomcat_cmd` command.
189
- If you have `set :remote_tomcat_cmd, '/etc/init.d/tomcat7'` and `set :tomcat_cmd_user, 'root'` in your Capfile or deploy.rb file then the Task will execute `sudo -p <:password> -u root /etc/init.d/tomcat7 start` commnad on your remote servers which are setted in `role :app`.
190
- ### capitomcat:stop
191
- This Task will stop your Tomcat server using `:remote_tomcat_cmd` command.
192
- If you have `set :remote_tomcat_cmd, '/user/local/tomcat7/bin/catalina.sh'` and `set :tomcat_cmd_user, 'tomcat'` in your Capfile or deploy.rb file then the Task will execute `sudo -p <:password> -u tomcat /user/local/tomcat7/bin/catalina.sh stop` commnad on your remote servers which are setted in `role :app`.
193
- ### capitomcat:updateContext
194
- This Task will generate context file from your context template file. and Upload the generated context file to `:remote_context_file`
195
- ### capitomcat:uploadWar
196
- This Task will upload the `:local_war_file` to `:remote_docBase`
197
-
198
- ##Usage
199
- To use capitomcat gem, You need to create your own Capistrano script.
200
- You can create Capistrano project structure and default files from scratch to run `capify .`
201
- ```
202
- $ mkdir -p /your/capistrano/project
203
- $ cd /your/capistrano/project
204
- $ capify .
205
- $ tree
206
-
207
- / your/capistrano/project/
208
- |-- config
209
- | `-- deploy.rb
210
- `-- Capfile
211
- ```
212
- add settings into your Capfile or deploy.rb file. and you can execute capitomcat recipe like this.
213
- ```
214
- $ cap capitomcat:stop
215
- ```
216
-
217
- Also, you can combine tasks as a one task by creating new task inside the your Capfile or deploy.rb file.
218
- ```
219
- require 'capitomcat'
220
-
221
- desc "Release Task for myjob"
222
- namespace :myapp do
223
- task :release, :roles => :app do
224
- capitomcat.stop
225
- capitomcat.uploadWar
226
- capitomcat.updateContext
227
- capitomcat.cleanWorkDir
228
- capitomcat.start
229
- end
230
- end
231
- ```
95
+ Copyright 2014 Sunggun Yu
232
96
 
233
- ### Execute tasks serially
234
- Capistrano performs the task parallel, So in the above case, if you have multiple server each task will be performed for each servers.
235
- ```
236
- # host1, host2
97
+ Licensed under the Apache License, Version 2.0 (the "License");
98
+ you may not use this file except in compliance with the License.
99
+ You may obtain a copy of the License at
237
100
 
238
- stop ==> host1
239
- stop ==> host2
240
-
241
- uploadWar ==> host1
242
- uploadWar ==> host2
243
-
244
- ...
245
- ```
246
-
247
- if you do perform release like below, use serial_task function.
248
- ```
249
- # host1, host2
250
-
251
- stop ==> host1
252
- uploadWar ==> host1
253
- updateContext ==> host1
254
- start ==> host1
255
-
256
- stop ==> host2
257
- uploadWar ==> host2
258
- updateContext ==> host2
259
- start ==> host2
260
- ```
261
-
262
- ```
263
- require 'capitomcat'
264
-
265
- desc "Release Task for myjob"
266
- namespace :myapp do
267
- task :release, :roles => :app do
268
- serial_task do
269
- capitomcat.stop
270
- capitomcat.uploadWar
271
- capitomcat.updateContext
272
- capitomcat.cleanWorkDir
273
- capitomcat.start
274
- end
275
- end
276
- end
277
- ```
278
-
279
- ### Perform multistage task
280
- If you have multistage setting, you can perform the task as like below.
281
- ```
282
- cap prod myapp:release
283
- ```
101
+ http://www.apache.org/licenses/LICENSE-2.0
284
102
 
285
- &hearts;For more details, please refer to example projects.&hearts;
103
+ Unless required by applicable law or agreed to in writing, software
104
+ distributed under the License is distributed on an "AS IS" BASIS,
105
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
106
+ See the License for the specific language governing permissions and
107
+ limitations under the License.
108
+ </pre>
data/capitomcat.gemspec CHANGED
@@ -2,23 +2,25 @@
2
2
 
3
3
  # Author:: Sunggun Yu
4
4
 
5
- $:.push File.expand_path("lib", __FILE__)
5
+ $:.push File.expand_path('lib', __FILE__)
6
+
7
+ require_relative 'lib/capitomcat/version'
6
8
 
7
9
  Gem::Specification.new do |s|
8
- s.name = "capitomcat"
9
- s.version = "0.0.3"
10
+ s.name = 'capitomcat'
11
+ s.version = Capitomcat::VERSION
10
12
 
11
- s.authors = ["Sunggun Yu"]
12
- s.email = ["sunggun.dev@gmail.com"]
13
+ s.authors = ['Sunggun Yu']
14
+ s.email = ['sunggun.dev@gmail.com']
13
15
  s.licenses = ['Apache 2.0']
14
- s.date = %q{2013-12-27}
15
- s.homepage = "http://sunggun-yu.github.io/capitomcat/"
16
- s.summary = %q{Capistrano Recipe for Tomcat}
17
- s.description = %q{You can deploy your war file to multiple remote tomcat servers through this Capistrano recipe.}
16
+ s.date = %q{2014-01-11}
17
+ s.homepage = 'http://sunggun-yu.github.io/capitomcat/'
18
+ s.summary = %q{Capistrano 3 recipe for Tomcat web application deployment}
19
+ s.description = %q{Capitomcat is the Capistrano 3 recipe for Tomcat web application deployment.}
18
20
 
19
21
  s.files = `git ls-files`.split("\n")
20
22
  s.require_paths = ["lib"]
21
23
 
22
- s.add_dependency('capistrano')
23
- s.add_development_dependency('rake')
24
+ s.add_dependency 'capistrano', '~> 3.0', '>= 3.0.1'
25
+ s.add_dependency 'capistrano-bundler', '~> 1.1', '>= 1.1.1'
24
26
  end
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "capistrano", "~> 3.0.1"
4
+ gem "capitomcat", "~> 1.0.0"
@@ -0,0 +1 @@
1
+ # Example for Using Capistrano and Capitomcat from pure Ruby