capitomcat 1.1.4 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48868d432a96f6956fc798aecdf5becabcb713a9
4
- data.tar.gz: 0d29561ce9b5d05dd6306041b1fc679d73fd64f3
3
+ metadata.gz: f0220d095d62be811014fc54b4e5bf3f45fac497
4
+ data.tar.gz: cd764ebcb60a77d2a917f54beea77ab7a15afa85
5
5
  SHA512:
6
- metadata.gz: 73550bdad1d01ffb5ab5dfcc609c2c48501d0dfab7c4262fdc6d7d9cd0e6d389d08e66d62111b526cb2327ce6aa6c944056e845ad2b68b405311a6cea0cf0bda
7
- data.tar.gz: b73cfa67cecca1c23b115ef32246c484785cc47906c41cfe3f493ceca2f3e2ae29e40bbfb0d12b9a03ce029902900a2c5a9bdfe32437979df6ed655a770990fb
6
+ metadata.gz: aba56c9c433c72ee18c7020285a6279718738a948f3b30fb06b92828f90c7a225943448bda49eec17fd7806d93f84e5c1e24b483daf3155c3885e0971a3dd551
7
+ data.tar.gz: 65a10a6918355ffe0d443acd061a18f89c4f386d135907b4e5b6b32ee373a988fee8b794fd1f9f0e4ead7549eea58cf89780c1a97a8a93a7057f78fa79ba92c8
data/CHANGES.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # Changes
2
+ [1.2.0]: https://github.com/sunggun-yu/capitomcat/releases/tag/v1.2.0
3
+ [1.1.4]: https://github.com/sunggun-yu/capitomcat/releases/tag/v1.1.4
2
4
  [1.1.3]: https://github.com/sunggun-yu/capitomcat/releases/tag/v1.1.3
3
5
  [1.1.2]: https://github.com/sunggun-yu/capitomcat/releases/tag/v1.1.2
4
6
  [1.1.1]: https://github.com/sunggun-yu/capitomcat/releases/tag/v1.1.1
@@ -7,6 +9,18 @@
7
9
  [1.0.0]: https://github.com/sunggun-yu/capitomcat/releases/tag/v1.0.0
8
10
  [0.0.3]: https://github.com/sunggun-yu/capitomcat/releases/tag/v0.0.3
9
11
 
12
+ ## [v1.2.0][1.2.0]
13
+ * Updating Capistrano dependency version.
14
+ * Removing background executing of tomcat command. also, sleep time has removed accordingly.
15
+ * PTY option is not properly applied.
16
+ * In actually, executing tomcat command in background is not effective. It is all about Tomcat starting command. In most of case, Tomcat init.d command use `/bin/su -p -s /bin/bash -l $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh`. however, In some OS, such like CentOS/Oracle 5.9 and 6.5, tomcat command process were killed right after the ssh session has closed. To prevent this issue, init.d script should be modified like, `su $TOMCAT_USER -c $TOMCAT_HOME/bin/startup.sh`
17
+ * Adding attribute for Tomcat command waiting timeout. Changing netstat checking logic.
18
+
19
+ ## [v1.1.4][1.1.4]
20
+ * Adding "cleanup unpacked WAR directory" function before tomcat starting.
21
+ * Unpacked WAR directory is not refreshed. eventually, Tomcat doesn't provide latest changes in new WAR file by this issue.
22
+ * Thanks to @jwcarman
23
+
10
24
  ## [v1.1.3][1.1.3]
11
25
  * Bug Fix : There was space between "-" and "u" at Tomcat work directory cleaning task.
12
26
 
data/capitomcat.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.authors = ['Sunggun Yu']
14
14
  s.email = ['sunggun.dev@gmail.com']
15
15
  s.licenses = ['Apache 2.0']
16
- s.date = %q{2014-03-19}
16
+ s.date = %q{2015-01-25}
17
17
  s.homepage = 'http://sunggun-yu.github.io/capitomcat/'
18
18
  s.summary = %q{Capistrano 3 recipe for Tomcat web application deployment}
19
19
  s.description = %q{Capitomcat is the Capistrano 3 recipe for Tomcat web application deployment.}
@@ -21,5 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.files = `git ls-files`.split("\n")
22
22
  s.require_paths = ["lib"]
23
23
 
24
- s.add_dependency 'capistrano', '>= 3.1.0'
24
+ s.add_dependency 'capistrano', '~> 3.3', '>= 3.3.5'
25
25
  end
@@ -23,6 +23,8 @@ namespace :capitomcat do
23
23
  set :tomcat_context_path, '/test-web'
24
24
  set :tomcat_context_file, '/var/lib/tomcat7/conf/Catalina/localhost/test-web.xml'
25
25
  set :tomcat_work_dir, '/var/lib/tomcat7/work/Catalina/localhost/test-web'
26
+ set :tomcat_cmd_wait_start, 10 # Second
27
+ set :tomcat_cmd_wait_stop, 5 # Second
26
28
 
27
29
  # Deploy setting section
28
30
  set :local_war_file, '/tmp/test-web.war'
