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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +3 -0
- data/LICENSE.md +202 -0
- data/README.md +81 -258
- data/capitomcat.gemspec +13 -11
- data/examples/native/Gemfile +4 -0
- data/examples/native/README.md +1 -0
- data/examples/native/lib/native/application.rb +80 -0
- data/examples/native/lib/native/tasks/tomcat_webapp.cap +26 -0
- data/examples/native/lib/native.rb +3 -0
- data/examples/native/templates/context.xml.erb +1 -0
- data/examples/recipe/customizing/Capfile +26 -0
- data/examples/recipe/customizing/README.md +1 -0
- data/examples/recipe/customizing/config/deploy/dev.rb +39 -0
- data/examples/recipe/customizing/config/deploy/production.rb +39 -0
- data/examples/recipe/customizing/config/deploy/staging.rb +39 -0
- data/examples/recipe/customizing/config/deploy.rb +40 -0
- data/examples/recipe/customizing/lib/capistrano/tasks/tomcat_webapp.cap +49 -0
- data/examples/recipe/customizing/templates/context.xml.erb +1 -0
- data/examples/recipe/multistage/Capfile +26 -0
- data/examples/recipe/multistage/README.md +1 -0
- data/examples/recipe/multistage/config/deploy/dev.rb +39 -0
- data/examples/recipe/multistage/config/deploy/production.rb +39 -0
- data/examples/recipe/multistage/config/deploy/staging.rb +39 -0
- data/examples/recipe/multistage/config/deploy.rb +40 -0
- data/examples/recipe/multistage/lib/capistrano/tasks/tomcat_webapp.cap +23 -0
- data/examples/recipe/multistage/templates/context.xml.erb +1 -0
- data/examples/recipe/singlestage/Capfile +26 -0
- data/examples/recipe/singlestage/README.md +1 -0
- data/examples/recipe/singlestage/lib/capistrano/tasks/tomcat_webapp.cap +29 -0
- data/examples/recipe/singlestage/templates/context.xml.erb +1 -0
- data/lib/capitomcat/deploy.rb +1 -0
- data/lib/capitomcat/tasks/deploy.cap +226 -0
- data/lib/capitomcat/version.rb +3 -0
- data/lib/capitomcat.rb +3 -104
- data/template/context.xml.erb +1 -0
- metadata +62 -31
- data/Rakefile +0 -5
- data/examples/README.md +0 -1
- data/examples/multistage/Capfile +0 -25
- data/examples/multistage/README.md +0 -1
- data/examples/multistage/config/deploy/dev.rb +0 -4
- data/examples/multistage/config/deploy/prod.rb +0 -4
- data/examples/multistage/config/deploy/stg.rb +0 -4
- data/examples/multistage/config/deploy.rb +0 -16
- data/examples/multistage/template/context.xml.erb +0 -1
- data/examples/singlestage/Capfile +0 -24
- data/examples/singlestage/config/deploy.rb +0 -16
- data/examples/singlestage/template/context.xml.erb +0 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
require 'capistrano'
|
|
2
|
+
|
|
3
|
+
# Author:: Sunggun Yu
|
|
4
|
+
|
|
5
|
+
# Capistrano 3 Recipe for Tomcat web application deployment.'
|
|
6
|
+
namespace :capitomcat do
|
|
7
|
+
desc <<-DESC
|
|
8
|
+
Capitomcat Recipe for Tomcat web application deployment.
|
|
9
|
+
|
|
10
|
+
Required Configurations
|
|
11
|
+
|
|
12
|
+
set :use_sudo, true
|
|
13
|
+
role :app, %w{deploy@dev01 deploy@dev02}
|
|
14
|
+
|
|
15
|
+
# Remote Tomcat server setting section
|
|
16
|
+
set :tomcat_user, 'tomcat7'
|
|
17
|
+
set :tomcat_user_group, 'tomcat7'
|
|
18
|
+
set :tomcat_port, '8080'
|
|
19
|
+
set :tomcat_cmd, '/etc/init.d/tomcat7'
|
|
20
|
+
set :use_tomcat_user_cmd, false
|
|
21
|
+
set :tomcat_war_file, '/var/app/war/test-web.war'
|
|
22
|
+
set :tomcat_context_path, '/test-web'
|
|
23
|
+
set :tomcat_context_file, '/var/lib/tomcat7/conf/Catalina/localhost/test-web.xml'
|
|
24
|
+
set :tomcat_work_dir, '/var/lib/tomcat7/work/Catalina/localhost/test-web'
|
|
25
|
+
|
|
26
|
+
# Deploy setting section
|
|
27
|
+
set :local_war_file, '/tmp/test-web.war'
|
|
28
|
+
set :context_template_file, File.expand_path('../templates/context.xml.erb', __FILE__).to_s
|
|
29
|
+
set :use_parallel, true
|
|
30
|
+
set :use_context_update, true
|
|
31
|
+
DESC
|
|
32
|
+
task :deploy do
|
|
33
|
+
on roles(:app), in: get_parallelism, wait: 5 do |hosts|
|
|
34
|
+
if fetch(:use_context_update) then
|
|
35
|
+
info 'Upload WAR file'
|
|
36
|
+
upload_war_file
|
|
37
|
+
|
|
38
|
+
info 'Stop Tomcat'
|
|
39
|
+
stop_tomcat
|
|
40
|
+
|
|
41
|
+
info 'Update Context'
|
|
42
|
+
upload_context_file
|
|
43
|
+
|
|
44
|
+
info 'Clean Work directory'
|
|
45
|
+
cleanup_work_dir
|
|
46
|
+
|
|
47
|
+
info 'Start Tomcat'
|
|
48
|
+
start_tomcat
|
|
49
|
+
check_tomcat_started
|
|
50
|
+
else
|
|
51
|
+
info 'Stop Tomcat'
|
|
52
|
+
stop_tomcat
|
|
53
|
+
|
|
54
|
+
info 'Upload WAR file'
|
|
55
|
+
upload_war_file
|
|
56
|
+
|
|
57
|
+
info 'Clean Work directory'
|
|
58
|
+
cleanup_work_dir
|
|
59
|
+
|
|
60
|
+
info 'Start Tomcat'
|
|
61
|
+
start_tomcat
|
|
62
|
+
check_tomcat_started
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Start Tomcat server
|
|
68
|
+
def start_tomcat
|
|
69
|
+
# local variables
|
|
70
|
+
tomcat_cmd = fetch(:tomcat_cmd)
|
|
71
|
+
|
|
72
|
+
puts capture(:sudo, get_sudo_user_tomcat_cmd, "#{tomcat_cmd} start")
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Check status whether started
|
|
76
|
+
def check_tomcat_started
|
|
77
|
+
# local variables
|
|
78
|
+
tomcat_port = fetch(:tomcat_port)
|
|
79
|
+
|
|
80
|
+
execute "for i in {0..180}; do echo \"Waiting for Tomcat to start\"; if [ \"\" != \"$(netstat -an | grep #{tomcat_port})\" ]; then break; fi; sleep 30; done"
|
|
81
|
+
puts capture("netstat -an | grep #{tomcat_port}")
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Stop Tomcat server
|
|
85
|
+
def stop_tomcat
|
|
86
|
+
# local variables
|
|
87
|
+
tomcat_cmd = fetch(:tomcat_cmd)
|
|
88
|
+
|
|
89
|
+
puts capture(:sudo, get_sudo_user_tomcat_cmd, "#{tomcat_cmd} stop")
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Upload the WAR file
|
|
93
|
+
def upload_war_file
|
|
94
|
+
# local variables
|
|
95
|
+
upload_user = fetch(:user)
|
|
96
|
+
local_war_file = fetch(:local_war_file)
|
|
97
|
+
tomcat_war_file = fetch(:tomcat_war_file)
|
|
98
|
+
tomcat_user = fetch(:tomcat_user)
|
|
99
|
+
tomcat_user_group = fetch(:tomcat_user_group)
|
|
100
|
+
|
|
101
|
+
if File.exists?(local_war_file)
|
|
102
|
+
# Setup file name
|
|
103
|
+
temp_dir = Pathname.new('/tmp')
|
|
104
|
+
temp_file = File.basename(tomcat_war_file)
|
|
105
|
+
tmp_war_file = temp_dir.join(temp_file)
|
|
106
|
+
|
|
107
|
+
# Clean remote file before uploading
|
|
108
|
+
remove_file_if_exist(upload_user, tmp_war_file)
|
|
109
|
+
# Upload WAR file into temp dir
|
|
110
|
+
upload! local_war_file, tmp_war_file
|
|
111
|
+
# Move tmp WAR file to actual path
|
|
112
|
+
change_owner_and_move(tmp_war_file, tomcat_war_file, tomcat_user, tomcat_user_group)
|
|
113
|
+
else
|
|
114
|
+
error("Local WAR file does not existing. : #{local_war_file}")
|
|
115
|
+
exit(1)
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Generate context.xml file string from ERB template file and bindings
|
|
120
|
+
def get_context_template
|
|
121
|
+
# local variables
|
|
122
|
+
context_template_file = fetch(:context_template_file)
|
|
123
|
+
|
|
124
|
+
if !File.exists?(context_template_file)
|
|
125
|
+
error('Context template file does not existing.')
|
|
126
|
+
exit(1)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# local variables for erb file
|
|
130
|
+
tomcat_context_path = fetch(:tomcat_context_path)
|
|
131
|
+
tomcat_war_file = fetch(:tomcat_war_file)
|
|
132
|
+
info ("#{tomcat_context_path}, #{tomcat_war_file}")
|
|
133
|
+
|
|
134
|
+
template_file = File.read(File.expand_path(context_template_file, __FILE__))
|
|
135
|
+
template = ERB.new(template_file)
|
|
136
|
+
return template.result(binding)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Upload context template string to remote server
|
|
140
|
+
def upload_context_file
|
|
141
|
+
# local variables
|
|
142
|
+
upload_user = fetch(:user)
|
|
143
|
+
tomcat_context_file = fetch(:tomcat_context_file)
|
|
144
|
+
tomcat_user = fetch(:tomcat_user)
|
|
145
|
+
tomcat_user_group = fetch(:tomcat_user_group)
|
|
146
|
+
context_template = get_context_template
|
|
147
|
+
|
|
148
|
+
temp_upload_file = '/tmp/' + File.basename(tomcat_context_file)
|
|
149
|
+
remove_file_if_exist upload_user, temp_upload_file
|
|
150
|
+
contents = StringIO.new(context_template)
|
|
151
|
+
upload! contents, temp_upload_file
|
|
152
|
+
change_owner_and_move(temp_upload_file, tomcat_context_file, tomcat_user, tomcat_user_group)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Clean-up work directory
|
|
156
|
+
def cleanup_work_dir
|
|
157
|
+
# local variables
|
|
158
|
+
tomcat_work_dir = fetch(:tomcat_work_dir)
|
|
159
|
+
tomcat_user = fetch(:tomcat_user)
|
|
160
|
+
|
|
161
|
+
if test "[ -d #{tomcat_work_dir} ]"
|
|
162
|
+
within(tomcat_work_dir) do
|
|
163
|
+
execute :sudo, '- u', tomcat_user, 'rm -rf', tomcat_work_dir
|
|
164
|
+
end
|
|
165
|
+
else
|
|
166
|
+
warn('Tomcat work directory does not existing.')
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Get Parallelism
|
|
171
|
+
# @return :parallel or :sequence
|
|
172
|
+
def get_parallelism
|
|
173
|
+
if fetch(:use_parallel) == true then
|
|
174
|
+
return :parallel
|
|
175
|
+
else
|
|
176
|
+
return :sequence
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Get sudo user for tomcat command
|
|
181
|
+
# @return -u and sudo user name for tomcat command. if :use_tomcat_user_cmd is false, it will return '-u root'
|
|
182
|
+
def get_sudo_user_tomcat_cmd
|
|
183
|
+
if fetch(:use_tomcat_user_cmd) == true then
|
|
184
|
+
return "-u #{fetch(:tomcat_user)}"
|
|
185
|
+
else
|
|
186
|
+
return '-u root'
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Change owner and move file
|
|
191
|
+
# @param [String] file
|
|
192
|
+
# @param [String] destination file name with its path
|
|
193
|
+
# @param [String] user
|
|
194
|
+
# @param [String] group
|
|
195
|
+
def change_owner_and_move (file, destination, user, group)
|
|
196
|
+
# Change file's owner
|
|
197
|
+
puts user
|
|
198
|
+
execute :sudo, :chown, "#{user}:#{group}", file
|
|
199
|
+
|
|
200
|
+
# Move file to destination
|
|
201
|
+
target_dir = File.dirname(destination)
|
|
202
|
+
if test "[ -d #{target_dir} ]"
|
|
203
|
+
within target_dir do
|
|
204
|
+
execute :sudo, '-u', user, :mv, '-f', file, destination
|
|
205
|
+
end
|
|
206
|
+
else
|
|
207
|
+
warn("Target directory is not existing. Capitomcat will try mkdir for target directory. : #{target_dir}")
|
|
208
|
+
execute :sudo, '-u', user, :mkdir, '-p', target_dir
|
|
209
|
+
within(target_dir) do
|
|
210
|
+
execute :sudo, '-u', user, :mv, '-f', file, destination
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Remove file if exist
|
|
216
|
+
# @param [String] user
|
|
217
|
+
# @param [String] file
|
|
218
|
+
def remove_file_if_exist (user, file)
|
|
219
|
+
if test "[ -e #{file} ]"
|
|
220
|
+
execute :sudo, :chown, user, file
|
|
221
|
+
execute :rm, '-f', file
|
|
222
|
+
else
|
|
223
|
+
warn('Target file to remove is not existing.')
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
end
|
data/lib/capitomcat.rb
CHANGED
|
@@ -1,106 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
require 'capitomcat/deploy'
|
|
2
|
+
require 'capitomcat/version'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
Capistrano::Configuration.instance(:must_exist) :
|
|
5
|
-
Capistrano.configuration(:must_exist)
|
|
6
|
-
|
|
7
|
-
configuration.load do
|
|
8
|
-
|
|
9
|
-
default_run_options[:pty] = true
|
|
10
|
-
default_run_options[:shell] = '/bin/sh'
|
|
11
|
-
|
|
12
|
-
set :tmp_dir, "/tmp"
|
|
13
|
-
|
|
14
|
-
desc "Capistrano Recipe for Tomcat"
|
|
15
|
-
namespace :capitomcat do
|
|
16
|
-
desc "Stop Tomcat"
|
|
17
|
-
task :stop, :roles => :app do
|
|
18
|
-
run "#{sudo :as => tomcat_cmd_user} #{remote_tomcat_cmd} stop", :pty => true
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
desc "Start Tomcat"
|
|
22
|
-
task :start, :roles => :app do
|
|
23
|
-
run "echo `nohup #{sudo :as => tomcat_cmd_user} #{remote_tomcat_cmd} start&` && sleep 1", :pty => true
|
|
24
|
-
run("for i in {0..180}; do echo \"Waiting for Tomcat to start\"; if [ \"\" != \"$\(netstat -an | grep #{tomcat_port}\)\" ]; then break; fi; sleep 30; done")
|
|
25
|
-
run("netstat -an | grep #{tomcat_port}")
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
desc "Upload WAR file"
|
|
29
|
-
task :uploadWar, :roles => :app do
|
|
30
|
-
set(:war_file_name) { File.basename(remote_docBase) }
|
|
31
|
-
set :tmp_war_file, "#{tmp_dir}/#{war_file_name}"
|
|
32
|
-
# Clean remote file before upload
|
|
33
|
-
remove_file_if_exist('root', tmp_war_file)
|
|
34
|
-
# Upload WAR file to temp dir
|
|
35
|
-
upload(local_war_file, tmp_war_file, :via => :scp, :pty => true)
|
|
36
|
-
begin
|
|
37
|
-
# Change uploaded WAR file's owner
|
|
38
|
-
run "#{sudo :as => 'root'} chown #{tomcat_user}:#{tomcat_user} #{tmp_war_file}"
|
|
39
|
-
# Move tmp WAR fiel to actual path
|
|
40
|
-
run "#{sudo :as => tomcat_user} cp #{tmp_war_file} #{remote_docBase}", :mode => 0644
|
|
41
|
-
# Clean remote file after task finished
|
|
42
|
-
remove_file_if_exist('root', tmp_war_file)
|
|
43
|
-
rescue
|
|
44
|
-
run "#{sudo :as => 'root'} rm #{tmp_war_file}"
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
desc "Update and upload context file"
|
|
49
|
-
task :updateContext, :roles => :app do
|
|
50
|
-
set(:context_file_name) { File.basename(remote_context_file) }
|
|
51
|
-
set :tmp_context_file, "#{tmp_dir}/#{context_file_name}"
|
|
52
|
-
# Clean remote file before upload
|
|
53
|
-
remove_file_if_exist('root', tmp_context_file)
|
|
54
|
-
# Generate context file from template and upload to temp dir on the remote server
|
|
55
|
-
generate_config(context_template_file, tmp_context_file)
|
|
56
|
-
begin
|
|
57
|
-
# Change uploaded context file's owner
|
|
58
|
-
run "#{sudo :as => 'root'} chown #{tomcat_user}:#{tomcat_user} #{tmp_context_file}"
|
|
59
|
-
# Move tmp WAR fiel to actual path
|
|
60
|
-
run "#{sudo :as => tomcat_user} cp #{tmp_context_file} #{remote_context_file}", :mode => 0644
|
|
61
|
-
# Clean remote file after task finished
|
|
62
|
-
remove_file_if_exist('root', tmp_context_file)
|
|
63
|
-
rescue
|
|
64
|
-
run "#{sudo :as => 'root'} rm #{tmp_context_file}"
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
desc "Cleaning-up Tomcat work directory"
|
|
69
|
-
task :cleanWorkDir, :roles => :app do
|
|
70
|
-
set :remote_tomcat_work_dir, "#{remote_tomcat_work_dir}"
|
|
71
|
-
run "#{sudo :as => tomcat_user} rm -rf #{remote_tomcat_work_dir}"
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
# Copy context.xml template to remote server
|
|
76
|
-
def parse_config(file)
|
|
77
|
-
require 'erb'
|
|
78
|
-
template=File.read(file)
|
|
79
|
-
return ERB.new(template).result(binding)
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
# Generate config file from erb template
|
|
83
|
-
def generate_config(local_file,remote_file)
|
|
84
|
-
temp_file = '/tmp/' + File.basename(local_file)
|
|
85
|
-
buffer = parse_config(local_file)
|
|
86
|
-
File.open(temp_file, 'w+') { |f| f << buffer }
|
|
87
|
-
upload temp_file, remote_file, :via => :scp
|
|
88
|
-
`rm #{temp_file}`
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
# Remove file if exist
|
|
92
|
-
def remove_file_if_exist exc_user, file
|
|
93
|
-
run "if [ -e #{file} ]; then #{sudo :as => exc_user} rm -f #{file}; fi"
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
# Excute multiple task by serial
|
|
98
|
-
def serial_task(&block)
|
|
99
|
-
original = ENV['HOSTS']
|
|
100
|
-
find_servers_for_task(self.current_task).each do |server|
|
|
101
|
-
ENV['HOSTS'] = server.host
|
|
102
|
-
yield
|
|
103
|
-
end
|
|
104
|
-
ensure
|
|
105
|
-
ENV['HOSTS'] = original
|
|
4
|
+
module Capitomcat
|
|
106
5
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<Context path="<%= tomcat_context_path %>" docBase="<%= tomcat_war_file %>" />
|
metadata
CHANGED
|
@@ -1,67 +1,98 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capitomcat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 1.0.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:
|
|
11
|
+
date: 2014-01-11 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
|
-
- -
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0'
|
|
19
|
+
version: '3.0'
|
|
20
|
+
- - ">="
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 3.0.1
|
|
20
23
|
type: :runtime
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
24
|
-
- -
|
|
27
|
+
- - "~>"
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '3.0'
|
|
30
|
+
- - ">="
|
|
25
31
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
32
|
+
version: 3.0.1
|
|
27
33
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
34
|
+
name: capistrano-bundler
|
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
|
30
36
|
requirements:
|
|
31
|
-
- -
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '1.1'
|
|
40
|
+
- - ">="
|
|
32
41
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
34
|
-
type: :
|
|
42
|
+
version: 1.1.1
|
|
43
|
+
type: :runtime
|
|
35
44
|
prerelease: false
|
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
46
|
requirements:
|
|
38
|
-
- -
|
|
47
|
+
- - "~>"
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '1.1'
|
|
50
|
+
- - ">="
|
|
39
51
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
41
|
-
description:
|
|
42
|
-
this Capistrano recipe.
|
|
52
|
+
version: 1.1.1
|
|
53
|
+
description: Capitomcat is the Capistrano 3 recipe for Tomcat web application deployment.
|
|
43
54
|
email:
|
|
44
55
|
- sunggun.dev@gmail.com
|
|
45
56
|
executables: []
|
|
46
57
|
extensions: []
|
|
47
58
|
extra_rdoc_files: []
|
|
48
59
|
files:
|
|
49
|
-
- .gitignore
|
|
60
|
+
- ".gitignore"
|
|
61
|
+
- Gemfile
|
|
62
|
+
- LICENSE.md
|
|
50
63
|
- README.md
|
|
51
|
-
- Rakefile
|
|
52
64
|
- capitomcat.gemspec
|
|
53
|
-
- examples/
|
|
54
|
-
- examples/
|
|
55
|
-
- examples/
|
|
56
|
-
- examples/
|
|
57
|
-
- examples/
|
|
58
|
-
- examples/
|
|
59
|
-
- examples/
|
|
60
|
-
- examples/
|
|
61
|
-
- examples/
|
|
62
|
-
- examples/
|
|
63
|
-
- examples/
|
|
65
|
+
- examples/native/Gemfile
|
|
66
|
+
- examples/native/README.md
|
|
67
|
+
- examples/native/lib/native.rb
|
|
68
|
+
- examples/native/lib/native/application.rb
|
|
69
|
+
- examples/native/lib/native/tasks/tomcat_webapp.cap
|
|
70
|
+
- examples/native/templates/context.xml.erb
|
|
71
|
+
- examples/recipe/customizing/Capfile
|
|
72
|
+
- examples/recipe/customizing/README.md
|
|
73
|
+
- examples/recipe/customizing/config/deploy.rb
|
|
74
|
+
- examples/recipe/customizing/config/deploy/dev.rb
|
|
75
|
+
- examples/recipe/customizing/config/deploy/production.rb
|
|
76
|
+
- examples/recipe/customizing/config/deploy/staging.rb
|
|
77
|
+
- examples/recipe/customizing/lib/capistrano/tasks/tomcat_webapp.cap
|
|
78
|
+
- examples/recipe/customizing/templates/context.xml.erb
|
|
79
|
+
- examples/recipe/multistage/Capfile
|
|
80
|
+
- examples/recipe/multistage/README.md
|
|
81
|
+
- examples/recipe/multistage/config/deploy.rb
|
|
82
|
+
- examples/recipe/multistage/config/deploy/dev.rb
|
|
83
|
+
- examples/recipe/multistage/config/deploy/production.rb
|
|
84
|
+
- examples/recipe/multistage/config/deploy/staging.rb
|
|
85
|
+
- examples/recipe/multistage/lib/capistrano/tasks/tomcat_webapp.cap
|
|
86
|
+
- examples/recipe/multistage/templates/context.xml.erb
|
|
87
|
+
- examples/recipe/singlestage/Capfile
|
|
88
|
+
- examples/recipe/singlestage/README.md
|
|
89
|
+
- examples/recipe/singlestage/lib/capistrano/tasks/tomcat_webapp.cap
|
|
90
|
+
- examples/recipe/singlestage/templates/context.xml.erb
|
|
64
91
|
- lib/capitomcat.rb
|
|
92
|
+
- lib/capitomcat/deploy.rb
|
|
93
|
+
- lib/capitomcat/tasks/deploy.cap
|
|
94
|
+
- lib/capitomcat/version.rb
|
|
95
|
+
- template/context.xml.erb
|
|
65
96
|
homepage: http://sunggun-yu.github.io/capitomcat/
|
|
66
97
|
licenses:
|
|
67
98
|
- Apache 2.0
|
|
@@ -72,18 +103,18 @@ require_paths:
|
|
|
72
103
|
- lib
|
|
73
104
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
105
|
requirements:
|
|
75
|
-
- -
|
|
106
|
+
- - ">="
|
|
76
107
|
- !ruby/object:Gem::Version
|
|
77
108
|
version: '0'
|
|
78
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
110
|
requirements:
|
|
80
|
-
- -
|
|
111
|
+
- - ">="
|
|
81
112
|
- !ruby/object:Gem::Version
|
|
82
113
|
version: '0'
|
|
83
114
|
requirements: []
|
|
84
115
|
rubyforge_project:
|
|
85
|
-
rubygems_version: 2.0
|
|
116
|
+
rubygems_version: 2.2.0
|
|
86
117
|
signing_key:
|
|
87
118
|
specification_version: 4
|
|
88
|
-
summary: Capistrano
|
|
119
|
+
summary: Capistrano 3 recipe for Tomcat web application deployment
|
|
89
120
|
test_files: []
|
data/Rakefile
DELETED
data/examples/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Sample project for single stage deployment
|
data/examples/multistage/Capfile
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Author:: Sunggun Yu
|
|
2
|
-
|
|
3
|
-
require 'capistrano/ext/multistage'
|
|
4
|
-
load 'config/deploy.rb'
|
|
5
|
-
|
|
6
|
-
# Application Stage Section
|
|
7
|
-
set :stages, %w(dev stg prod)
|
|
8
|
-
|
|
9
|
-
# User section
|
|
10
|
-
set :user, "deploy"
|
|
11
|
-
set :password, "#{password}" #Set password from parameter.
|
|
12
|
-
set :tomcat_user, "tomcat"
|
|
13
|
-
set :tomcat_cmd_user, "root"
|
|
14
|
-
set :tomcat_port, "8080"
|
|
15
|
-
|
|
16
|
-
# Local file section
|
|
17
|
-
set :local_war_file, "/your-local-directory/app.war"
|
|
18
|
-
set :context_template_file, "./template/context.xml.erb"
|
|
19
|
-
|
|
20
|
-
# Remote setting section
|
|
21
|
-
set :context_name, "app"
|
|
22
|
-
set( :remote_docBase) {"/your-remote-directory-to-save-war-file/"+File.basename(local_war_file)} unless exists?(:remote_docBase)
|
|
23
|
-
set :remote_context_file, "/var/lib/tomcat7/conf/Catalina/localhost/app.xml"
|
|
24
|
-
set :remote_tomcat_cmd, "/etc/init.d/tomcat7"
|
|
25
|
-
set :remote_tomcat_work_dir, "/var/lib/tomcat7/work/Catalina/localhost/app"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Sample project for multi stage deployment
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Author:: Sunggun Yu
|
|
2
|
-
|
|
3
|
-
require 'capitomcat'
|
|
4
|
-
|
|
5
|
-
desc "Release Task for myjob"
|
|
6
|
-
namespace :myapp do
|
|
7
|
-
task :release, :roles => :app do
|
|
8
|
-
serial_task do
|
|
9
|
-
capitomcat.uploadWar
|
|
10
|
-
capitomcat.stop
|
|
11
|
-
capitomcat.updateContext
|
|
12
|
-
capitomcat.cleanWorkDir
|
|
13
|
-
capitomcat.start
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<Context path="/<%= context_name %>" docBase="<%= remote_docBase %>" />
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Author:: Sunggun Yu
|
|
2
|
-
|
|
3
|
-
load 'config/deploy.rb'
|
|
4
|
-
|
|
5
|
-
# Application host section for DEV
|
|
6
|
-
role :app, "dev01"
|
|
7
|
-
|
|
8
|
-
# User section
|
|
9
|
-
set :user, "user"
|
|
10
|
-
set :password, "#{password}" #Set password from parameter.
|
|
11
|
-
set :tomcat_user, "root"
|
|
12
|
-
set :tomcat_cmd_user, "root"
|
|
13
|
-
set :tomcat_port, "8080"
|
|
14
|
-
|
|
15
|
-
# Local file section
|
|
16
|
-
set :local_war_file, "/your-local-directory/app.war"
|
|
17
|
-
set :context_template_file, "./template/context.xml.erb"
|
|
18
|
-
|
|
19
|
-
# Remote setting section
|
|
20
|
-
set :context_name, "app"
|
|
21
|
-
set( :remote_docBase) {"/your-remote-directory-to-save-war-file/"+File.basename(local_war_file)} unless exists?(:remote_docBase)
|
|
22
|
-
set :remote_context_file, "/var/lib/tomcat7/conf/Catalina/localhost/app.xml"
|
|
23
|
-
set :remote_tomcat_cmd, "/etc/init.d/tomcat7"
|
|
24
|
-
set :remote_tomcat_work_dir, "/var/lib/tomcat7/work/Catalina/localhost/app"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Author:: Sunggun Yu
|
|
2
|
-
|
|
3
|
-
require 'capitomcat'
|
|
4
|
-
|
|
5
|
-
desc "Release Task for myjob"
|
|
6
|
-
namespace :myapp do
|
|
7
|
-
task :release, :roles => :app do
|
|
8
|
-
serial_task do
|
|
9
|
-
capitomcat.uploadWar
|
|
10
|
-
capitomcat.stop
|
|
11
|
-
capitomcat.updateContext
|
|
12
|
-
capitomcat.cleanWorkDir
|
|
13
|
-
capitomcat.start
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<Context path="/<%= context_name %>" docBase="<%= remote_docBase %>" />
|