On Nov 21, 2012, at 9:04 AM, Rick F. wrote:
Hello Jrubyists…
Is it possible to run Trinidad as the embedded web server in a warbler
created executable war file? If so, can someone point me in the right
direction?
Not via the happy path. In some ways, they both serve the same purpose
and rely on jruby-rack to do the other stuff.
If not, how does one go about packaging up a Jruby rails app
that uses Trinidad as a standalone package (not necessarily a web
executable, but totally self-contained and portable)?
You could deploy with Capistrano configure to deploy_via :copy – that
will package your app into tarball. But it wouldn’t include Trinidad.
Trinidad and Warbler take two very different approaches to deployment.
Warbler is the “package it all up in a single file” while Trinidad is
typically used with Capistrano to deploy as loose files in a directory
on the server.
Can you specify where the war file extraction would go when kicking off
the execution? I would like to have it go to a specific directory versus
is putting it in some default location.
If I were to do this, I would explode the WAR file manually (its really
just a ZIP file), and deploy it to my chosen Java Servlet Container with
the appropriate context file. But in general – i wouldn’t do that.
For the most part, you should think of the contents of the WAR file as
“compiled code” that you won’t touch. If you need to execute rake tasks
and such, there is warbler-exec:
https://github.com/jkutner/warbler-exec
And I think someone forked that because I’ve heard mention of another
solution that does the same thing (maybe better).
Finally, my database.yml will be configured depending on where it is
executed (installed) from based on the end users configuration. Can the
files inside the .war be easily accessed and modified if necessary?
It would probably be best to externalize the database config so that it
does not need to be stored in the WAR file. I suspect there are
patterns for this, but it’s definitely outside the box.
As
an example, lets say one of your controller files needs to be updated.
Does this imply a complete new .war needs to be created and distributed
or can one patch the .war? This question is not in a local debugging
context but with regard to a customer site(s).
Yes, its best to treat the WAR file as a binary file – deploy all or
none. If you are very concerned about deploying in small bit, you might
be able to transfer the new WAR with rsync or something.
In general, you’ll need to pick between Warbler and Trinidad. It comes
down to which of these is more important to you:
- Deploying as a single portable file (Warbler)
- Deploying customized, small changes to customer sites (Trinidad)
I also recommend that you pick up my book, Deploying with Jruby – i
talk about these issues at length:
http://pragprog.com/book/jkdepj/deploying-with-jruby
You should also have a look at Torquebox. It supports a Knob file
deployment, which is similar to Warbler. You might be able to get the
best of both worlds this way.