optimum OS,server, etc setup for rails production environment

只愿长相守 提交于 2019-12-10 00:03:03

问题


what is the optimum OS,server, etc setup for rails production environment?

Your recommendations?

thanks


回答1:


There are many, many different ways to configure a Rails server. I don't know if there if such a thing as an 'ideal' config. I will tell you how I have my server configured and why.

Operating System: Linux, any distribution.

This is the only server platform that makes any sense. The Ruby community is centered around Linux, but BSD would be a perfectly good choice as well. I am most comfortable with Linux.

OSX is a great development platform, but the extra cost doesn't really buy you anything on the server side you can't get on Linux. And Apple is phasing out the Xserve platform, so there likely isn't a future there anyway. Don't even think about using Windows.

Web Server: Apache + Phusion Passenger

I recommend Apache because it's everywhere. Everyone knows it. Getting support is dead simple.

Phusion Passenger is probably the easiest application server to get started on. Here's a sample VirtualHost config:

<VirtualHost x.x.x.x:80>
    ServerName xxxx.com
    DocumentRoot /var/www/xxxx/current/public
    PassengerHighPerformance on
    <Directory "/var/www/xxxx/current/public">
        AllowOverride all
        Options -MultiViews
    </Directory>
    AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/json
    AddOutputFilterByType DEFLATE image/jpeg, image/png, image/gif
</VirtualHost>

That's it. (And most of that isn't strictly necessary)

Ruby interpreter: Ruby Enterprise Edition

I use this instead of vanilla MRI because it's a bit more memory efficient, which makes a big difference on the server. It is also made to integrate with Passenger.

One downside to REE is that it is based on 1.8.7. You may want to use 1.9.2 instead because there is a significant performance benefit.

Gem Management: RVM

RVM lets you create sandboxed gem environments for different applications, in case there are version conflicts. Highly recommended for your development environment as well.

Deployment System: Capistrano

If you're not using Capistrano, you should. This will be the single biggest time-saver you can do for production deployment. It will also make rolling back to the previous version dead simple if theres a problem.

You should also have ExceptionNotifier installed. If there's an exception on your production server you should know about it.

I also highly recommend checking out NewRelic RPM for profiling. Even the free version provides some useful info.



来源:https://stackoverflow.com/questions/4141151/optimum-os-server-etc-setup-for-rails-production-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!