简体   繁体   中英

The current state of Rails deployment

A few years ago it seemed fairly tricky to get a rails application deployed. However, from what I have been reading recently it seems that rails has improved much in this area. However, given the various versions of Ruby and gem dependency issues, is deployment still a headache (to heroku or engine yard, for example)?

No. Heroku makes deployment ridiculously easy: it's entirely managed by Git, your app is isolated so there are no dependency conflicts, and it's free for small scale apps. Other services like EngineYard and DotCloud offer similar service (although EY isn't cheap and DotCloud isn't as ruby-focused).

There are a bunch of tools to make deployment and management easier for you.

Heroku
Heroku is totally managed by git via the heroku gem. Essentially, you call heroku push instead of git push and your changes get pushed to the server, built, and your site is automatically updated

Bundler
Bundler has made managing gems a lot easier, and it is super straightforward.

RVM
RVM is actually a good tool to use on servers. It allows you to have one server serve multiple Rails applications, each on a different version of Ruby, with it's own totally unique Gemset (This means that you won't have gem conflicts for multiple apps using the same ruby version. Gem conflicts are gone .).

Capistrano
Capistrano lets you define everything you need to happen during deployment, and allows you to start and end it all with one simple command - cap deploy . It greatly simplifies the deployment process.

Foreman
If your application requires multiple services to start (Server, Delayed::Job, Sphinx, etc), Foreman is the tool for you. It lets you define what services you need, and start them all at once by calling foreman start . It works nicely with Capistrano, and makes the console output of your services nice and easy to read.


Overall, I'd say that the state of Rails deployment is an order of magnitude better than it was a few years ago, but there's always room for improvement. The projects mentioned above are a good start, and it's just a matter of finding what fits your organization best.

Deployment might be a headache depending on your needs. If you're running a single application in a server, it's easy to build it, install ruby and setup your deployment environment using Capistrano ( here's a sample of how to do it using Nginx and Unicorn ).

If, on the other end, you require many different applications on your server (possibly running on different rubies and groups of gems), you'll have more work but it's completely possible. To have many different rubies installed at the same time without conflicting with each other you'll use RVM and to make sure all your app dependencies are defined, your Rails app has to use Bundler (or maybe something else that does the same).

So, your requirements are going to make it simpler or not, but is isn't really impossible and it won't drive anyone crazy with the amount and quality of tools available for the job.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM