capistrano-tomcat 0.0.3 → 0.0.4

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.
data/HISTORY.txt CHANGED
@@ -1,3 +1,12 @@
1
+ v0.0.4
2
+ ======
3
+ * Added targets for unpacking WARs
4
+ * More useful README
5
+ * Configurable `catalina_executable` for non-RedHat machines
6
+ (thanks Marc Huffnagle)
7
+ * HTTPS actually defaults to port 8443 like it was supposed to.
8
+ (thanks Marc Huffnagle)
9
+
1
10
  v0.0.3
2
11
  ======
3
12
  * Allows a deployment to add additional environment variables to the
data/README.markdown CHANGED
@@ -16,8 +16,40 @@ you can use the Capistrano deployment as you would for Passenger.
16
16
 
17
17
  ## Configuration
18
18
 
19
- `tomcat_base_port` controls the other ports as well.
20
- `tomcat_http_port`
21
- `tomcat_https_port`
22
- `tomcat_ajp_port`
19
+ The default configuration uploads artifacts/yourapp.war to your app
20
+ servers and starts Tomcat on port 8080.
21
+
22
+ ### Ports
23
+ * `tomcat_base_port`: controls the other ports as well. Defaults to 8005.
24
+ * `tomcat_ajp_port`: defaults to 8009 (`tomcat_base_port` + 4)
25
+ * `tomcat_http_port`: defaults to 8080 (`tomcat_base_port` + 75)
26
+ * `tomcat_https_port`: defaults to 8443 (`tomcat_base_port` + 438)
27
+
28
+ ### Directories and files
29
+ * `catalina_home`: location of the base Tomcat installation, defaults to
30
+ `/usr/share/tomcat6`
31
+ * `catalina_executable`: location of the Tomcat executable, defaults to `/usr/sbin/tomcat6`. In a standard Tomcat installation this would be `${CATALINA_HOME}/bin/catalina.sh` or `${CATALINA_HOME}/bin/catalina.bat`
32
+
33
+ For the Tomcat installed with **Red Hat Enterprise Linux** packages,
34
+ the following settings are appropriate:
35
+
36
+ cset :catalina_home '/usr/share/tomcat6'
37
+ cset :catalina_executable, '/usr/sbin/tomcat6'
38
+
39
+ ### Additional pieces
40
+ If you need Tomcat to run with additional environment variables, you can use the `tomcat_runtime_env` setting. For example:
41
+
42
+ cset :tomcat_runtime_env, {'MYAPP_DB_HOSTNAME' => 'db.example.com'}
43
+
44
+ If you are using the Java keystore for SSL, you can set the password
45
+ with `keystore_password`.
46
+
47
+ ### Unpacking the WAR
48
+
49
+ Some tasks and applications rely on the standard Rails files being
50
+ available on the filesystem. If you need to explode the WAR before
51
+ Tomcat gets to it, you can include the following lines in your recipe:
52
+
53
+ after "deploy:update_code", "tomcat:unpack_war"
54
+ after "tomcat:unpack_war", "tomcat:finalize_unpacked_war"
23
55
 
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Capistrano::Tomcat::VERSION
8
8
  s.authors = ["Rob Hunter"]
9
9
  s.email = ["rhunter@thoughtworks.com"]
10
- s.homepage = ""
10
+ s.homepage = "https://github.com/rhunter/capistrano-tomcat"
11
11
  s.summary = %q{Deployment recipes for deploying to Tomcat at OVE}
12
12
  s.description = %q{Apache Tomcat, a Java servlet container, runs WARs
13
13
 
@@ -7,9 +7,10 @@ configuration.load do
7
7
  _cset :tomcat_base_port, 8005
8
8
  _cset(:tomcat_ajp_port) { tomcat_base_port + 4 } #8009
9
9
  _cset(:tomcat_http_port) { tomcat_base_port + 75 } #8080
10
- _cset(:tomcat_https_port) { tomcat_base_port + 443 } #8443
10
+ _cset(:tomcat_https_port) { tomcat_base_port + 438 } #8443
11
11
  _cset :keystore_password, nil
12
12
  _cset :catalina_home, '/usr/share/tomcat6'
13
+ _cset :catalina_executable, '/usr/sbin/tomcat6'
13
14
  _cset(:tomcat_runtime_env, {})
14
15
 
15
16
  namespace :deploy do
@@ -24,6 +25,7 @@ configuration.load do
24
25
 
25
26
  task :finalize_update do
26
27
  # no finalization necessary with a WAR deployment
28
+ # although it might be if you unpack the war with tomcat:unpack_war
27
29
  end
28
30
 
29
31
  task :start, :roles => :app do
@@ -45,7 +47,7 @@ configuration.load do
45
47
  "CATALINA_BASE" => current_path,
46
48
  "CATALINA_TMPDIR" => tmpdir
47
49
  }
