Reputation: 19176
I'm experimenting rails deploy on torquebox environment on my local machine and everything is going pretty good.
I've followed their getting started guide with RVM plus some other suggestions about clustering, sessions replication and distributed caching. I've also tried background jobs support.
Now I have my application running on a local two nodes cluster with all that stuff in place and I switch from a port to another and still having the same session and the same caching data.
Now the question, how to start a rails console attached to torquebox environment? I tried with
rails c production
in the application directory and, while the console loads fine, I'm unable to read cached value from the web application, Rails.cache.read(:any_key)
always returns nil. Also I'm not able to call backgroundable methods from this console. Given that Search.foo
is a backgroundable method I'm having this exception:
NameError: missing class or uppercase package name (`org.torquebox.core.util.StringUtils')
from org/jruby/javasupport/JavaUtilities.java:54:in `get_proxy_or_package_under_package'
from file:/Users/fabio/.rvm/rubies/jruby-1.7.8/lib/jruby.jar!/jruby/java/java_package_module_template.rb:14:in `method_missing'
from /Users/fabio/.rvm/gems/jruby-1.7.8/gems/torquebox-messaging-3.0.1-java/lib/torquebox/messaging/task.rb:33:in `queue_name'
from /Users/fabio/.rvm/gems/jruby-1.7.8/gems/torquebox-messaging-3.0.1-java/lib/torquebox/messaging/backgroundable.rb:198:in `publish_message'
from /Users/fabio/.rvm/gems/jruby-1.7.8/gems/torquebox-messaging-3.0.1-java/lib/torquebox/messaging/backgroundable.rb:158:in `__async_foo'
from (irb):2:in `evaluate'
from org/jruby/RubyKernel.java:1123:in `eval'
from org/jruby/RubyKernel.java:1519:in `loop'
from org/jruby/RubyKernel.java:1284:in `catch'
from org/jruby/RubyKernel.java:1284:in `catch'
from /Users/fabio/.rvm/gems/jruby-1.7.8/gems/railties-3.2.15/lib/rails/commands/console.rb:47:in `start'
from /Users/fabio/.rvm/gems/jruby-1.7.8/gems/railties-3.2.15/lib/rails/commands/console.rb:8:in `start'
from /Users/fabio/.rvm/gems/jruby-1.7.8/gems/railties-3.2.15/lib/rails/commands.rb:41:in `(root)'
from org/jruby/RubyKernel.java:1084:in `require'
from script/rails:6:in `(root)'
This happens with both Search.foo
and Search.background.foo
I've also tried to run the console using the following commands
torquebox exec /full/path/to/app-knob.yml 'rails c production'
bundle exec torquebox exec /full/path/to/app-knob.yml 'rails c production'
With them I'm getting the error
chmod: vendor/bundle/jruby/1.9/bin/*: No such file or directory
Am I missing something?
Last note, in my /config/torquebox.rb
file I have
TorqueBox.configure do
environment do
RAILS_ENV 'production'
GEM_HOME "#{ENV['rvm_path']}/gems/jruby-1.7.8"
GEM_PATH "#{ENV['rvm_path']}/gems/jruby-1.7.8:#{ENV['rvm_path']}/gems/jruby-1.7.8@global"
end
options_for Backgroundable, concurrency: 10
end
I've tried with and without GEM_*
env variables
Upvotes: 1
Views: 1012
Reputation: 7301
Try https://github.com/torquebox/torquebox-console, but frankly I'm beginning to regret going for Torquebox, funny complications and otherwise unnecessary hoop-jumps sprout all around its use, tbconsole is a useful tool though and it has web variants and such, check it out - but use it with caution in production, it makes the development torquebox instance start behaving quirky (at least for me) which leaves a "work in progress" feeling after couple months of use.
Also, as a work-around, you can set up a "development" environment that connects to production database on production host, but you should expect problems when interfacing with integrated features such as HornetQ or anything that depends on such features, for example https://issues.jboss.org/browse/TORQUE-1175 - the Torquebox team doesn't seem to be in a hurry to tackle these issues.
Upvotes: 3