Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JRuby Support #160

Closed
tedt10e opened this issue Oct 13, 2020 · 11 comments · Fixed by #167
Closed

JRuby Support #160

tedt10e opened this issue Oct 13, 2020 · 11 comments · Fixed by #167

Comments

@tedt10e
Copy link
Contributor

tedt10e commented Oct 13, 2020

Hello,

Is there any plan to support for JRuby?

Many Thanks.

Ted

@bensheldon
Copy link
Owner

@tedhexaflow What version of JRuby are you using? I'll add it to the testing matrix.

Theoretically GoodJob should be compatible with JRuby (ConcurrentRuby is compatible), but I don't have any experience with jRuby.

@tedt10e
Copy link
Contributor Author

tedt10e commented Oct 13, 2020

Hi @bensheldon,

I'm currently using 9.2.12.0 and the latest one is 9.2.13.0.

We will need to replace 'pg' gems with 'activerecord-jdbcpostgresql-adapter' for JRuby.

Thanks.
Ted

@bensheldon
Copy link
Owner

bensheldon commented Dec 29, 2020

I'm near to having a JRuby-compatible release of GoodJob in #167.

One wrinkle is that activerecord-jdbcpostgresql-adapter does not support Postgres LISTEN notifications; it does not have an analog of pg gem's #wait_for_notify,. GoodJob continues working with polling. I looked at how the que gem works: Que originally used the jruby-pg gem, but has since dropped support for jruby: "JRuby support has been dropped. It will be reintroduced whenever the jruby-pg gem is production-ready."

@tedt10e
Copy link
Contributor Author

tedt10e commented Dec 30, 2020

Hi Ben,

Thank you so much for the update. 🙏

@bensheldon
Copy link
Owner

@tedhexaflow JRuby support was just released in GoodJob v1.4.0 🎉

Please open up any issues you run into or add them to this thread.

@tedt10e
Copy link
Contributor Author

tedt10e commented Dec 31, 2020

Hi Ben,

Thank you so much for spending your holiday time.
I'll arrange for the testing with our product and will keep you update.

Thanks, and wish you a Happy New Year.

@tedt10e
Copy link
Contributor Author

tedt10e commented Jan 6, 2021

Hi Ben,

I just had a chance to test and all 3 adapter options are working fine in development mode.
But for production mode, the server cannot be started (for all adapter options).
Below is the error message. Many thanks.

There is a file with the name "migration.rb.erb" exist in this folder. (/Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/good_job-1.4.0/lib/generators/good_job/templates)

LoadError: no such file to load -- /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/good_job-1.4.0/lib/generators/good_job/templates
const_get at org/jruby/RubyModule.java:3707
eager_load at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:399
ls at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:742
each at org/jruby/RubyDir.java:739
foreach at org/jruby/RubyDir.java:541
ls at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:734
eager_load at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:387
synchronize at org/jruby/ext/thread/Mutex.java:164
eager_load at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:376
each at org/jruby/RubyArray.java:1809
eager_load_all at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:494
Finisher at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/railties-6.0.3.4/lib/rails/application/finisher.rb:122
instance_exec at org/jruby/RubyBasicObject.java:2694
run at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/railties-6.0.3.4/lib/rails/initializable.rb:32
run_initializers at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/railties-6.0.3.4/lib/rails/initializable.rb:61
tsort_each at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/stdlib/tsort.rb:228
each_strongly_connected_component at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/stdlib/tsort.rb:350
each_strongly_connected_component_from at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/stdlib/tsort.rb:431
each_strongly_connected_component at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/stdlib/tsort.rb:349
each at org/jruby/RubyArray.java:1809
call at org/jruby/RubyMethod.java:131
each_strongly_connected_component at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/stdlib/tsort.rb:347
tsort_each at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/stdlib/tsort.rb:226
tsort_each at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/stdlib/tsort.rb:205
run_initializers at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/railties-6.0.3.4/lib/rails/initializable.rb:60
initialize! at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/railties-6.0.3.4/lib/rails/application.rb:363

at /Users/tedhexaflow/Codes/beescm/gBEE/config/environment.rb:7
require at org/jruby/RubyKernel.java:974
require_relative at org/jruby/RubyKernel.java:1002
new_from_string at config.ru:5
eval at org/jruby/RubyKernel.java:1048
new_from_string at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/rack-2.2.3/lib/rack/builder.rb:116
load_file at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/rack-2.2.3/lib/rack/builder.rb:105
parse_file at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/rack-2.2.3/lib/rack/builder.rb:66
build_app_and_options_from_config at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/rack-2.2.3/lib/rack/server.rb:349
app at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/rack-2.2.3/lib/rack/server.rb:249
wrapped_app at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/rack-2.2.3/lib/rack/server.rb:422
start at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/rack-2.2.3/lib/rack/server.rb:312
handle_profiling at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/rack-2.2.3/lib/rack/server.rb:379
start at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/rack-2.2.3/lib/rack/server.rb:311
start at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/railties-6.0.3.4/lib/rails/commands/server/server_command.rb:39
perform at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/railties-6.0.3.4/lib/rails/commands/server/server_command.rb:147
tap at org/jruby/RubyKernel.java:1897
perform at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/railties-6.0.3.4/lib/rails/commands/server/server_command.rb:138
run at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/thor-1.0.1/lib/thor/command.rb:27
invoke_command at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/thor-1.0.1/lib/thor/invocation.rb:127
dispatch at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/thor-1.0.1/lib/thor.rb:392
perform at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/railties-6.0.3.4/lib/rails/command/base.rb:69
invoke at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/railties-6.0.3.4/lib/rails/command.rb:46
at /Users/tedhexaflow/.asdf/installs/ruby/jruby-9.2.13.0/lib/ruby/gems/shared/gems/railties-6.0.3.4/lib/rails/commands.rb:18
require at org/jruby/RubyKernel.java:974
at bin/rails:6

@bensheldon bensheldon reopened this Jan 8, 2021
@bensheldon
Copy link
Owner

@tedhexaflow thanks for the update! I've re-opened this Issue and will figure out why it's not working in the production environment.

@bensheldon
Copy link
Owner

@tedhexaflow I just released GoodJob v1.4.1 with a fix for your error message. I had trouble reproducing the problem; I'm sorry if we have to play whackamole on these errors. I'm committed to getting jruby working for you.

@tedt10e
Copy link
Contributor Author

tedt10e commented Jan 9, 2021

Hi Ben,

Thank you so much. 🙏
I just tested with all 3 adapter options in production mode, and working beautifully now.
At this moment, I've tested only with puma.
Normally, most of the JRuby apps are deployed with Java Servlet (i.e., ApacheTomcat).
I'll organize to test with the Tomcat server and will keep you update.
Once again, thank you so much.

@tedt10e tedt10e closed this as completed Jan 9, 2021
@tedt10e
Copy link
Contributor Author

tedt10e commented Jan 12, 2021

Hello Ben,

I just tested with ApacheTomcat, and it is working flawlessly as well. 🎉🍾🤩

I believe this is a huge help for the JRuby community.

Most of the JRuby Apps are for Enterprise Application, and the way we deploy is different from the normal Rails app deployment (i.e., Heroku.)

We normally package the app with https://github.com/jruby/warbler and drop the war file to ApacheTomcat.
We do not even require to have source code on the production server.

With other gems (i.e., DelayedJob), we cannot run the external command (i.e., delayed_job start) as a daemon without having the source code on the production server.

But with the GoodJob :async execution mode, we no longer need to have the source code on the production server and no more daemon to run, monitor, and maintain.

As far as I'm aware, there are no other ActiveJob Backend gems that work as mentioned above without any additional work for JRuby (with ApacheTomcat).

I think the JRuby community should be aware of this precious gem.
Maybe you could keep in touch with Charles https://github.com/headius, and he can share this gem with the wider JRuby community.

Cheers!
Ted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants