torquebox-lite 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/torquebox-lite CHANGED
@@ -19,7 +19,6 @@
19
19
 
20
20
  require 'fileutils'
21
21
  require 'rubygems'
22
- gem 'thor', '0.14.6'
23
22
 
24
23
  require 'thor'
25
24
  require 'torquebox-rake-support'
@@ -34,10 +33,12 @@ class TorqueBoxLiteCommand < Thor
34
33
  method_option 'extra', :aliases => '-e', :type => :string, :desc => 'Extra options to pass through to JBoss AS, you will need to escape dashes with \ (e.g. \--help)'
35
34
  method_option 'max-threads', :type => :numeric, :desc => "Maximum number of HTTP threads"
36
35
  method_option 'bind-address', :aliases => '-b', :type => :string, :desc => "IP address to bind to"
37
- method_option 'port', :aliases => '-p', :type => :numeric, :desc => "HTTP port to listen on"
36
+ method_option 'port', :aliases => '-p', :type => :numeric, :default => 8080, :desc => "HTTP port to listen on"
38
37
  method_option 'node-name', :type => :string, :desc => 'Override the name of the node (which by default is the hostname)'
39
38
  method_option 'port-offset', :type => :numeric, :desc => 'Offset all port numbers listened on by TorqueBox Lite by this number'
40
39
  method_option 'jvm-options', :aliases => '-J', :type => :string, :desc => 'Pass options on to the JVM'
40
+ method_option 'min-runtimes', :type => :numeric, :default => 1, :desc => 'Min. JRuby runtimes'
41
+ method_option 'max-runtimes', :type => :numeric, :default => 1, :desc => 'Max. JRuby runtimes'
41
42
  def start
42
43
  setup_environment
43
44
  run_server(:max_threads => options['max-threads'],
@@ -47,7 +48,9 @@ class TorqueBoxLiteCommand < Thor
47
48
  :pass_through => options['extra'],
48
49
  :node_name => options['node-name'],
49
50
  :data_directory => options['data-directory'],
50
- :jvm_options => options['jvm-options'])
51
+ :jvm_options => options['jvm-options'],
52
+ :min_runtimes => options['min-runtimes'],
53
+ :max_runtimes => options['max-runtimes'])
51
54
  end
52
55
 
53
56
  no_tasks {
@@ -84,13 +87,7 @@ class TorqueBoxLiteCommand < Thor
84
87
  FileUtils.mkdir_p(base_dir)
85
88
  FileUtils.mkdir_p(deploy_dir)
86
89
 
87
- opts = {:root => Dir.pwd, :dest_dir => deploy_dir}
88
- descriptor = TorqueBox::DeployUtils.basic_deployment_descriptor(opts)
89
- deployed_name = TorqueBox::DeployUtils.deploy_yaml(descriptor, opts).first
90
- failed_file = File.join(deploy_dir, "#{deployed_name}.failed")
91
- if File.exists?(failed_file)
92
- FileUtils.rm(failed_file)
93
- end
90
+ create_deployment_descriptor(options, deploy_dir)
94
91
 
95
92
  options[:pass_through] ||= ''
96
93
  options[:pass_through] << " -Djboss.server.base.dir=#{base_dir}"
@@ -107,6 +104,33 @@ class TorqueBoxLiteCommand < Thor
107
104
  end
108
105
  end
109
106
 
107
+ def create_deployment_descriptor(options, deploy_dir)
108
+ opts = {:root => Dir.pwd, :dest_dir => deploy_dir}
109
+ descriptor = TorqueBox::DeployUtils.basic_deployment_descriptor(opts)
110
+ min_runtimes = options[:min_runtimes]
111
+ max_runtimes = options[:max_runtimes]
112
+ if min_runtimes != 1 && max_runtimes != 1
113
+ if max_runtimes < 1
114
+ $stderr.puts 'ERROR: max_runtimes must be greater than 0'
115
+ exit 1
116
+ end
117
+ if max_runtimes < min_runtimes
118
+ $stderr.puts 'ERROR: max_runtimes must be greater than min_runtimes'
119
+ exit 1
120
+ end
121
+ descriptor['pooling'] = {}
122
+ descriptor['pooling']['web'] = {}
123
+ descriptor['pooling']['web']['lazy'] = false
124
+ descriptor['pooling']['web']['min'] = min_runtimes
125
+ descriptor['pooling']['web']['max'] = max_runtimes
126
+ end
127
+ deployed_name = TorqueBox::DeployUtils.deploy_yaml(descriptor, opts).first
128
+ failed_file = File.join(deploy_dir, "#{deployed_name}.failed")
129
+ if File.exists?(failed_file)
130
+ FileUtils.rm(failed_file)
131
+ end
132
+ end
133
+
110
134
  def strip_jvm_properties_from_jruby_opts
111
135
  jruby_opts = ENV['JRUBY_OPTS']
112
136
  return '' if jruby_opts.nil?
@@ -115,7 +139,7 @@ class TorqueBoxLiteCommand < Thor
115
139
  properties.each do |property|
116
140
  if property =~ /^-J.+/
117
141
  jvm_properties << property.sub(/-J/, '')
118
- ENV['JRUBY_OPTS'] = ENV['JRUBY_OPTS'].sub(property, '')
142
+ ENV['JRUBY_OPTS'] = ENV['JRUBY_OPTS'].sub(property, '').strip
119
143
  end
120
144
  end
121
145
  jvm_properties.join(' ')
@@ -47,7 +47,7 @@ fi
47
47
  # Specify options to pass to the Java VM.
48
48
  #
49
49
  if [ "x$JAVA_OPTS" = "x" ]; then
50
- JAVA_OPTS="-Xms64m -Xmx512m -XX:MaxPermSize=128m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
50
+ JAVA_OPTS="-Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
51
51
  JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
52
52
  JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=standalone.xml"
53
53
  else
@@ -46,7 +46,7 @@ rem # options that are always passed by run.bat.
46
46
  rem #
47
47
 
48
48
  rem # JVM memory allocation pool parameters - modify as appropriate.
49
- set "JAVA_OPTS=-Xms64M -Xmx512M -XX:MaxPermSize=128m"
49
+ set "JAVA_OPTS=-Xms64M -Xmx512M -XX:MaxPermSize=256M"
50
50
 
51
51
  rem # Reduce the RMI GCs to once per hour for Sun JVMs.
52
52
  set "JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true"
@@ -110,7 +110,11 @@
110
110
  <alias name='localhost'/>
111
111
  <alias name='example.com'/>
112
112
  </virtual-server>
113
+ <configuration>
114
+ <jsp-configuration disabled='true'/>
115
+ </configuration>
113
116
  </subsystem>
117
+ <subsystem xmlns='urn:jboss:domain:torquebox-bootstrap:1.0'/>
114
118
  <subsystem xmlns='urn:jboss:domain:torquebox-core:1.0'/>
115
119
  <subsystem xmlns='urn:jboss:domain:torquebox-web:1.0'/>
116
120
  </profile>
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: torquebox-lite
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - The TorqueBox Team
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-09-07 00:00:00 -04:00
13
+ date: 2012-09-11 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -52,7 +52,7 @@ dependencies:
52
52
  requirement: &id004 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
- - - "="
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
57
  version: 0.14.6
58
58
  type: :runtime