References for web application scalability and deployment best practices - ruby-on-rails

I find it easy to find resources on amazon/online to learn new frameworks/programming languages. However, when it comes to web app deployment, I find it really hard to find a single resource that explains all. Most of them just tell you what to do without explaining 'why'.
I just did my second rails app deployment with unicorn and nginx. Although I 'kind of' know what is going on when reading the tutorial, I would like to know more about the 'how' and 'why' of the steps that were given.
In short, I would like to read books/articles/tutorials (hopefully all-in-one) about best practices for web app deployment, and how to scale/load-balance your app when it gets more traffic (and hopefully it the tutorial uses NGINX/unicorn setup).

Well, deployment and scaling are completely orthogonal topics, so I don't think you'll find an article/tutorial that covers both.
As for deployment, you better automate your work. When you deploy to 100+ servers, the last thing you want to do is to do it manually (fetch from git, migrate db, restart servers, etc).
Capistrano - very well known and adopted tool for deploying Rails.
Vlad - another tool that gains more attention lately.
Chef - very powerful tool for server management. Several top Russian sites use it.

Related

Rails : Deploy using GoDaddy.com

I know this is a topic which is very delicate however the simple question is.... has anyone uploaded a rails app using godaddy.com and if so how did they do it. I'm literally clueless. This is my first time. I cannot use anything else due to my clients choice.
If you're looking for shared hosting, Heroku is your best bet. Although you will need to make some minor modifications to your application to fit this environment, the benefits are considerable.
I would not recommend using regular shared hosting, which is primarily intended for PHP applications, for Rails. You need a VPS at the very least, and if you're not prepared to manage this, you need a managed environment like Heroku or you'll end up in serious trouble.
For small scale or hobby projects, a 512MB VPS is usually sufficient to get started.
If your client is insisting on GoDaddy, Rails may not be a good choice for you. It does seem possible according to the documentation but you need to have the correct account type.

What kinds of sites/apps is Heroku best suited for?

Recently I have been dabbling in Ruby on Rails by learning it through Michael Hartl's tutorial and various other resources on the net. I'm quite impressed with it and have a number of ideas for applications I want to write with it.
Heroku seems like a really nice option for deploying these applications - it's smooth and extremely easy to set up, which is great. Something that I'm not clear on, however, is the type of projects Heroku is best suited for. This might seem like a subjective question, but keep in mind that I am asking from an entirely technical aspect (for instance, "Heroku is most used for X because of Y"), trying to figure out which option would work best given the type of projects I'm interested in.
With that said, I have three basic types of applications I'd like to write:
A personal site with a blog front page and several content pages
A community site that acts as a repository for Illustrator ".ai" files with forums and possibly a wiki
An image host with forums
For each of these projects, which would be best: Heroku, a traditional host with RoR support, or a different cloud host with RoR support?
Heroku is designed for any kind of webapp really. It is designed to scale well depending of your needs.
If you want to host user files you will have to use an outside service like amazon S3, because heroku is not designed to upload files directly in the application. Which is a good practice.
http://devcenter.heroku.com/articles/slug-size
http://devcenter.heroku.com/articles/s3
http://aws.amazon.com/s3/

Heroku vs DotCloud vs Duostack vs other cloud/PaaS providers (Rails and non-Rails)?