@@ -76,45 +78,60 @@ namespace :capitomcat do
76
78
  # Start Tomcat server
77
79
  def start_tomcat
78
80
  # local variables
79
- execute_tomcat_cmd('start', 1)
81
+ execute_tomcat_cmd('start')
80
82
  end
81
83
 
82
84
  # Check status whether Tomcat started
83
85
  def check_tomcat_started
84
86
  # local variables
85
- tomcat_port = fetch(:tomcat_port)
87
+ tomcat_cmd_wait_start = if fetch(:tomcat_cmd_wait_start).to_s.length > 0
88
+ fetch(:tomcat_cmd_wait_start).to_i
89
+ else
90
+ 30 # Default is 30 sec
91
+ end
86
92
  _times = 0
87
- begin
88
- _times = _times + 1
89
- info("Check and wait until Tomcat starting up ... #{_times}")
90
- _netstat = capture("netstat -an | grep \"#{tomcat_port}\" | grep \"LISTEN\" ; echo \"\"")
91
- info (_netstat)
93
+ until check_netstat_tomcat_port do
94
+ if _times >= tomcat_cmd_wait_start
95
+ raise 'Tomcat is not started.'
96
+ end
97
+ _times += 1
98
+ info("Check and wait until starting Tomcat ... #{_times}")
92
99
  sleep(1)
93
- end until _times > 180 || (_netstat != nil && _netstat.to_s.length > 1)
94
- if _times > 180
95
- raise 'Starting Tomcat has failed - timed out'
96
100
  end
97
101
  end
98
102
 
99
103
  # Check status whether Tomcat stopped
100
104
  def check_tomcat_stopped
101
105
  # local variables
102
- tomcat_port = fetch(:tomcat_port)
106
+ tomcat_cmd_wait_stop = if fetch(:tomcat_cmd_wait_stop).to_s.length > 0
107
+ fetch(:tomcat_cmd_wait_stop).to_i
108
+ else
109
+ 5 # Default is 5 sec
110
+ end
103
111
  _times = 0
104
- begin
105
- _times = _times + 1
112
+ until !check_netstat_tomcat_port do
113
+ if _times >= tomcat_cmd_wait_stop
114
+ raise 'Tomcat is not stopped.'
115
+ end
116
+ _times += 1
106
117
  info("Check and wait until Tomcat stopping ... #{_times}")
107
- _netstat = capture("netstat -an | grep \"#{tomcat_port}\" | grep \"LISTEN\" ; echo \"\"")
108
118
  sleep(1)
109
- end until _times > 180 || _netstat == nil || _netstat.to_s.length == 0
110
- if _times > 180
111
- raise 'Stopping Tomcat has failed - timed out'
119
+ end
120
+ end
121
+
122
+ # Do netstat -an | grep ${tomcat_port} | grep "LISTEN" to check whether tomcat port is up or not. return when it is up.
123
+ def check_netstat_tomcat_port
124
+ tomcat_port = fetch(:tomcat_port)
125
+ _netstat = capture("netstat -an | grep \"#{tomcat_port}\" | grep \"LISTEN\" ; echo \"\"")
126
+ info (_netstat)
127
+ if _netstat.to_s.length > 1
128
+ return true
112
129
  end
113
130
  end
114
131
 
115
132
  # Stop Tomcat server
116
133
  def stop_tomcat
117
- execute_tomcat_cmd('stop', 1)
134
+ execute_tomcat_cmd('stop')
118
135
  end
119
136
 
120
137
  # Upload the WAR file
@@ -268,10 +285,10 @@ namespace :capitomcat do
268
285
 
269
286
  # Execute the Tomcat command
270
287
  # it executes the Tomcat command in background. and sleeps for several sec after executing.
271
- def execute_tomcat_cmd(arg, sleep)
288
+ def execute_tomcat_cmd(arg)
272
289
  # local variables
273
290
  tomcat_cmd = fetch(:tomcat_cmd)
274
- execute("echo `nohup sudo #{get_sudo_user_tomcat_cmd} #{tomcat_cmd} #{arg}& > /dev/null 2>&1` && sleep #{sleep}")
291
+ execute :sudo, get_sudo_user_tomcat_cmd, tomcat_cmd, arg
275
292
  end
276
293
 
277
294
  # Test if dir is existing
@@ -1,3 +1,3 @@
1
1
  module Capitomcat
2
- VERSION = '1.1.4'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capitomcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunggun Yu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-19 00:00:00.000000000 Z
11
+ date: 2015-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.3'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
- version: 3.1.0
22
+ version: 3.3.5
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.3'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
- version: 3.1.0
32
+ version: 3.3.5
27
33
  description: Capitomcat is the Capistrano 3 recipe for Tomcat web application deployment.
28
34
  email:
29
35
  - sunggun.dev@gmail.com
@@ -88,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
94
  version: '0'
89
95
  requirements: []
90
96
  rubyforge_project:
91
- rubygems_version: 2.3.0
97
+ rubygems_version: 2.4.3
92
98
  signing_key:
93
99
  specification_version: 4
94
100
  summary: Capistrano 3 recipe for Tomcat web application deployment