Deploying Rails App - ruby-on-rails

I have a question about deploying a Rails application. I know the information exists else where, but my issue is that I can't place it cohesively together. Currently I'm on Dreamhost and would like instructions on how to deploy my app there. I feel like I should be using Capistrano in some fashion but I honestly am pretty lost. Any suggestions on deploying easily or a better host that is around the same price point (less than $10 a month).

Any suggestions on deploying easily or a better host that is around the same price point (less than $10 a month).
Have you heard of Heroku yet? You can run a single dyno instance (one running instance of your application) for free, including access to a shared Postgres database service. It's extremely popular among rubyists for good reason.

You should take a look at this screencast from peepcode for details about hosting your app using capistrano. It is about installing phusion-passenger but they also explain how you can host your application on 'Dreamhost'

Related

Websolr, solr search, Heroku, and sunspot [Ruby on Rails]

So I have a question. I am currently on my development machine using the Sunspot gem for searching through my Rails applications records which is really nice since it does full text searching through articles (which is a feature I really want), but the bad thing is that my app is hosted on Heroku which requires the websolr addon to get the solr server to work with their system which costs $20/month. I, being the super broke college student that I am, am now looking for a workaround to this hosting cost. Does anyone know of any? I know Solr is just a server, so I could potentially host it somewhere else and just run my solr instance through that host but I don't really know how to do that (and how to integrate it with Heroku). Has anyone got any experience with this? If this seems to difficult, does anyone have alternative full text searching options with Heroku (that are free/cheap)?
Thanks in advance!
Heroku has a guide on available full-text search options and it includes a how-to running your own Solr server.
Amazon Web Services has a free usage tier so that option should not cost you anything, at least not for the first year.
You can spin up a machine on Amazon EC2 and install solr on it. It starts somewhere around $10 / month. Just make sure to use the same datacenter as Heroku, which I believe is the east coast one.

Moving Heroku Shared Database

I recently reached the 5mb database limit with heroku, the costs rise dramatically after this point so I'm looking to move the database elsewhere.
I am very new to using VPS and setting up servers from scratch, however, I have done this recently for another app.
I have a couple questions related to this:
Is it possible to create a database on a VPS and point my rails app on heroku to use that database?
If so, what would database.yml actually look like. What would be an example localhost with the database stored outside the app?
These may be elementary questions but my knowledge of servers and programming is very much self taught, so I admit, there may be huge loopholes in things that I "should" already understand.
Note: Other (simpler) suggestions for moving my database are welcomed. Thanks.
OK - for starters, yes you can host a database external to Heroku and point your database.yml at that server - it's simply a case of setting up the hostname to point at the right address, and give it the correct credentials.
However, you need to consider a couple of things:
1) Latency - unless you're hosting inside EC2 East the latency between Heroku and your DB will cause you all sorts of performance issues.
2) Setting up a database server is not a simple task. You need consider how secure it is, how it performs, keeping it up to date, keeping it backed up, and having to worry day and night about it being up. With Heroku you don't need to do this as it's fully managed.
Price wise, are you aware of the new low cost Postgres plans at Heroku? $15/mo will get you 20Gb (shared instance), and $50/mp will get you a terabyte (dedicated instance). To me, that is absurdly cheap as I value my time much more, and I know how many hours I would need to invest in making my own server to save maybe $10 a month.
It would be cheaper to use Amazon RDS, which is officially supported by Heroku and served from the same datacenter (Amazon US-East). If you do want to use a VPS, use an Amazon EC2 instance in US-East for maximum performance. This tutorial shows exactly how to do it with Django in detail. Even if you don't decide to use EC2, refer to that tutorial to see how to properly add external database information to your Heroku application so that Heroku doesn't try to overwrite it.
Still, Heroku's shared database is extremely cost-competitive -- far moreso than most VPSes and with much less setup and maintenance.

Node.js and rails app hosting with a shared MongoDB database and pricing

