#377 Trinidad pro
Aug 30, 2012 | 15 minutes | Performance, Tools, Deployment, Production
Trinidad is designed to serve JRuby web applications and gives you the power of Java while still keeping the feel of traditional Rails deployment. Here I show how to setup a Capistrano recipe, configure it, and more.
- source codeProject Files in Zip (69.2 KB)
- mp4Full Size H.264 Video (40.8 MB)
- m4vSmaller H.264 Video (19.6 MB)
- webmFull Size VP8 Video (19.6 MB)
- ogvFull Size Theora Video (47.1 MB)
Is unicorn compatible with jruby ??
no, Unicorn (similar to Mongrel) uses some native code thus it won't compile on JRuby.
Trinidad is fantastic but do you plan or have considered an episode on Torquebox? (http://torquebox.org)
It has messaging, websockets, cluster, and many other awesome features!
I second this one! While trinidad is kind of like the first step, the logigac next one is using a whole application server like jboss / torquebox.
I use torquebox and it is great. I don't have to deploy memcached, resque, use cron, etc. All encapsulated in one system, JBOSS.
Ryan did not mention this explicitly, but it might not be obvious to some: You do not have to "deal" with Capistrano + JRuby 1.7 issues (Highline, SSH Forwarding). It's perfectly fine to use MRI while invoking the
capcommands on your machine, you "only" need JRuby on the remote server where Trinidad lives.
One might also consider using the current "stable" version of JRuby on production 1.6.7 if you run into any specific issues with 1.7 (it's still a preview version although pretty stable).
What about puma?
You don't need to add the user directly to sudoers. Just add it to the admin group.
sudo usermod -a -G admin deployer
Yes it definitively worth waiting. Note that's there is torquebox casts : http://torquebox.org/podcasts/
I have some problems regarding 'trinidad:setup' step.
You mentioned 'trinidad_init_services' gem, but after all it isn't used, right ?
When trying to run 'cap trinidad:setup' I got an error:
.rvm/gems/ruby-1.9.3-p194/gems/capistrano-2.12.0/lib/capistrano/configuration/variables.rb:122:inmethod_missing_with_variables': undefined method
set_default' for #<Capistrano::Configuration:0x00000002002218> (NoMethodError)
Looks like you're missing Ryan's
set_defaultmethod. This is a custom method that Ryan created to avoid using Capistrano's built-in
_csetmethod. It's located in
If you've got
base.rbin your recipes folder and it contains
set_default, make sure you're loading it before all other recipes.
Edit: You can see what
base.rblooks like in the show notes for episode 337 (Capistrano Recipes)
Thank You, I missed the episode 337, with base.rb in place it's working now
Is anyone using a JRuby server for their production sites just out of curiosity? I've seen some impressive benchmarks for JRuby servers like Puma (https://github.com/czarneckid/puma-benchmarking and http://puma.io/), but in my personal testing I usually found it to be around par with MRI Servers like Thin. I assume there's some additional configuration for JVM to achieve those results.
Aha, I redid my benchmarks on a small server using
jruby --server --fast -S puma -t 4:4and now the server just blazes. I'm impressed.
The deploying with JRuby pdf is also good.
Does anyone know how to change default jvm options (heap size, stack size) that trinidad_init_services uses to generate init script ?
I keep getting a 'trinidad_init_service: not found' error after the gem installs. Has anyone encountered this issue?
It seems that the SSH agent forwarding issue in JRuby was fixed as of 1.7.0.pre2.
Anyone tried this setup with SSL? I'm getting pretty tripped up with this config.
To the trinidad config block.
However trinidad continues to looks for the keystore file instead of using the certs.
Are you using nginx with Trinidad? If so, you would set up the SSL on nginx and ensure that external traffic is not accepted on the port that nginx is forwarding traffic to Trinidad. On ubuntu, you would do this through ufw or iptables.
Traffic between nginx and trinidad would be loopback, so you shouldn't need an SSL unless you are forwarding to a separate server.
Is anyone else getting these warnings from their assets on Trinidad? Know any workarounds?
rack-1.4.5/lib/rack/utils.rb:399 warning: multiple values for a block parameter (2 for 1
They originate from jruby-rack and it's been fixed on master but it looks like trinidad depends on an earlier version.
Good to be here and to read this amazing article. Thanks a lot for providing this much informative stuff is perfectly excellent.