背景:我想使用 warblers 可执行文件 war 部署一个小型 JRuby-On-Rails 应用程序,因此我可以删除 .war 文件,每个人都可以使用 .war 文件运行它java -jar app.war。
应用程序使用sqlite3存储一些数据,production-db-file位于war内的WEB-INF/db。
每次启动应用程序时,winstone 都会将 war 解压到一个临时目录,如果应用程序第二次启动,则在此会话期间执行的所有操作都将丢失(因为生产数据库再次从 war 文件中解压)。
那么如何在每次应用程序启动时使用相同的 db 文件呢?
我想从JRuby上运行的Rails代码发出HTTP请求.
我怎样才能重新使用http.proxyHost,http.proxyPort和http.nonProxyHosts设置,给JVM运行它?
我有一个Clojure后端,我想把一个Rails前端.我应该如何连接它们,具体如何?
在我的头顶,有两种方式:
两者似乎都有缺点.在前者中,似乎运行jruby将限制我们可以重用的宝石,否则当图书馆作者没有完全兼容的东西时,我们的生产力就会降低.在后者中,我想我们会错过代码重用 - 可能必须在某些情况下实现两次相同的东西 - 并且更复杂的接口(Web钩子而不仅仅是函数调用)将花费我们.
最后,在JRuby的情况下,目前还不清楚如何实际连接这两者.两者都带有管理脚本:rake和leiningen,以及特定的存储库布局.我真的不怎么开始加入他们.建议和战争故事欢迎.
我通过在以下内容中添加了一些外部 jars 到我的 CLASSPATH 中config/application.rb:
require 'java'
$CLASSPATH << "#{File.dirname(__FILE__)}/../backend/src/"
Dir["#{File.dirname(__FILE__)}/../backend/lib/*.jar"].each do |jar|
require jar
end
Run Code Online (Sandbox Code Playgroud)
这在使用rails server. 加载来自 CLASSPATH 的 jar。但是,运行时rake未设置类路径。我该如何设置?特别是,我需要在加载我的 gem 之前设置它,因为我使用 JRClj gem,它依赖于我的 CLASSPATH 中已经有 clojure.jar。
(哦,我也尝试将代码放在 environment.rb 中;没有帮助)
“不工作”,我的意思是:
$ rake rspec --trace
rake aborted!
No such file to load -- /MY_CURRENT_WORKING_DIRECTORY/clojure.lang.RT
org/jruby/RubyKernel.java:1063:in `load'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:639:in `new_constants_in'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/rake-0.9.2.2/lib/rake/default_loader.rb:6:in `load'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/rake-0.9.2.2/lib/rake/application.rb:569:in `load_imports'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/rake-0.9.2.2/lib/rake/application.rb:508:in `raw_load_rakefile'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `load_rakefile'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/pbiggar/.rvm/gems/jruby-1.6.5@jruby-clojure-combination/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile' …Run Code Online (Sandbox Code Playgroud) 我希望能够向Heroku倾斜一个jruby rails 3.1 app.
Heroku现在支持Java:http://blog.heroku.com/archives/2011/08/25/java/ 据说,应该可以部署JRuby rails应用程序.这里有一个关于普通java的教程:http://devcenter.heroku.com/articles/java和另一个:http://devcenter.heroku.com/articles/spring-mvc-hibernate
这是关于Heroku的JRuby Sinatra应用程序的教程:http://chris.chowie.net/2011/08/28/Sinatra-with-JRuby-on-Heroku/ 为了使这个工作,我使用非运行heroku时的jruby ruby,因为如果rvm使用jruby,heroku会崩溃.
为了运行命令
mvn package
Run Code Online (Sandbox Code Playgroud)
我不得不这样做:
bundle --gemfile=/home/justin/github/sinatra-jruby-heroku/Jemfile install temple
bundle --gemfile=/home/justin/github/sinatra-jruby-heroku/Jemfile update
Run Code Online (Sandbox Code Playgroud)
我创建了应用程序:
heroku create jg1-sinatra --stack cedar
Run Code Online (Sandbox Code Playgroud)
我将文件推送到heroku,但是当应用程序启动时,它崩溃了.:(
有什么建议?我猜不会在Heroku有这方面的教程之前不久.
Heroku的日志文件:
2011-11-21T08:30:40+00:00 heroku[slugc]: Slug compilation started
2011-11-21T08:31:17+00:00 heroku[api]: Deploy 3bccec5 by justin.gordon@gmail.com
2011-11-21T08:31:17+00:00 heroku[api]: Release v7 created by justin.gordon@gmail.com
2011-11-21T08:31:18+00:00 heroku[web.1]: State changed from crashed to created
2011-11-21T08:31:18+00:00 heroku[slugc]: Slug compilation finished
2011-11-21T08:31:20+00:00 heroku[web.1]: Starting process with command …Run Code Online (Sandbox Code Playgroud) 对于某些空白模块,运行RDoc没有意义.例如:
class moduleName::className < ActiveRecord::Base
def foo
end
def bar
end
end
Run Code Online (Sandbox Code Playgroud)
RDoc生成报告:
moduleName -> blank HTML
moduleName::className -> complete documentation
Run Code Online (Sandbox Code Playgroud)
如何删除moduleName,这是从报告生成中删除的?
任何帮助将不胜感激,谢谢.
任何教程或博客都可以从JRuby on Rails开始,
它指导我进行安装和小型JRuby on Rails应用程序?我已经完成了本演练和教程(https://github.com/jruby/jruby/wiki/WalkthroughsAndTutorials)链接,但大多数JRuby on Rails链接都已损坏.
这是我第一次使用橡胶或部署到Amazon EC2.我正在关注这个Railscast.我已经用Google搜索了,似乎没有其他人遇到这个问题.这是运行时的控制台日志cap rubber:create_staging:
user529789@user529789-M15x:~/develops/grouper$ cap rubber:create_staging
triggering load callbacks
* executing `rubber:init'
* executing `rubber:create_staging'
Hostname to use for staging instance [production]:
Roles to use for staging instance [apache,app,collectd,common,db:primary=true,elasticsearch,examples,graphite_server,graphite_web,graylog_elasticsearch,graylog_mongodb,graylog_server,graylog_web,haproxy,mongodb,monit,passenger,postgresql,postgresql_master,web,web_tools]:
* executing `rubber:create'
Excon nonblock is not supported by your OpenSSL::SSL::SSLSocket
Excon nonblock is not supported by your OpenSSL::SSL::SSLSocket
* Creating new security group: grouper_production_default
* Creating new rule: {"source_group_name"=>"grouper_production_default", "source_group_account"=>"<account id redacted>"}
[DEPRECATION] authorize_group_and_owner is deprecated, use authorize_port_range with :group option instead
* Creating new rule: …Run Code Online (Sandbox Code Playgroud) 我有一个JRuby on Rails应用程序,它运行在Tomcat(Warble)中.它使用Java桥连接到Progress(OpenEdge)应用程序服务器......当我监视内存时,它只会继续运行.
在这里找到问题的最佳方法是什么?我想它可能是未清理的JRuby对象,或者是Java桥或垃圾收集器中没有完成其工作的东西......
即使我让这个过程运行了半个小时,内存也不会下降......
By the way, I already have configured the Tomcat server to use more memory, but that's just delaying a heap space error...
EDIT: What I'm actually seeing is that Tomcat just uses all the memory that it can maximum use (Maximum memory pool). And it never releases it. Maybe it's just normal behavior... I've now set maximum to 256MB for example and …
我的应用程序在jruby-1.7.12和puma和扭矩盒4上运行良好。
我正在尝试使用彪马和扭矩盒4的最新jruby-graal(9k)。
但是我的服务器尚未开始使用jruby-graal。这就是卡住的地方。
krunal@krunal-Lenovo-IdeaPad-U530-Touch:~/code/test$ rails s puma
file:/home/krunal/.rvm/rubies/jruby-graal/lib/jruby.jar!/jruby/java/core_ext/object.rb:27 warning: ambiguous Java methods found, using isJavaIdentifierStart(int)
file:/home/krunal/.rvm/rubies/jruby-graal/lib/jruby.jar!/jruby/java/core_ext/object.rb:28 warning: ambiguous Java methods found, using isJavaIdentifierPart(int)
file:/home/krunal/.rvm/rubies/jruby-graal/lib/jruby.jar!/jruby/java/core_ext/object.rb:27 warning: ambiguous Java methods found, using isJavaIdentifierStart(int)
file:/home/krunal/.rvm/rubies/jruby-graal/lib/jruby.jar!/jruby/java/core_ext/object.rb:28 warning: ambiguous Java methods found, using isJavaIdentifierPart(int)
Run Code Online (Sandbox Code Playgroud)