What plan(s) are needed to get Rails set up on AWS? - ruby-on-rails

I'm new to Amazon's cloud though I have used other cloud provides like Rackspace, Windows Azure and Heroku. I want to deploy my Ruby on Rails 4 application on Amazon but I am overwhelmed with all of the services Amazon offers. AWS, EC2, EBS, S3, SimpleDB, Elastic Beanstalk.... argh!!
My site is a relatively simple Rails app with a Postres database. There will not be much traffic at launch but we obviously hope it will grow and need to scale up.
What is a simple, no-frills plan that Amazon offers to get my app out there? I feel like I need to read 100 pages of documentation just to understand what it is that Amazon is offering.

First of all, there are no plans. You sign-up for an AWS account, and you have access to whichever services you want to use.
Secondly, I can wholeheartedly recommend a single-instance Elastic Beanstalk environment to get started. It only uses 1 EC2 virtual server behind the scenes, but you get much better deployment options.
I can't speak to other services like Heroku.

Related

AWS Data Transfer charges when using Heroku Rails app with Amazon RDS backend

I have a Ruby on Rails app hosted on Heroku that has a PostgreSQL database that I have hosted outside of Heroku, in my own AWS account as an RDS instance. So Heroku manages my compute/app, and AWS directly manages my RDS. (The reason for this is because the cost is lower than buying the database on Heroku.) However, on my AWS bill, in addition to the RDS charges, I am seeing Data Transfer charges for bandwidth in the us-east-1 region. Heroku's EC2 instances and my RDS instance are both in the same us-east-1 region. I am wondering why I am seeing these Data Transfer charges, and if there is a way to mitigate them without having to stop using Heroku?
Thanks in advance.
If your instances / services are located in the same region but in different availability zones, there will be data transfer charges. This is called a regional data transfer and is charged $.01 per GB. There are variations and exceptions. Best to consult Amazon's web site to determine your exact pricing.
Pricing

Hosting for Ruby (and Rails) like hosting for PHP

I was wondering if there was around a hosting as those that have existed for years for PHP that would give the opportunity to publish many Ruby and Rails applications and not as Heroku that forces a single application for dyno.
In classical hosting PHP I can create a folder, upload some files in php and navigate them through links.
You can something like that on some Web hosting?
For small projects, Heroku is really the best deal. Their free tier does everything you'd need for something that's occasionally used and doesn't have a lot of scaling issues. You are restricted to one application per "dyno", per account.
For anything more demanding it's not hard to set up a hosting environment on a VPS provider. Although it takes some additional knowledge, you'll be able to set up and configure a web server using a tool like Passenger and manage your own instances. For $10/mo. you can have a very capable server instance that will handle way more than a $7/mo. dyno can manage. Even the $5/mo. server from a provider like Digital Ocean is a fantastic deal.
PHP's fire and forget method of hosting is convenient, but it's actually a lot more work in the long haul compared to an efficient workflow based around Rails and Passenger.
For example, using Capistrano and a version control system like Git you can make changes, test locally, package up into a commit and deploy on your server within minutes. It's basically effortless once you get it working.
For small production projects, I use webfaction, it's easier to push to production than to configure a complete VPS as it's more like a managed hosting (with all the tools and documentation you need for rails) .
I use mina for deployment and Git for version control.
To complete #Tadman answer you can check OpenShift if you want a more Heroku like alternative.
When I started using Rails I was also tempted to compare and seek for a 'php-hosting' like solution. But it's just a different approach.
To answer your question more precisely, you don't drop files in a folder and navigate with links in a classic rails project. You have to understand the concept of MVC, routing ...
I suggest that you give the rails-tutorial a try, it is a good starting point for understanding the whole rails ecosystem.
You can try Ruby hosting on Jelastic PaaS with automated deployment to containers and scaling, as well as pay-per-use pricing model that makes it not so pricy.
There are pre-configured Apache and NGINX containers for running Ruby application, supported different Ruby versions, built-in Ruby on Rails framework, Passenger, Puma, Unicorn, Bundler dependency manager etc.
When deploying a Ruby application, only a single context (ROOT) can be used. However, you can switch between three deployment types: deployment, production and test.
More details are described here https://jelastic.com/blog/ruby-paas-hosting/
You can start with a free trial and test how it suits your project before investing any budget. This Ruby PaaS is available on different local service providers https://jelastic.cloud/

Heroku Hosting Rails

So I host with company X and have my domain on there. I deployed my app to heroku and pointed my domain at it. I can't wrap my head around if I am hosting my site on heroku now or if I am hosting it on company X's servers.
I would assume I'm hosting on herokus server because that is the most logical, but just keep having this brainfart.
Could someone please explain this to me?
Your application is on Heroku's server. All company X has done is perform the DNS magic necessary to map the friendly URL (www.yoursite.com) to your Heroku deployment.
Amazon
You should also be aware that Heroku doesn't actually "store" the app on its own servers - it uses Amazon's ec2 cloud to create instances of your app
So although you have your domain with company X, your app handled through heroku, it will actually be running in one of Amazon's data centers
Keep that in mind when you start to grow (you may find benefits of using Amazon directly)

Rails hosting for small photo app

I'm making a small photo-gallery app. The photos will be hosted locally. Right now I use dreamhost but their rails implementation looks horrible. So I'm looking for other options. I know Heroku gives you one 'web dyno' for free, but they don't say anything about how much space you get. As I said, I want my photos stored locally with the app, I don't want to deal with s3 or other cloud storage.
there is no local storage with heroku - only temporary space. you'll need to use S3 or some off-site storage with heroku.
(and I agree, rails on DH is awful, even if you enable passenger)
Use Openshift to deploy your app
checkout this deploying rails app in openshift
openshift provides one permanent data directory to store data and its free
If you are interested in VPS, Digital Ocean - https://www.digitalocean.com/, provides excellent hosting starting from $5. And you can store your photos on the local disc.
There are very good tutorials on their site to get you started with.
Check out Shelly Cloud: https://shellycloud.com/ You get persistent storage (so you don't lose data in case of disk failure) and the deployment is optimized for Rails applications.
With Heroku you can host images that you store in the repository of your project. Just try this:
rails new mytest
create a simple page and link to a test image in your /app/assets/images
heroku create mytest123 # <-- mytest1234 must be your unique app name
and now push the repo to Heroku:
git push origin master # origin points automatically to Heroku after you created this
This is the easiest way to host small projects for free. Sometimes the Dyno takes some time to startup, and you need to point the domain to the right proxy, but these issues can be dealt with later.
S3 comes into play when you deal with uploaded content / images. For this use case, you need S3 which is out of the scope of your question too.

Publishing a Ruby on Rails website using Amazon S3

I've completed my website using a Ruby on Rails framework, which uses a simple database.
I have set up an Amazon S3 account and would like to upload it to this, however I've been told that I would need more than just this to get the website working.
I am COMPLETELY new to uploading RoR websites, so would anyone be willing to talk me through what needs doing/ why?
Amazon S3 is simply for storing static assets, images, css etc. You can run entirely static sites on it ie html but not 'applications'.
You may have misheard - you could use Amazon EC2 which provide you with a virtual server to host your application and run your application.
If you are entirely new to this process then I suggest you investigate the likes of Heroku (heroku.com) EngineYard, BrightBox, Rackspace etc With the first you probably would be able to use their free offering and deployment is simply by Git - there's no system administration involved.

Resources