capistrano-torquebox 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ab1d52dbeaa99ac653d54d6c128a4aae8f4fa098
4
+ data.tar.gz: 082c42e7de1651081cd506ad36287ce690c0a45f
5
+ SHA512:
6
+ metadata.gz: eacc2ff22542fa97ce24e31abd0e93b675314158aa1ee52e31f4b91e6f6990bdad6c8b0361b1111e1e4469a7d76b71cff9dab6fac7ddfeab14ad66ecb73123a7
7
+ data.tar.gz: 92b14231bac463ad920373dbc104ebe173456363eba49b20c504d5500a66ab33c296d1445ec63c95d84fe123c22a5fe083246135fd99c07f01dcc2b2fc02bdef
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ InstalledFiles
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-torquebox.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Roman Simecek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Roman Simecek
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Capistrano::Torquebox
2
+
3
+ This gem is based on the 'torquebox-capistrano-support' gem.
4
+
5
+ Torquebox support for Capistrano v3:
6
+
7
+ ## Notes
8
+
9
+ **If you use this integration with capistrano-rails, please ensure that you have `capistrano-bundler >= 1.1.0`.**
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ # Gemfile
16
+ gem 'capistrano', '~> 3.0'
17
+ gem 'capistrano-torquebox'
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install capistrano-torquebox
26
+
27
+ ## Usage
28
+
29
+ Require in Capfile to use the default task:
30
+
31
+ # Capfile
32
+ require 'capistrano/torquebox'
33
+
34
+ And you should be good to go!
35
+
36
+ ## Contributing
37
+
38
+ 1. Fork it ( http://github.com/raskhadafi/capistrano-torquebox/fork )
39
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
40
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
41
+ 4. Push to the branch (`git push origin my-new-feature`)
42
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "capistrano-torquebox"
7
+ spec.version = '0.0.1'
8
+ spec.authors = ["Roman Simecek"]
9
+ spec.email = ["roman@good2go.ch"]
10
+ spec.summary = %q{Torquebox support for Capistrano 3.x}
11
+ spec.description = %q{Torquebox support for Capistrano 3.x}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency 'capistrano', '~> 3.0'
21
+ spec.add_dependency 'sshkit', '>= 1.2.0'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+ end
@@ -0,0 +1,216 @@
1
+ def create_deployment_descriptor(root_path)
2
+ dd = {
3
+ 'application' => {
4
+ 'root' => "#{root_path.respond_to?(:force_encoding) ? root_path.force_encoding('UTF-8') : root_path}",
5
+ },
6
+ }
7
+
8
+ if fetch(:app_host)
9
+ dd['web'] ||= {}
10
+ dd['web']['host'] = fetch(:app_host)
11
+ end
12
+
13
+ if fetch(:app_context)
14
+ dd['web'] ||= {}
15
+ dd['web']['context'] = fetch(:app_context)
16
+ end
17
+
18
+ if fetch(:app_ruby_version)
19
+ dd['ruby'] ||= {}
20
+ dd['ruby']['version'] = fetch(:app_ruby_version)
21
+ end
22
+
23
+ if fetch(:app_environment)
24
+ dd['environment'] = fetch(:app_environment)
25
+ end
26
+
27
+ if fetch(:rails_env)
28
+ dd['environment'] ||= {}
29
+ dd['environment']['RAILS_ENV'] = fetch(:rails_env)
30
+ end
31
+
32
+ if fetch(:stomp_host)
33
+ dd['stomp'] ||= {}
34
+ dd['stomp']['host'] = fetch(:stomp_host)
35
+ end
36
+
37
+ dd
38
+ end
39
+
40
+ namespace :deploy do
41
+ desc "Restart Application"
42
+ task :restart do
43
+ on roles(:app), in: :sequence, wait: 5 do
44
+ execute "touch #{fetch(:jboss_home)}/standalone/deployments/#{fetch(:torquebox_app_name, fetch(:application))}-knob.yml.dodeploy"
45
+ end
46
+ end
47
+
48
+ namespace :torquebox do
49
+ desc "Start TorqueBox Server"
50
+ task :start do
51
+ on roles(:app), in: :sequence, wait: 5 do
52
+ info "Starting TorqueBox AS"
53
+
54
+ case fetch(:jboss_control_style)
55
+ when 'initd'
56
+ execute "#{fetch(:jboss_init_script)} start"
57
+ when 'binscripts'
58
+ execute "nohup #{fetch(:jboss_home)}/bin/standalone.sh -b #{fetch(:jboss_bind_address)} < /dev/null > /dev/null 2>&1 &"
59
+ when 'runit'
60
+ execute "sv start torquebox"
61
+ when 'upstart'
62
+ execute "service torquebox start"
63
+ end
64
+ end
65
+ end
66
+
67
+ desc "Stop TorqueBox Server"
68
+ task :stop do
69
+ on roles(:app), in: :sequence, wait: 5 do
70
+ info "Stopping TorqueBox AS"
71
+
72
+ case fetch(:jboss_control_style)
73
+ when 'initd'
74
+ execute "JBOSS_HOME=#{fetch(:jboss_home)} #{fetch(:jboss_init_script)} stop"
75
+ when 'binscripts'
76
+ execute "#{fetch(:jboss_home)}/bin/jboss-cli.sh --connect :shutdown"
77
+ when 'runit'
78
+ execute "sv stop torquebox"
79
+ when 'upstart'
80
+ execute "service torquebox stop"
81
+ end
82
+ end
83
+ end
84
+
85
+ desc "Restart TorqueBox Server"
86
+ task :restart do
87
+ on roles(:app), in: :sequence, wait: 5 do
88
+ case ( fetch(:jboss_control_style) )
89
+ when 'initd'
90
+ info "Restarting TorqueBox AS"
91
+ execute "JBOSS_HOME=#{fetch(:jboss_home)} #{fetch(:jboss_init_script)} restart"
92
+ when 'binscripts'
93
+ execute "#{fetch(:jboss_home)}/bin/jboss-cli.sh --connect :shutdown"
94
+ execute "nohup #{fetch(:jboss_home)}/bin/standalone.sh -bpublic=#{fetch(:jboss_bind_address)} < /dev/null > /dev/null 2>&1 &"
95
+ when 'runit'
96
+ info "Restarting TorqueBox AS"
97
+ execute "sv restart torquebox"
98
+ when 'upstart'
99
+ info "Restarting TorqueBox AS"
100
+ execute "service torquebox restart"
101
+ end
102
+ end
103
+ end
104
+
105
+ task :info do
106
+ on roles(:app), in: :sequence, wait: 5 do
107
+ info "torquebox_home........#{fetch(:torquebox_home)}"
108
+ info "jboss_home............#{fetch(:jboss_home)}"
109
+ info "jboss_init_script.....#{fetch(:jboss_init_script)}"
110
+ info "jruby_home............#{fetch(:jruby_home)}"
111
+ info "bundle command........#{fetch(:bundle_cmd)}"
112
+ info "knob.yml.............."
113
+ puts YAML.dump(create_deployment_descriptor(current_path))
114
+ end
115
+ end
116
+
117
+ task :check do
118
+ puts "style #{fetch(:jboss_control_style)}"
119
+
120
+ on roles(:app), in: :sequence, wait: 5 do
121
+ case fetch(:jboss_control_style)
122
+ when 'initd'
123
+ execute "test -x #{fetch(:jboss_init_script)}"
124
+ when 'runit'
125
+ execute "test -x #{fetch(:jboss_runit_script)}"
126
+ when 'upstart'
127
+ execute "test -x #{fetch(:jboss_upstart_script)}"
128
+ end
129
+
130
+ execute "test -d #{fetch(:jboss_home)}"
131
+
132
+ unless %w[initd binscripts runit upstart].include?(fetch(:jboss_control_style))
133
+ error "invalid fetch(:jboss_control_style): #{fetch(:jboss_control_style)}"
134
+ end
135
+ end
136
+ end
137
+
138
+ task :deployment_descriptor do
139
+ puts "creating deployment descriptor"
140
+
141
+ dd_str = YAML.dump_stream(create_deployment_descriptor(current_path))
142
+ dd_file = "#{fetch(:jboss_home)}/standalone/deployments/#{fetch(:torquebox_app_name, fetch(:application))}-knob.yml"
143
+ cmd = "cat /dev/null > #{dd_file}"
144
+
145
+ dd_str.each_line do |line|
146
+ cmd += " && echo \"#{line}\" >> #{dd_file}"
147
+ end
148
+
149
+ cmd += " && echo '' >> #{dd_file}"
150
+
151
+ on roles(:app), in: :sequence, wait: 5 do
152
+ execute cmd
153
+ end
154
+ end
155
+
156
+ task :rollback_deployment_descriptor do
157
+ puts "rolling back deployment descriptor"
158
+
159
+ dd_str = YAML.dump_stream(create_deployment_descriptor(previous_release))
160
+ dd_file = "#{fetch(:jboss_home)}/standalone/deployments/#{fetch(:application)}-knob.yml"
161
+ cmd = "cat /dev/null > #{dd_file}"
162
+
163
+ dd_str.each_line do |line|
164
+ cmd += " && echo \"#{line}\" >> #{dd_file}"
165
+ end
166
+
167
+ cmd += " && echo '' >> #{dd_file}"
168
+
169
+ on roles(:app), in: :sequence, wait: 5 do
170
+ execute cmd
171
+ end
172
+ end
173
+
174
+ desc "Dump the deployment descriptor"
175
+ task :dump do
176
+ on roles(:app), in: :sequence, wait: 5 do
177
+ dd = create_deployment_descriptor(current_path)
178
+ puts dd
179
+ exit
180
+ puts YAML.dump(create_deployment_descriptor(current_path))
181
+ end
182
+ end
183
+ end
184
+ end
185
+
186
+ before 'deploy:check', 'deploy:torquebox:check'
187
+ after 'deploy:symlink:shared', 'deploy:torquebox:deployment_descriptor'
188
+ after 'deploy:rollback', 'deploy:torquebox:rollback_deployment_descriptor'
189
+
190
+ __END__
191
+
192
+ module Capistrano
193
+ class Configuration
194
+
195
+ end
196
+
197
+ module TorqueBox
198
+
199
+ def self.load_into( configuration )
200
+
201
+ configuration.load do
202
+ # --
203
+
204
+
205
+ namespace :deploy do
206
+
207
+ namespace :torquebox do
208
+
209
+
210
+ end
211
+
212
+
213
+ end
214
+ end
215
+ end
216
+ end
@@ -0,0 +1,17 @@
1
+ namespace :load do
2
+ task :defaults do
3
+ set :torquebox_home, fetch(:torquebox_home, '/opt/torquebox')
4
+ set :jruby_home, fetch(:jruby_home, "#{fetch(:torquebox_home)}/jruby")
5
+ set :jruby_opts, fetch(:jruby_opts, "--#{fetch(:app_ruby_version)}" ) if fetch(:app_ruby_version) && !fetch(:jruby_opts)
6
+ set :jruby_bin, fetch(:jruby_bin, "#{fetch(:jruby_home)}/bin/jruby #{fetch(:jruby_opts)}" )
7
+ set :jboss_home, fetch(:jboss_home, "#{fetch(:torquebox_home)}/jboss")
8
+ set :jboss_control_style, fetch(:jboss_control_style, 'initd' )
9
+ set :jboss_init_script, fetch(:jboss_init_script, '/etc/init.d/jboss-as-standalone')
10
+ set :jboss_runit_script, fetch(:jboss_runit_script, '/etc/service/torquebox/run')
11
+ set :jboss_upstart_script, fetch(:jboss_upstart_script, '/etc/init/torquebox.conf')
12
+ set :jboss_bind_address, fetch(:jboss_bind_address, '0.0.0.0')
13
+ set :bundle_cmd, fetch(:bundle_cmd, "#{fetch(:jruby_bin)} -S bundle")
14
+ set :bundle_flags, fetch(:bundle_flags, '')
15
+ # set :torquebox_app_name, fetch(:torquebox_app_name, '')
16
+ end
17
+ end
@@ -0,0 +1 @@
1
+ load File.expand_path('../../tasks/torquebox/deploy.rake', __FILE__)
@@ -0,0 +1 @@
1
+ load File.expand_path('../../tasks/torquebox/load.rake', __FILE__)
@@ -0,0 +1,2 @@
1
+ load File.expand_path('../tasks/torquebox/load.rake', __FILE__)
2
+ load File.expand_path('../tasks/torquebox/deploy.rake', __FILE__)
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-torquebox
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Roman Simecek
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sshkit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Torquebox support for Capistrano 3.x
70
+ email:
71
+ - roman@good2go.ch
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - LICENSE
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - capistrano-torquebox.gemspec
83
+ - lib/capistrano/tasks/torquebox/deploy.rake
84
+ - lib/capistrano/tasks/torquebox/load.rake
85
+ - lib/capistrano/torquebox.rb
86
+ - lib/capistrano/torquebox/deploy.rb
87
+ - lib/capistrano/torquebox/load.rb
88
+ homepage: ''
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.2.0
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Torquebox support for Capistrano 3.x
112
+ test_files: []