【发布时间】:2013-12-13 08:03:02
【问题描述】:
我正在本地机器上的torquebox 环境中试验rails 部署,一切进展顺利。
我关注了他们获得started guide with RVM 以及有关clustering、sessions replication 和distributed caching 的一些其他建议。我也试过background jobs support。
现在我的应用程序在本地两个节点集群上运行,所有这些东西都到位,我从一个端口切换到另一个端口,仍然有相同的会话和相同的缓存数据。
现在的问题是,如何启动连接到扭矩箱环境的导轨控制台?我试过了
rails c production
在应用程序目录中,虽然控制台加载正常,但我无法从 Web 应用程序读取缓存值,Rails.cache.read(:any_key) 始终返回 nil。此外,我无法从此控制台调用后台方法。鉴于Search.foo 是一个可后台处理的方法,我遇到了这个异常:
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)'
Search.foo 和 Search.background.foo 都会发生这种情况
我也尝试使用以下命令运行控制台
torquebox exec /full/path/to/app-knob.yml 'rails c production'
bundle exec torquebox exec /full/path/to/app-knob.yml 'rails c production'
与他们一起我得到了错误
chmod: vendor/bundle/jruby/1.9/bin/*: No such file or directory
我错过了什么吗?
最后一点,在我的/config/torquebox.rb 文件中
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
我尝试过使用和不使用 GEM_* 环境变量
【问题讨论】:
标签: ruby-on-rails rvm jruby rails-console torquebox