We have a very simple function (We look something up from a third party database and return an answer. It's literally five lines of code.) We would like to offload this task from our main server because we expect a high volume of traffic for this one function and would like to optimize it.
We are thinking about testing the promise of many cloud/PaaS providers, where they handle scaling and performance responsibilities.
We're most interested in Rails environments, but are curious to hear experiences from others about any company in the space.
Here are the PaaS companies we found that supports Rails:
1) Heroku
2) DotCloud
3) Duostack
Questions:
1) Do you know of other Rails-specific companies? Also feel free to list non-Rails companies since we're interested in following other companies in case they eventually provide Rails support.
2) How has your experience been with these companies?
Foreword and disclaimer: I work for DotCloud; so the following might be biased. You've been warned.
DotCloud could be interesting for you if you like the following features:
run something else than Ruby (what about some Django or Pylons code talking with your SQL DB? Or even some PHP blog like WordPress or Drupal, using the same user authentication database?)
experiment with databases like Redis or MongoDB, or background ruby workers, without paying for add-ons
SSH access, crontab access (without requiring an add-on)
cheaper workers (I didn't come up with this one; some of our users coming from the Heroku world told us that workers were insanely expensive there)
Duostack is indeed very nice if you want to mix specifically Rails and Node.js. I've been told that they had awesome auto-configuration facilities.
Finally, if you only plan to do Rails and nothing else, ever, you might as well stick with Heroku since they've been in that business for a while, and are probably more mature than the first two of the batch.
Shameless plug: DotCloud is offering a beta test drive; so if you want to see what it looks like, just subscribe to the beta and you will be quickly enough be able to see for yourself. Heroku has a free tier as well.
You could add EngineYard in the mix - but i'd be inclined to use Heroku as my first choice, Dotcloud second (it's a newish product, and is very good but still in development)
If you want more control over your app/servers or want to run it on any cloud or your own infrastructure without having to download/deploy anything, you can try Cloud 66 (www.cloud66.com)
Disclaimer: I work for Cloud 66
A lot has changed on the scene since this question was asked. We recently looked into these services and settled on Heroku, but even more recently decided to continue managing my own deployments directly on EC2. Here are some points not mentioned in the other answers.
Heroku
Now supports much more than just ruby
Has really great-looking support for PostgreSQL
Uses LXC for process containers, like DotCloud
DotCloud
Is now Docker, and is putting a lot of manpower into developing docker.io
Doesn't have a free tier any more
I'm not sure if DotCloud is using Docker internally or not, since the docs say explicitly it isn't production-ready yet.
Our decision to stick with plain EC2 was motivated by the fact that it's cheaper and affords a lot more flexibility. For example, we use local-only http servers behind our public server to do some of our request processing, which doesn't really fit into the PaaS models out there. We would have had to reimplement all our back-end components as redis workers, and pay for them as additional dynos. The fact that Amazon RDS now supports PostgreSQL was also a compelling factor. Incidentally, Amazon has a full-stack PaaS offering as well, Elastic Beanstalk.
Just stumbled upon the question. There are similar ones around here. The problem is also: The PaaS scene is changing very quickly. New vendors are popping in every week or so.
Nowadays OpenShift from Red Hat might also be mentioned here as a Ruby PaaS.
OFFTOPIC + shameless plug: I have compiled a list of PHP PaaS here: http://blog.fortrabbit.com/comparing-cloud-hosting-platforms/

Choice of platform for running web site on Amazon EC2 Linux instance using Solr

I'm a Microsoft guy feeling pretty confident building ASP.Net sites running on Windows. That's basically what I do for a living.
Now I'm considering building a Facebook web app on my own and started looking for hosting solutions. I found the Amazon Web Services Free Usage Tier offer pretty compelling. And having the web site in the cloud also seems like a good idea if it becomes popular.
The problem with the offer is that it's only for Linux instances and I don't know squat about that platform.
I've planned to use Solr as my search engine (and perhaps the only data store) since I'm familiar with it and it's just great from a performance and feature standpoint.
Right now I can see two alternatives that both have pros and cons.
Ruby on Rails
I don't know the platform or language but it seems to have pretty good integration with Solr. It would be fun to try something completely different and RoR seems very popular right now.
Mono
I would be familiar with the platform and the language but it seems to lack in Solr integration.
Any thoughts or pointers to resources would be great. Like I said, I feel a bit lost stepping outside of my comfort zone.
It's really hard to advise someone with completely different background. First you have to forget for a minute all that you know about Linux :)
I would try heroku.com
You don't need to know Linux to deploy to heroku. They have a free plan and they have a Solr add-on, $20/month though.
Be warned: If you go RoR route you may never come back to ASP.NET again. No kidding.

Should I be using Chef or other tool for managing servers

I have 4 servers behind a load balancer and a staging server, a db server, and a utility server for a web application that hosts a number of web sites.
Should I make the jump to Chef to manage these servers or should I just maintain them manually? The servers were built using sprinkle but at that time there were only two. Now that there are four maintenance is becoming more of an issue.
I'd like to hear experiences and the pros and cons of chef and other chef-like tools.
Thanks!
We moved to Chef, and we now have a 1 minute redeployment for our app. So it certainly pays off.
However it took a long time (a few months) to get to the point where we were happy with the chef deployment strategy. With hindsight we would have had several spare boxes around to try out a 'from scratch' deployment. I certainly wouldn't advise trying chef in a production environment without an exact mirror of the setup and lots and lots of tests, nor would I advise using chef on a setup that hasn't been 'cheffed' from scratch.
Having said that, Chef is far better than the other options we looked at and now that we are out the other side it's a breeze deploying a new version of the app on multiple servers. In future I'll be using it for any staging or production environment I have.
In summary, yes, but only if your client/employer is aware that it may take some time before they see the benefits, which will be considerable.
Chef has a steep learning curve, so it will take a while - at least a few weeks - to become familiar with how to use it.
But once you pick up the basics, it is a very handy system, and can simplify any number of tasks - even for the smallest of infrastructures.
A few notes for when you start.
You will be setting up and tearing down cloud servers dozens of times, just to get the hang of it. Experiment.
The standard opscode cookbooks (github.com/opscode/cookbooks) are very useful. But you will need to extend/customize many of them for your particular case. And you will need to search the 'net for cookbooks that are missing from the opscode/cookbooks repository.
Read the opscode cookbooks, and read the 37signals cookbooks too.
The application and database cookbooks are geared towards standard Rails apps with MySQL and Memcached. To the extent that this describes you, you are way in luck.

Resources