I have been experimenting a lot with node.js as well as with rails and mongoDB lately. I'd like to know if there's any hosting options out there where I can deploy my apps written in rails and node.js which will share a same MongoDB database?
My rails app will do most of the writing to the mongoDB instance, while the node.js app will only fetch(read) the data from there.
I have heard about heroku, but it seems that it's more focus on mid-large scale deployment while I'm currently only looking for a simple small deployment since this would only be for personal use, and I dont expect too many visitors anyway. I've also heard that Heroku is available for free under certain condition.. Is this true? Also, is google app engine an option for me?
Would like to hear from people who have experience hosting their personal rails/node.js apps with heroku or any other hosting options, including shared hosting as well. Thanks.
http://www.heroku.com/pricing
Hosting free for 1 dyno and 5Mb postgresql shared database. There are two mongo addons, with free 240Mb database. Perfect for a small deployment and tests :)
Also, is google app engine an option for me?
App Engine is kind of its own little world, so you can't install MongoDB on app engine.
Would like to hear from people who have experience hosting their personal rails/node.js apps with heroku or any other hosting options, including shared hosting as well.
Honestly, for small apps, the other option is simply to buy a small VPS. Places like Linode sell them for $20 / month with full access.
You can also use Amazon AWS. They have a free tier for new customers. You can also buy a reserved "Micro" for $23 / year (if you pay in advance). Of course, Amazon will nickel and dime you for everything, so it will probably be more than that. It should stay under $10 / month though. Of course, there are other competitors here like Rackspace.
If you don't want to host the DB, you can also use MongoLab or MongoHQ and pick your cloud provider. They generally offer to host your data in the same DC as your provider.

Deploying rails: What to choose?

I have just finished a Rails-application that I now want to upload to the web. It is a re-write of an existing application and I expect some 4 000 visitors a day with peaks to 10 000 a day at times.
I know Windows fairly well (have not used Windows server though).
I hardly know anything about Ubuntu or Linux
I want things nice and easy and don't want to spend too much of my time "hacking the server". I want to spend my time developing, not maintaining.
My budget is ~50$ a month at most for this project.
The database for the project is quite static (hardly any user generated data)
I am currently using WAMP & Mysql with Rails 3.0.3 on my local installation and it works fine most of the time but crashes quite often as well.
I am considering three ways of doing that:
Using Heroku
Seems quite easy (even though I haven't gotten it to work yet)
Also seems expensive, if I need more nodes. How many nodes should I expect to need?
Using a VPS Windows server
I know Windows and it would be fairly easy to install and get it set up
My friend (who is more of a Rails expert) says that Windows and Rails is not a good match.
My crashes on my local environment makes me nervous about this option
Using a VPS Ubuntu server
Seems to be the cheapest option (in terms of paying up-front)
Seems to be the most stable option
I don't know Ubuntu and I am not too eager to learn a whole new OS to get this set up.
Could you help me with directions? Is Windows server really bad for Rails?
Quite honestly, I think Windows would be the worst choice for you. The problem with Windows and Rails is that most of the gems are never designed to work with Windows, or the versions that do work with Windows are far outdated.
Using an Ubuntu VPS is a very viable option, would be your cheapest and most stable option. We use Amazon S3 services to run most of our web servers in the cloud. Like you said, it does require you to know and understand a *nix operating system to maintain.
Maybe for you, Heroku may be the best option. Heroku is super simple to setup your project on and then deploy. There are also pages of documentation to help you along the way. In a few basic commands from the terminal, your application is running. I often use Heroku as a 'staging' server to test application updates among beta users before pushing to production on S3. You also are not required to learn a new operating system to use it.
If you are running into problems with deploying to Heroku, please post the issues and we will gladly help you.
I would advise against a windows server. From my experience, the major ruby implementations are not optimized for windows - and run slowly. For the sake of your end-users, a rails stack on Linux may provide significant performance gains (or equally decrease your server budget).
With bundler and rails 3, the amount of maintenance work on the server should be minimal. Log in, deploy, log out. (look into tools like capistrano to make this even more straightforward).
By far the easiest production I've found so far is an Ubuntu server.
On Windows Rails tends to be slower and it's far simpler to setup something like passenger on *nix. If help is needed, there are more tutorials available.
My fastest setups have been Ubuntu Server and nginx.
PS. Rails 3.0 has gone beyond 3.0.3 so think about testing the latest version 8)
Heroku is delightfully easy to deploy to. If your database load is light, you can just use their shared 20GB PostgreSQL database ($15/mo). 2 dynos will cost you ($35/mo) so there's your $50 there. 2 should be fine to handle that traffic, and you can always scale during your high traffic times. Definitely would recommend adding the memcached add-on and utilize that as well. Install the New Relic add-on and you can analyze your traffic/load and scale accordingly.
I'd heavily advise against using Windows for a rails app deployment. Some gems compile slower on Windows, and some don't work at all.
I've worked with Heroku, but there are some complications with writing files to the Heroku instance as Heroku does not allow for local file writing. When working with Heroku, people usually offload write operations like file-upload to an Amazon S3 instance or Fog. In general, Heroku is really easy to deploy to, but when configuration comes along...it may be a bit more complicated than a VPS.
The best solution for me would be to go via VPS using Ubuntu. There's been a lot of documentation done on this, and you have more options with your configurations. In actuality, it's not so much different from setting up Ruby on Rails on a local Ubuntu development machine. If you need tips on how to deploy on Ubuntu, I've just recently written a guide on how to do so.
http://www.francisbautista.com/deploying-ruby-on-rails-apps-on-a-vps-nginx-passenger-capistrano/

Selecting a Rails host [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I'm close to picking a Rails host. I think I need a VPS solution, because (1) my Rails app has gems and plugins that I need to install to get it working, and (2) I need an SMTP server to send emails from my rails app out to users.
But then it occured to today...
1) Do I actually need VPS and root access to get my app up and running, just because I need to install gems, or can I just copy my Rails app folder up to a Rails-supporting hosting server and start it?
2) If I get a Google Apps account, which would include a business-class GMail solution, would that give me an SMTP server which I could use to send emails to users?
I'm looking for least-support-needed-solution. I can afford to pay for VPS hosting, and a Google Apps account, but I just wonder if this is really my best option.
UPDATE: It's now been just over three years since I first posted this question and answer. I still prefer AWS for all new deployments of a professional or serious horsepower nature (that is, if I don't self-host), but I also regularly deploy demo and tutorial apps to Heroku. I haven't tried any of the many VPS providers that have popped up such as Linode or DigitalOcean, but generally hear good things about them.
The key thing that keeps me from choosing Heroku for all my apps is cost. Since most of my indie projects outside of work are things where I'd prefer to absolutely minimize costs, AWS remains the better deal between AWS vs. Heroku. AWS (or any VPS provider for that matter) has the nice side effect of teaching you the OS along the way, which turns out to be hugely valuable in the long term.
=======================
So, two years later, here's my update. I've used three services for hosting, and here's my take on each of them (I actually love them all, but for various reasons).
Slicehost (now part of Rackspace Cloud Hosting)
This was the first VPS host I tried, and I loved them. The people there were amazing, support was awesome, and it had a really cool grassroots kind of feel. Now that VPS as a solution is more mainstream, and Rackspace has long since purchased Slicehost, I feel that the service offering is still awesome. If you want a simple way to setup a server, plenty of Linux distro choices, and control over your server, this is an awesome option.
Heroku
Love these guys too. I built a hobby app that is hosted there, rpglogger.com (which as of Nov. 2012 has actually migrated to Amazon Web Services), and developing and deploying to Heroku is a no-brainer. I really like working on Heroku for two reasons:
It's dead simple to setup. It really is as easy as they say, in my experience, to get an app running on their platform.
A single dyno (web server instance) is free. So hobby apps, and smaller apps basically get free hosting. It's not just for hobbies though - their plugin architecture is second-to-none, making the addition of 3rd party plugins such as NewRelic, Exceptional, and anything else on their platform a matter of just a few clicks.
You absolutely cannot beat Heroku for ease of use. Deploying an updated version of your app is literally as simple as pushing to your git repo. Heroku isn't necessarily cheap (for anything other than the small app), but if you're in a situation where you believe developer time is more valuable than having control over the server, then this is an amazing option. You can always migrate your app to any other platform anyhow, if it gets big, or the needs of the app vs. the cost of Heroku no longer make sense for you.
Amazon Web Services
I do quite a few small apps, and AWS reserved instances are awesome. For $60 I can basically get a reserved instance for an entire year. That one server is enough to run 3-4 small apps on the same machine, with more optimized memory usage, and the ability to run multiple web server instances (vs. Heroku's one free dyno, though I hear you can custom config your Heroku dyno using unicorn to get more scalability). Basically, AWS scales really well, and lets you share a server among multiple small apps, or spread a larger app across multiple servers.
On top of that initial cost for the reserved instance, I only have to pay for bandwidth and other AWS usage (S3, for example). I think AWS is an amazing mix of ultimate scalability, great costs, ultimate control, and for enterprise customers who want to build their entire infrastructure in the sky, it can't be beat. Rackspace Cloud Hosting provides similar services, and they're probably comparable for most things. But if what you want is the Swiss army knife of cloud services, I think AWS is still way ahead of everyone else.
===============
So, that being said, I started on Slicehost, then went to AWS, then tried Heroku, and today I spend most of my time back on AWS.
AWS is the kind of platform that, after you invest a little time in setting up your collection of VPS machines, it often makes sense to stay on this platform and leverage their ever increasing set of tools.
Granted, it took me two years of trying several options, and trying every level of management from fully managed servers (i.e. Heroku, where you don't even think of the server, just the app) to fully controlled servers (Slicehost and AWS). After all that I've come to this point where I'm ready to manage my own machines in order to get the flexibility and low costs that I want.
Through automation, the actual management of the servers on AWS becomes a non-event, so I don't spend my time constantly patching my machines, or doing other sysadmin tasks. I just check periodically to see if my servers need reboots, I set them to automatically install all security updates (I happen to deploy to Ubuntu servers), which means I spend 99% of my time (at least day-to-day) writing the application - not managing the servers (managing services is instead an occasional task of a few day's work, and then nothing else for months) - which is where I want to spend my time as a developer.
Neither of your requirements are VPS-specific. I use shared hosting from Site5 and currently run two rails apps through the account, both with gems that are not installed on the server by default and sending email. Installing gems does not require root access.
If you want to use a VPS anyway, both Slicehost and Linode are often recommended for Rails apps. A few more are listed under Deploy on the Rails site. I would encourage you to do some research on your choice in either case. Good luck!
You could check out Ruby on Rails Hosting, What is a good Ruby on Rails hosting service?, Good Ruby on Rails free hosting, and What is a good Ruby on Rails and PHP hosting?.
I personally prefer Heroku which has offers free low-scale hosting and is very easily upgraded. Also, they allow you to install gems (similarly to the gem dependencies and rake gems:install, but with different syntax/files), and send a few free emails (200, but it is easily upgraded).
I hate Heroku, it gives you no control over services you want to use and it's massively over priced. Just try to make use of a gem or service they don't specifically support and you will quickly find the limitations and the horrendous pricing.
Heroku is my host of choice.
You can send messages using GMail SMTP as well as the commercial SMTP plugin.
I have also used Slicehost, Linode, Dreamhost and RailsMachine.
Slicehost/Linode are awesome if you can set up the box yourself.
Dreamhost is cheap-as and great for staging. Sites are ponderously slow at times though.
RailsMachine is second to none as a managed service. Highly recommended for the support and the well-tuned stack.
I prefer linode, aws or so.
linode : is a standard linux server. you can login, install 3rd party dependencies and play around just like in your own server. Installing nginx/rails/ruby is the same way as what you did on your own pc/laptop/server.
heroku : is a service. I have to learn lots of stuffs that are not valuable at all if one day you switch to another platform(e.g. linode) or you have your own real server, for example, check the logs, install databases, or install gems. I have printed out most of its documents and read them in 1/2 days, and then I realize that I can't use these knowledges in my working server( that my company offered to me)
linode is cheap enough, $20 per month.
heroku is not always free. and I don't think it's stable enough for demonstration purpose.(e.g. your free heroku app will fall in sleep in spare time, and will cost you several seconds to wake up. this SEVERAL seconds is long enough to make you lost your customers if they want FAST web app )
so, forget heroku, buy or setup your own VPS, use it for years, then you will be an linux expert.
I use HawkHost for all my hosting needs, and I'm 90% sure they meet all your criteria. They provide web hosting and VPS services for very good prices, and their basic web host plan lets you have Rails applications running as well.
I'm used Joyent host- http://www.joyent.com. It's good Rails host.

Resources