Ask A Question

Notifications

You’re not receiving notifications from this thread.

Install Ruby from binaries on production: do or do not?

Alex Musayev asked in Ruby

I'm using rbenv with ruby-build plugin as a default way to install ruby for development and production environments. Is there a way to make installation process faster, but keep it stable?

For example, there is ruby-ng repository that could be used to install Ruby as binary package, saving a lot of time on source building: https://www.brightbox.com/docs/ruby/ubuntu/ Anyone tried it? Are there other options?

I'm using Ubuntu Server on Vagrant (for development) and EC2 instances (for production), and Ansible to automate provisioning.

Reply

Yeah you can definitely do this route. So long as you can quickly update to the latest version if security bugs are fixed in a new version, that's the only real concern with using prebuilt binaries.

You could also just install rbenv on every machine and then copy in a precompiled binary for the version of Ruby you want yourself. You could compile it in a VM and then zip it up and just store it on S3 to download and extract on each of your production machines. That way you can always control the version of Ruby and get security releases out in just a few minutes where you might have to wait a long amount of time for some repository to get updated.

Reply

Update: I actually tried out the zip file from S3 approach on this and it worked really really well. I just compiled on Ubuntu and zipped up the ~/.rbenv/versions/2.3.3 directory and uploaded it to S3. Install scripts just download and extract that to the same location, and then run rbenv rehash so rbenv can setup all the proper shims to know that version is available. Worked like a charm!

Reply

Cool! I think I'll use this approach in my Ansible playbook for provisioning app server instances. And the "long path" with ruby-build/ruby-install will be there as a fallback option, in case pre-built archive is not available for some reason.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.