我正在尝试在本地机器上的扭矩箱环境中部署导轨,一切进展顺利。
我已经按照他们的 RVM 入门指南以及有关集群、会话复制和分布式缓存的一些其他建议进行了操作。我也尝试过后台作业支持。
现在我的应用程序在本地两个节点集群上运行,所有这些东西都到位,我从一个端口切换到另一个端口,仍然有相同的会话和相同的缓存数据。
现在的问题是,如何启动连接到扭矩箱环境的导轨控制台?我试过了
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_*
环境变量