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.
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!
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 cap commands 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).
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_default method. This is a custom method that Ryan created to avoid using Capistrano's built-in _cset method. It's located in base.rb.
If you've got base.rb in your recipes folder and it contains set_default, make sure you're loading it before all other recipes.
Edit: You can see what base.rb looks like in the show notes for episode 337 (Capistrano Recipes)
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.
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 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.
Thanks!
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 methodset_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 inbase.rb.If you've got
base.rbin your recipes folder and it containsset_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.
I added:
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 1They originate from jruby-rack and it's been fixed on master but it looks like trinidad depends on an earlier version.
+1
First sign in through GitHub to post a comment.