AWS | Linux | Web development | Posted on January 8, 2017

Websites build with Ruby on Rails now is becoming a trend. That’s because of the easy development process. With Rails, you can develop blog site in less than 10 minutes. Actually, if you know how to do it you can do it in 5 minutes. More time will take to apply some Bootstrap or other CSS. Tutorials to achieve this you can find in Google. But that’s not all. A lot of popular sites are build with this awesome framework. Most commonly known sites are Airbnb, Basecamp, Hulu, Goodreads, Kickstarter, Netflix and even shopping platform Shopify. But all of those websites are popular and are hosted on some high-performance hosting providers or VPS. Because they need to be only and accessible. Also, rice isn’t such important thing for them. They can afford to pay more for a host.

But, we also develop some small sites for ou projects. Which don’t need high price hosting. Which then we should use? Where to host our app?  For rails hosting  there is a lot of providers. But most reliable are those two. Amazon Web services and Digitalocean. But a few days ago I discovered one thing, that changes everything.

Requirements for rails hosting

For very basic Rails app all, we need to host it is some basic VPS. Yes, there is an option to pick Heroku. But this time we pick VPS style hosting solution. With 512 MB ram and few GB of a hard drive will satisfy all needs for our app. To set up a server for rails hosting is pretty straight forward. There is a lot of tutorials how to achieve it. But yeah. you can deploy an app on 512 MB ram easy. Now comes the main part of this post.  I deployed few apps few month ago. Ok. One 2 years ago and next one half year ago. Everything went well. Installed server ( ansible FTW ).

For those who are wondering what stack I use. My server setup is MariaDB + NGINX with passenger module. Sad but you can’t compile it from source. If it was possible, I would compile it with pagespeed module.

Why I use such stack? Well. First, I use Nginx every day, it’s lightweight and easy to configure. Passenger I chose because I have tried unicorn or puma, but if I got to restart rails server and Nginx on a separate task. then it’s definitely not for me. Also, the configuration for Nginx is much much faster. Each of them deployed on AWS t.micro instances.

Digitalocean or AWS. Performance view

T2.micro has double or RAM that I mentioned above. 1GB per instance.  Why I did that. Because each time when deployed. Assets precompile task taken all RAM and sometimes failed. Some time I rerun deployment tasks. But that’s not ok to do that.That pushed me to write rake task to deploy assets on my dev PC and then copy them to the production server. After that, everything was working fine. I can deploy changes easily. So I forget about them. But now after some, while I saw that my AWS bill is higher than I expected.

Every time when I remembered it I started to think how to shut down few of those instances. Then I decided to try Digitalocean instead. Just for testing purposes.  And that was one smart move. Started with smallest one 5usd droplet. The first thing that looks weird was that I was able to develop with the first try on that instance… While deployed with Capistrano RAM spike was 400 MB.  Didn’t waiting for such thing.  This was so interesting that I deployed my second web also in the same droplet and same situation as with first one. Was so surprised. Started to google to see why the h**l it happened. And my answer is that AWS for those little instances has different I/O.

Now I have both sites in production on one 512 MB instance. I have better performance and in price, I now can host two sites for 5USD, not 24 USD.So for rails hosting I prefer now Digitalocean. Only thing that i miss in Digitalocean is additional IP address. If they will offer those I will migrate all my servers to them.

Actually, I was surprised about this I/O, but after some time i remember that i have figured out before, but forgot. So , my advice, for ruby on rails hosting choose Digitalocean. For those who are new with it. You can get 10$ in credit with this link https://m.do.co/t/8b30dc0c37bb . Yes, it’s my refferal link .