Is JRuby ready for Rails 3? - jruby

There are several posts floating around on getting it running, but haven't seen any definitive guides on what is and what's not working. Is it ready for production?
According to http://jruby.org/ it's 1.8.7 compatible and 1.9 coming soon.
Update #nicksieger of Engine Yard replied to my question via twitter:
absolutely, I wouldn't hesitate. If there are any hiccups they should be minor, and easily fixed.

Trevor, also see the original Rails 3 release blog post which states that it was designed to work with JRuby 1.5 (1.5.2 at the time of the post).

yes Jruby is ready
this article is old but it helped
http://blog.nicksieger.com/articles/2010/02/24/jruby-and-rails-3-sitting-in-a-tree
plus this Question was asked before
Anyone using JRuby-Rack with Rails 3?

Related

GitHub Footer ToolTip

What does "0.18417s from unicorn-785bf9c5d8-mgr5g" mean?
As mentioned in this old (2009) blog post, this refers to Unicorn, an an HTTP server for Ruby, similar to Mongrel or Thin.
So this measures the page rendition time.
This is illustrated during their 2017 move to Kubernetes
Before this move, our main Ruby on Rails application (we call it github/github) was configured a lot like it was eight years ago: Unicorn processes managed by a Ruby process manager called God running on Puppet-managed servers
I am not sure about the significance of it and probably someone from github could only be able to answer it.
But in general, that is the title attribute in span tag.
You can read more about the title attribute

How to update from Ruby on Rails 2.3.18 to 4.2.4 (latest)?

