Configure Dedicated Rail Processing Server

I need to set up a dedicated server for a Rails application. I am not sure if this is the best approach for this. I need a solution that can scale with a large number of users registering on the site. I assume this will be a medium-term application.

Here are more specific questions:

  • The OS will probably be ubuntu 10. Should I go on ubuntu 10.04 or 10.10?
  • Should I install ruby, and therefore all the gems for the app using sudo, or should I use rvm? If there is no overhead to installing rvm, I think it would be preferable as it has more flexibility, but does rvm use a good solution for a production server? I really don't know about that.
  • Should I use nginx / unicorn, or nginx / passenger, or apache / passenger, or something else?
  • I need a scalable database, so postgres will probably be better than mysql. Or do I need to go with something else or change my preferences here?

One related question, although not directly related to this post: usually I always install one ruby โ€‹โ€‹on the system system using sudo and install packages like libssl or something else, and then install others using rvm without sudo. Is this right, or can I directly install all the rubies that I need with rvm, without a single installed system?

+4
source share
4 answers

I was in this predicament only last week, the decision I made was to follow Railscasts # 335 Deployment on VPS

Ryan Bates walks you through the complex steps of deploying to a VPS, but I deployed to a dedicated server that I created at home to study the deployment process.

It uses the following setting:

  • 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 prepared for MySQL and so easily used that instead of PostgreSQL. I also used Ubuntu 12.04.

Admittedly, I paid a subscription for $ 5. But to be honest, the more complex parts of the deployment are also discussed in more detail in other textbooks. It gives you the source code and tells you other aspects, such as good tools (like rbenv-installer).
It also made me use rbenv, not RVM, as I used before, and so far I have not had problems with it.

One thing I did, although I was forced to find an external entrance, was a unicorn, but this post along with the Railscast in Capistrano helped me nail it.

Good luck.

+6
source
+4
source

I would choose a unicorn over a passenger, if only because the passenger still does not offer reloads.

This means that every time you deploy, all instances are taken off at the same time and then returned. You will not drop any requests, but you can get a 10-20 second page load for those who get to your server during deployment.

+1
source

Your post contains several questions, so let me address them one by one.

RVM

I am running a Rails application in production with RVM (standard setup, not the root thing). So far I have not had any problems.

Pro:

  • Itโ€™s easy to have the same environment as your development machines.
  • Greater flexibility in Ruby and Gem versions.

Con:

  • Cron jobs or shell scripts may need extra attention (see here ). However, I did not have any big problems with this.

Perhaps you can talk a little more about the problems that you heard about?

OS

As other people have already noted, this is not a big deal. Personally, I prefer Ubuntu LTS server versions. The most recent one is Ubuntu 12.04 LTS, so I would go for it.

Web server database

It is very difficult to say, based on the few data that you gave. All the options you listed have their pros and cons, but I'm not sure if they are really important to you at this stage of the project.

I would recommend you choose the technology that suits you best. (If you are not familiar with any of them, select Apache / Passenger and MySQL.) Later, when you have thousands of users, you can always switch. Do not put too much effort on optimizing your architecture. Get something and run!

0
source

Source: https://habr.com/ru/post/1379495/


All Articles