Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set up a dedicated rails production server [closed]

I need to set up a dedicated server for a Rails app. I am not sure what is the best approach for this. I need a solution that can scale with lots of users signing up on a site. I guess it would be a medium-scale application.

Here are more specific questions:

  • The OS would probably be ubuntu 10. should I go for ubuntu 10.04 or 10.10?
  • Should I install ruby, and consequently all of gems for the app using sudo, or should i use rvm? If there are no costs for an rvm install, I think that would be preferred as that has greater flexibility, but is using rvm a good solution for a production server? I really have no idea about this
  • Should I use nginx/unicorn, or nginx/passenger, or apache/passenger, or something else?
  • I would need a scalable database, so probably postgres would be better than mysql. Or should I go along with something else, or change my preference here?

One related question, though not related to this post directly: I typically always install one ruby system-wide using sudo, and install packages like libssl or whatever, and then install the others using rvm without sudo. Is this the correct way, or can i directly install all rubies i need with rvm without one installed system-wide as well?

like image 699
umar Avatar asked Dec 22 '22 06:12

umar


2 Answers

I was in this same predicament only last week, the solution I took was to follow Railscasts #335 Deploying to a VPS

Ryan Bates walks you through the tricky steps of deploying to a VPS though, I have deployed to a dedicated server I set up at home to learn the deployment process.

He uses the following setup:

  • Ubuntu (10.04 LTS)
  • nginx (1.0.14)
  • Unicorn (4.2.0)
  • PostgreSQL (9.1.3)
  • Postfix
  • rbenv
  • rbenv-installer
  • Capistrano

Personally, I am better equipped for MySQL and so easily used that in place of PostgreSQL. I also used Ubuntu 12.04.

Admittedly I did pay the $5 subscription. But to be honest the trickier parts of deployment are also covered in more depth on other tutorials. He gives you source code and clues you up on other aspects such as good tools (such as the rbenv-installer).
This also got me using rbenv rather than RVM as I had been using previously and so far i have had no issues with it.

One thing I did trip up on though and had to find some external input on was unicorn but this post along with the Railscast on Capistrano helped me nail it.

Good luck

like image 98
DazBaldwin Avatar answered Jan 07 '23 19:01

DazBaldwin


  • Use RVM. See http://beginrescueend.com/integration/passenger/ .

  • I would use Nginx and Passenger -- Passenger is incredibly easy to set up, and Nginx is nice and lightweight.

  • Postgres is way better than MySQL in nearly every respect. Good choice.

like image 44
Marnen Laibow-Koser Avatar answered Jan 07 '23 17:01

Marnen Laibow-Koser