Deployment on Windows

Hello everyone

I have recently been tasked with getting a ruby Sinatra app running on
windows for the first time. We usually use the standard apache + phusion

  • Linux stack but this time our hands are tied regarding OS.

The app itself is relatively simple and straight-forwards but ties into
a slow back-end so I need to handle a decent amount of concurrent
requests which ruled out using lots of mongrels on windows (and the
accompanying management headache)

Therefore I have been doing some research and, frankly, it looks like
jruby is the only sane deployment option (I like my what remains of my
hair thank you very much :wink: for non-trivial ruby webapps on windows.

Which has lead me to my next step. The deployment options. After much
googling I have found loads of information about jruby + glassfish /
trinidad etc. + Linux but not much regarding windows (Most jruby
tutorials stop at executing it from the command line).

The best (read: simplest) option so far seemed to be jruby + glassfish
gem, however from what I can tell there is no way to currently run the
glassfish gem as a windows service (The closest I found so far was an
article from 2008 -
http://danielhill.com.au/2008-04/running-redmine-on-windows-with-jruby-on-rails-and-glassfish/
which used a .net wrapper which had its own issues)

Having little experience with Java (Used it for learning in the
university days 10 years ago) and thoroughly intimidated by the idea of
setting up one of the “full-blooded” Java app servers and using warbler
to WAR up the ruby app I was wondering if anyone knew the current state
of play regarding easily getting a ruby web app running on windows.

While I am keeping an eye on the engine yard blog and their upcoming
jruby articles (Please cover this if anyone responsible is reading!) any
help in the meantime would be much appreciated.

Regards,

Jeff J.

Hi Jeff,

First off… Tomcat is a great server… it’s not one of those
“full-blooded java app servers” that you should run screaming from.
It’s really just a webserver/servlet engine. And it comes with
instructions on how to install it as a windows service
http://tomcat.apache.org

Using warbler is very straightforward and deploying your War file is
as easy as a file copy.

We do this at work and in production it’s running well. Most of your
other solutions involve more work (imho). This will get you up and
running the fastest…

I’m happy to talk more shop about the ins and outs of this if you’d
like. Just hit me up on email.

Jay

Hi, Jeffrey.

I have recently been tasked with getting a ruby Sinatra app running on
windows for the first time. We usually use the standard apache + phusion +
Linux stack but this time our hands are tied regarding OS.

We have a Sinatra + MySQL app at work that gets deployed to various
Windows workstations around the office. We use a few custom Rake
tasks to package the app together with the jruby-complete libraries
into a single standalone .jar. The next release of the app will use
Warbler, so that we can skip those custom tasks and just run “warble”
(with the “executable” option to build a standalone .war that doesn’t
need a Java server):

C:\devel> jruby -S warble executable war

Then, on the target machine which only has a stock workstation JVM
installed:

C:\target> java -jar our_app.war

–Ian

Hello Jay,

Thank you for the suggestion about that. My lack of Java environment
knowledge showed there.

I followed your suggestion and installed tomcat and used warble. After a
few head-slapping moments (Ooooh, warble has to be run with jruby, not
MRI ruby) I got it installed into tomcat.

I haven’t been able to run the application yet because of an
initialization error (
https://github.com/nicksieger/warbler/issues/issue/5 if anyone is
interested) but so far the process was a lot less painless than I
imagined.

Thank you very much for the pointers.

Jeff

I’ve managed to run the glassfish gem without trouble in the background
on
windows with the task scheduler’s on startup execution. Although,
TorqueBox
by RedHat/JBoss is looking better by the day.

Hi Jeffrey,

I just added support for Trinidad as a windows’ service, I recorded a
screencast, take it a look:

In case you don’t know what’s Trinidad, it’s an embedded Tomcat into a
gem

http://github.com/calavera/trinidad

Cheers

That great Jeffrey,

I’m not a windows expert and that’s something that I wrote in a couple
of
days, so if you think there is something that I can improve or I missed
please let me know.

Cheers

Hello David,

Sorry it has been such a long time, I had to put this on the back burner
until development had progressed.

I have just tested trinidad and it looks good. I have one question
regarding the daemon install script though.

From what I can see it only allows you to install one service
“Trinidad”. We have a few versions of the app running on a single server
(Dev, Test etc.). Is it possible to name the services so that we can
have multiple Trinidad Daemons running?

Is it also possible to delete the services using this script (So that I
can mess about freely)?

Regards

Jeff

Hello David,

I did know about Trinidad (Was the first thing I found after the
glassfish gem) but the lack of windows service was what stopped me using
it.

Now that that feature has been added I shall definitely give it a go!

thanks

Jeff