I want to update a huge Ruby on Rails v2.3.18 application to Rails v4.2.4 (latest).
After doing some research, I've came up with:
After Rails 2.3.18 (March 18, 2013), a total of 195 versions have been released until Rails 4.2.4 (August 24, 2015)
in which 92 are stable releases
and 2 major releases
775 files changed
909 commits
Our application runs Ruby on Rails 2.3.18 on Ruby 2.1.5.
Ruby should also be updated from this version to 2.2.x ?
Are there any individuals who achieved or tried this "leap of faith" and succeeded ?
Where should I start from in order to achieve my goal?
What is the basic flow of updating any Ruby on Rails application?
I have also been pondering this issue with some 5 year old projects - do I keep using rails 2.3.18 LTS https://railslts.com/ , or migrate to rails 4.2, knowing that I will then need to look at annually/biannually updating the rails version. I suspect I will be more succesful in doing a selective replacement as new functionality is developed.
Anyway, the information I found seems to indicate it is a long step by step process:
This post may be of help - https://groups.google.com/d/msg/rubyonrails-talk/y0q1fc8N_GU/H2xOsy2mYpwJ
In it Rob Biedenharn suggests
• update to rails-2.3.18
There's really no reason not to and PLENTY of good reasons that you should have done this already.
2.3.9 (2010-09-04) was the version that first gave deprecation warnings for the upgrade to rails-3.0
2.3.18 (2013-03-18) was the last releast in the 2.3 line and contains fixes for at least 10 vulnerabilities (some of them quite serious!)
• get all your tests to pass (if you don't have tests, you'd better have faith)
• address all the deprecation warnings
• don't upgrade ruby yet
https://developer.uservoice.com/blog/2012/03/04/how-to-upgrade-a-rails-2-3-app-to-ruby-1-9-3/
But you might have to upgrade to ruby-1.8.7 as rails-3.0 doesn't officially support 1.8.6)
Oh, and I took a look at http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html as suggested by Jason Fleetwood-Boldt and that has a MUCH more detailed walk though the upgrade process from 3.0 to 4.1. But if you don't have time to go and look at that yourself, then perhaps I've given you enough with which to weigh the upgrade v. rewrite paths.
• upgrade to rails-3.0.0 (perhaps even directly to rails-3.0.20)
• get all your tests to pass
• upgrade to ruby-1.9.2 (or perhaps even ruby-1.9.3)
• get all your tests to pass
• upgrade to rails-3.1.12 (last of the rails-3.1 line)
This might not strictly be required, but 3.1 introduced the Asset Pipeline and also made jQuery the default JavaScript framework.
If you have much use of Prototype or Scriptaculous in your application, it would probably be a good idea to convert that to jQuery (and get https://github.com/rails/jquery-ujs)
• get all your tests to pass
• upgrade to rails-3.2.19
• get all your tests to pass
• upgrade to ruby-2.1.2 (there's probably no reason to just use 2.0 at this point)
• get all your tests to pass
• upgrade to rails-4.0.8
• get all your tests to pass
• upgrade to rails-4.1.4
• cope with the new secrets.yml file
• get all your tests to pass
• take a vacation
Seriously, there's a lot to do if you really want to go the upgrade route. I haven't even mentioned any of the issues that you're almost certain to encounter with gems that cease to function with newer versions of Rails or even newer Rubies. I'd recommend that you very seriously consider "refreshing" the application as a simpler way to bring the application onto a current, supported RoR stack.

SQLAlchemy 1.0 release

We have a reasonably big project in Django, that had started to push at the limitations of Django (we mostly use Django for database-related stuff, not web interface), and we decided to switch to SQLAlchemy, while it's still possible (we don't want to get ourselves in this position:).
The problem is, it really seems this is the worst time we could have picked. SQLA is on the verge of releasing version 1.0, which will probably be a big change in the interface. More importantly, it seems like there is some trouble with releasing it: more than a month ago, Mike Bayer tweeted that release candidate will be available via pip --pre, but it still hasn't happened.
Docs are updated to 1.0, and the bitbucket repo shows no diff between master and 1_0 branch. If this were Django, I'd just clone a repository and install it directly - there is an official blessing for such method in Django documentation. But I can't see any hint that this is "accepted behaviour" in SQLA community. For example, installation page doesn't mention 1.0 at all.
Am I too paranoic? Should we just use 0.9.8, and then make a few changes when 1.0 comes out? Or should we build 1.0 manually? Or it would be better to wait? (How much? I realize SQLA team doesn't want to heap up pressure to themselves by talking about an release date, but Mike has kinda already done that with that tweet.:)
I realize this is not exactly an objective question, but someone having a knowledge of SQLA process might have valuable advice. For example, if someone asked me same thing about Django 2.0, I'd tell them "if it isn't a mission critical app, just clone and build from the newest repo state - the chance of breaking is small, and you're getting much better interface". And I'd have official docs behind me.
As of the day of rewriting this answer, to answer how to choose from SQLAlchemy 0.9.8 (stable version released on October 13, 2014) or 1.0 ("upcoming" version), personally I will pick the stable version.
As a software life cycle, beta / bleeding edge / nightly build versions tend to have more bugs or breaking changes, which will directly lead to breaking up your system / script.
Therefore, choosing a stable version is more appropriate in most cases, unless you want to have the new feature in the beta version.
Last, there are usually migration guides to upgrade your version, but not downgrade your version. In some cases (but probably not in SQLAlchemy case), upgrade is sometimes irreversible.

Which server option is widely used with JRuby on Rails?

I am experimenting JRuby on Rails and need some guidance/tips in choosing the server. I have used nginx (and passenger) for my RoR in the past. JRuby wiki page Servers provide a lot of options and I have no experience in any of them.
What I am looking for is a simple to install, easy to scale server or the one widely used (so that I can find solutions if I am stuck)
I do realize this might be a broad question and the answer would be "it depends..." but would appreciate some pointers.
I might be biased being on the Trinidad team, but I still think it's top ... esp. as it handles high concurrency well while still being much lighter than TorqueBox (which I would also recommend if you do want something beyond just a web server e.g. built-in jobs but be aware that some of it is TB/JRuby specific). Most other options mentioned are Java web servers, which you can rule out if you do not want to install a Java server, warbling your application and deploying it as a .war file.
p.s. for the (next) version 1.5.0 re-deploys are to be revisited and one should be able to do some (memory leak-free) zero-down time deployments.

jruby on rails scheduling options

I'm using JRuby 1.5.6 on Rails to build myself an application that will periodically go away and retrieve any RSS podcasts that I have subscribed too.
I've chosen JRuby primarily because I'm familiar with Java, wish to utilise the Rails framework and most importantly I'm able to perform the "heavy lifting" tasks in Java when Ruby falls short of my requirements. Up to now (and I'm still in the early stages of development) this hybrid approach has been working extremely well.
I'm now at a point where I'm needed to implement scheduling of periodic and long running tasks to a background process. My requirements are to have a database backed scheduling system that is, ideally, well documented, currently maintained and clean.
My problem now is that after many days of researching suitable off the self gem packaged solutions, I appear to be left with very few options because of my use of JRuby.
Some of the gems I've tried...
rufus scheduler
Having used this before I'm happy with it's interface and documentation, however there is a lack of database persistence, hence a deal breaker for my requirements.
delayed_job
My ideal solution would be delayed_job. Good documentation, still being maintained and database backed, however, breaks under JRuby due to ObjectSpace being turn off (we can however fix this by re-enabling) but more fatally the dependence on the daemons gem which throws a "fork is unsafe and disabled by default on JRuby" error due to limitations within the JRuby implementation.
There is a fork on github that doesn't have a dependence on daemons, however I'm not happy switching to a fork off the main development branch and I'm still left with the ObjectSpace issue which I'm unsure as to it's performance impact.
quartz-jruby
While there have been various quartz based gems before, this very recent offering is another attempt at providing a slick ruby-like interface. There is however minimal documentation and I'm unsure as to if this can be database backed, my gut feeling is that it is not.
The problem
While I've only highlighted 3 options here, I'm aware that there are others available. I've however not been able to find a solution to tick all 3 requirement boxes (docs, maintained, database backed).
So the questions are...
Has anyone else been in this situation and come up with a solution?
Has anyone managed to get delayed_job working in whatever form?
Are there any better solutions out there that I've overlooked and will satisfy my needs?
We have been using delayed_job (collectiveidea/v1.8.4) under JRuby in production for over an year now.
We have not enabled ObjectSpace and also we do not use daemons gem.
Created a simple rake task
namespace :product do
desc "Start Delayed Job Worker"
task :dw => :environment do
Delayed::Worker.new.start
end
end
and daemonize it in the OS dependent way. On linux,
nohup jruby -S rake product:dw > $log_dir/delayed_job_console.log 2>&1 &
I would recommend resque as the queueing system. Resque is similar to DelayedJob, but in my opinion much better. It was developed at GitHub and is used as their queueing system. I've also been using it in production for almost a year and I've been very happy with it.
Resque definitely has JRuby support, and all you have to do to get scheduled jobs is have a simple scheduler. Some recommend resque-scheduler, though I like to keep it simple and use clockwork which has a nice DSL for writing simple cron-like tasks to queue up schedulers (see: clockwork README). With that, you can just schedule things like so:
every(1.hour, 'tasks.alert') { Resque.push(:cron, :class => 'TaskAlert', :args => []) }
Check https://github.com/kares/jruby-rack-worker
This allows delayed_job solution under jruby environment.
Still work in progress.
At the time of writing, my experience is that it works fine with a single worker.
Though I have difficulties at making additional workers run.
I originally asked this question in Dec '10 and have since developed a solution that I thought would be worth posting back for others to reference.
As others have pointed out, it is possible to get libraries like delayed_job working with JRuby and for some this might be an acceptable solution. I however didn't want a solution that required an additional process running and with that in mind I have developed a gem that utilises Java's Executor framework and integrates it with ActiveRecord.
The result is acts_as_executor which allows a Rails 3.x application to interact with executors and tasks (which will run in a proper Java thread) just as it would any other ActiveRecord model.
I've recently moved the gem to release candidate 1. Take a look at GitHub and Rubygems.
N.B. RubyGems default page still shows beta2 for some reason. rc1 is still the latest release however.