48
- run "/usr/sbin/tomcat6 #{cmd} #{log}", :env => base_env.merge(tomcat_runtime_env)
50
+ run "#{catalina_executable} #{cmd} #{log}", :env => base_env.merge(tomcat_runtime_env)
49
51
  end
50
52
  end
51
53
 
@@ -75,5 +77,39 @@ configuration.load do
75
77
  result = ERB.new(template).result(binding)
76
78
  put result, destination_path, :mode => 0644
77
79
  end
80
+
81
+ namespace :tomcat do
82
+ desc "Unpack a WAR for tools that need the individual files"
83
+ task :unpack_war, :roles => [:app, :worker] do
84
+ target_webapps_path = File.join(release_path, 'webapps')
85
+ target_war_path = File.join(target_webapps_path, war_filename)
86
+ target_unpacked_war_path = unpacked_war_path_under release_path
87
+
88
+ on_rollback { run "rm -rf -- \"#{target_unpacked_war_path}\"" }
89
+ run %{unzip -q "#{target_war_path}" -d "#{target_unpacked_war_path}"}
90
+ end
91
+
92
+ desc "Touch up an unpacked WAR to look like a regular Rails app"
93
+ task :finalize_unpacked_war, :roles => [:app, :worker] do
94
+ unpacked_war_path = unpacked_war_path_under release_path
95
+ app_path = File.join unpacked_war_path, 'WEB-INF'
96
+ # code duplicated from capistrano's deploy recipe:
97
+ # (lib/capistrano/recipes/deploy.rb)
98
+ run <<-CMD
99
+ rm -rf #{app_path}/log #{app_path}/public/system #{app_path}/tmp/pids &&
100
+ mkdir -p #{app_path}/public &&
101
+ mkdir -p #{app_path}/tmp &&
102
+ ln -s #{shared_path}/log #{app_path}/log &&
103
+ ln -s #{shared_path}/system #{app_path}/public/system &&
104
+ ln -s #{shared_path}/pids #{app_path}/tmp/pids
105
+ CMD
106
+ end
107
+
108
+ def unpacked_war_path_under(release_path)
109
+ webapps_path = File.join(release_path, 'webapps')
110
+ war_path = File.join(webapps_path, war_filename)
111
+ unpacked_war_path = File.join(webapps_path, File.basename(war_filename, '.war'))
112
+ end
113
+ end
78
114
  end
79
115
 
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Tomcat
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-tomcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-31 00:00:00.000000000 Z
12
+ date: 2012-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &70196232739240 !ruby/object:Gem::Requirement
16
+ requirement: &70239769475380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70196232739240
24
+ version_requirements: *70239769475380
25
25
  description: ! "Apache Tomcat, a Java servlet container, runs WARs\n\n These deployment
26
26
  recipes help to run a Tomcat instance with your\n own WAR files from Capistrano.\n
27
27
  \ "
@@ -41,7 +41,7 @@ files:
41
41
  - lib/capistrano/tomcat/templates/server.xml.erb
42
42
  - lib/capistrano/tomcat/templates/web.xml.erb
43
43
  - lib/capistrano/tomcat/version.rb
44
- homepage: ''
44
+ homepage: https://github.com/rhunter/capistrano-tomcat
45
45
  licenses: []
46
46
  post_install_message:
47
47
  rdoc_options: []
@@ -66,3 +66,4 @@ signing_key:
66
66
  specification_version: 3
67
67
  summary: Deployment recipes for deploying to Tomcat at OVE
68
68
  test_files: []
69
+ has_rdoc: