Alex
Alex

Reputation: 4190

How can I start JRuby on Rails from Java?

I need to start a copy of a Rails app from within Java. I would favor a lightweight HTTP server, as our installations will have a very small userbase (1-10, 10 being a huge installation).

My design I am aiming for is for a single process, with the web interface written in Rails - running on JRuby in a background thread of the main server written in Java.

Any tips on starting up Rails in this way? I very much don't want a separate Tomcat server running.

Thanks!

Upvotes: 2

Views: 267

Answers (2)

Robert Brown
Robert Brown

Reputation: 11016

The simplest way that springs to mind is to make a shell call like

jruby script/server

... from you Java app.

Upvotes: 1

FlorianH
FlorianH

Reputation: 3102

You could just create war files for every installation (google for "warbler") and serve them through one tomcat, or use jetty for each installation (which can be a little more lightweight than tomcat, depending on your configuration).

As far as I know, you can even run script/server via jruby (which starts webrick through jruby).

Upvotes: 1

Related Questions