jruby on Rails 应用程序的部署

发布于 2024-09-10 20:39:35 字数 2113 浏览 2 评论 0原文

我正在尝试在 Rails 应用程序上部署 jruby。

现在我正在使用 mod_proxy 的反向代理运行 mongrel + Apache2。但是,由于 mongrel_jcluster 不适用于最新版本的 jruby,因此我只能运行一台 mongrel 服务器,并且无法利用 apache2 的负载平衡。

还有其他方法来创建混合集群吗?我真的更喜欢 mongrel cluster + apache2 而不是 java servlet 类型系统。

我已经按照此处的说明尝试了jetty: http://jetty-rails.rubyforge.org/

但是在启动jetty服务器时出现以下错误,即使我已经检查了jruby下的activerecord-jdbcmysql-adapter gem版本及其版本0.9.7,

DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead. (called from /home/andrew/.gem/jruby/1.8/gems/activesupport-2.3.8/lib/activesupport.rb:2)
2010-07-20 17:00:46.820::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
Starting server 3000
2010-07-20 17:00:47.134::INFO:  jetty-6.1.14
2010-07-20 17:01:03.511:/:INFO:  Info: using runtime pool timeout of 30 seconds
2010-07-20 17:01:03.511:/:INFO:  Info: received min runtimes = 1
2010-07-20 17:01:03.511:/:INFO:  Info: received max runtimes = 5
Loading parser from serialized file lib/stanford-parser/englishPCFG.ser.gz ... done [4.6 sec].
2010-07-20 17:01:14.341:/:WARN:  Error: unable to initialize application
org.jruby.rack.RackInitializationException: Please install the jdbcmysql adapter: `gem install activerecord-jdbcmysql-adapter` (no such file to load -- active_record/connection_adapters/jdbcmysql_adapter)

任何建议将不胜感激,谢谢!

编辑: 我不知道这是否有什么不同,但我可以告诉它,在崩溃之前,jetty_rails 成功加载了在环境中声明的全局变量。rb

编辑: 这是我的完整 gem 列表,来自 jruby -S gem list --local

*** LOCAL GEMS ***

actionmailer (2.3.8)
actionpack (2.3.8)
activerecord (2.3.8)
activerecord-jdbc-adapter (0.9.7)
activerecord-jdbcmysql-adapter (0.9.7)
activeresource (2.3.8)
activesupport (2.3.8)
builder (2.1.2)
gem_plugin (0.2.3)
jdbc-mysql (5.0.4)
jetty-rails (0.8.1)
jruby-jars (1.5.1)
jruby-openssl (0.7)
jruby-rack (1.0.1)
mizuno (0.3.6)
mongrel (1.1.5)
rack (1.1.0)
rails (2.3.8)
rake (0.8.7)
rubyzip (0.9.4)
sources (0.0.1)
warbler (1.1.0)

I am trying to deploy a jruby on rails application.

Right now I am running mongrel + Apache2 using reverse proxy from mod_proxy. However, because mongrel_jcluster does not work for the latest versions of jruby, I am only able to run one mongrel server, and cant take advantage of load balancing from apache2.

Is there any way other way to create a mongrel cluster? I'd really prefer mongrel cluster + apache2 to a java servlet type system.

I've tried jetty using the instructions here: http://jetty-rails.rubyforge.org/

but I get the following error when starting up the jetty server, even though I've checked my activerecord-jdbcmysql-adapter gem version under jruby and its there and version 0.9.7

DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead. (called from /home/andrew/.gem/jruby/1.8/gems/activesupport-2.3.8/lib/activesupport.rb:2)
2010-07-20 17:00:46.820::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
Starting server 3000
2010-07-20 17:00:47.134::INFO:  jetty-6.1.14
2010-07-20 17:01:03.511:/:INFO:  Info: using runtime pool timeout of 30 seconds
2010-07-20 17:01:03.511:/:INFO:  Info: received min runtimes = 1
2010-07-20 17:01:03.511:/:INFO:  Info: received max runtimes = 5
Loading parser from serialized file lib/stanford-parser/englishPCFG.ser.gz ... done [4.6 sec].
2010-07-20 17:01:14.341:/:WARN:  Error: unable to initialize application
org.jruby.rack.RackInitializationException: Please install the jdbcmysql adapter: `gem install activerecord-jdbcmysql-adapter` (no such file to load -- active_record/connection_adapters/jdbcmysql_adapter)

any suggestions would be appreciated, thanks!

EDIT: I don't know if this makes a difference, but I am able to tell that before it crashes, jetty_rails successfully loads a global variable declared in the environment.rb

EDIT: here is my full gem list from jruby -S gem list --local

*** LOCAL GEMS ***

actionmailer (2.3.8)
actionpack (2.3.8)
activerecord (2.3.8)
activerecord-jdbc-adapter (0.9.7)
activerecord-jdbcmysql-adapter (0.9.7)
activeresource (2.3.8)
activesupport (2.3.8)
builder (2.1.2)
gem_plugin (0.2.3)
jdbc-mysql (5.0.4)
jetty-rails (0.8.1)
jruby-jars (1.5.1)
jruby-openssl (0.7)
jruby-rack (1.0.1)
mizuno (0.3.6)
mongrel (1.1.5)
rack (1.1.0)
rails (2.3.8)
rake (0.8.7)
rubyzip (0.9.4)
sources (0.0.1)
warbler (1.1.0)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

红焚 2024-09-17 20:39:35

也许您正在多个 ruby​​ 解释器之间切换(通过 RVM 或手动)。确保
通过使用 Jruby 运行“gem list”,您有用于 Rails 的 2.3.8 gem 及其依赖项。

如果 Jruby 下没有 gem,请运行“gem install -v=2.3.8rails”。
您可以通过运行“rake Rails:freeze:gems”将 Rails gem 打包到项目树中。

Maybe you're switching between multiple ruby interpreters (via RVM or manually). Make sure
that you have 2.3.8 gems for rails and it's dependencies by running "gem list" using Jruby.

If you don't have the gems under Jruby, run "gem install -v=2.3.8 rails".
You could pack the rails gems inside the project tree by running "rake rails:freeze:gems".

懵少女 2024-09-17 20:39:35

我知道的唯一可能的答案是,系统上有两个 ruby​​ 解释器,而码头环境拾取的解释器缺少 gem。 ruby -v 给出的答案是否与 jruby -v 不同?

话虽如此,您是否有理由不想使用 warble 并向 Jetty 或 Tomcat 部署战争?我发现效果很好。

The only possible answer that I know is that you have two ruby interpreters on the system, and the one being picked up by the jetty environment is missing gems. Does ruby -v give you a different answer than jruby -v?

That being said, is there a reason why you don't want to use warble and deploy a war to Jetty or Tomcat? I find that works well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文