Preparing for Rails deployment - ruby-on-rails

Getting ready to deploy a rails project on Mac OS X Leopard Server (such that it matters).
Got a few questions for someone with Rails experience:
where should directory containing the project go? inside the website's root folder or out?
who should "own" that directory? www? root? something/someone else?
hope to continue serving static pages via Apache... would like rails app to be served by mydomain/xxx/railsapp. is there a standard naming convention for 'xxx'?
not expecting too much traffic to begin with...just like to keep things as simple as possible.

Use Capistrano for deployment. FAQs and tutorials on the website will make most of your questions fall away.
For running the site, I recommend Phusion Passenger. There's a Capistrano recipe for Passenger here.

Related

Which folder should i put into filezilla for ROR?

I have the following directory structure:
Which files must I drag into remote site of Filezilla for this ROR project?
When deploying a ROR project you should must use a VPN server. Have you used git for your project? Try to deploy in heroku first. To test your site and have a good practice when deploying rails.
https://devcenter.heroku.com/articles/getting-started-with-rails4
The answer to the question would be: everything
But most likely, copying everything is not gonna make it run, here is why: Rails applications live in separate processes that have to be specifically maintained. On your dev machine, you do this with bundle exec rails server. This is a key difference to how the apache php module works for php apps: There the php interpreter is embedded within the apache process and therefore shares its life cycle automatically.
If you have control over the server you are deploying to, I recommend to start with the Phusion passenger apache module. It takes care of starting your rails processes as needed. In case you are using ubuntu 14:04, I can't recommend to just apt-get install libapche2-mod-passenger because I had many problems with it.
If the server is maintained by somebody else, I'd ask this someone for a solution.
I hope this helps.

Deploying Ruby on Rails on Bluehost

Does anyone here know how to deploy a Ruby app on Bluehost? I am having quite a problem with this. Everytime I put my files inside the folder where my domain is pointing at, it always giving me a 403 error when I try to visit the website.
It's so painful. The instructions are incomplete. There are a bunch of things to get caught on like broken versions of sass, assets not pre-compiling, database configuring, how to restart the server, the root directory for passenger, etc.
I had problems with all of those things. I had to come here (Stack Overflow) to find most of the answers.
My site still runs in dev but not in production. The BH support is not much help. THey should call it BlueWordPressHost because that is who they are supporting.
Look in the <rails_root>/log directory for clues.
I'm not willing to switch over to Heroku and use postgres, I tried it but in reality your just dealing with another set of problems setting it up.
Give it a look -> Ruby on Rails Setup with Bluehost.
You cant just drop your Files in a folder.
Although Bluehost does a great job, i recommend you using Heroku for deploying Ruby on Rails Apps.
Deploying with Heroku is quite Easy -> Deploying with Git
I followed the instructions in the Ruby on Rails Setup as The Mini John referenced and it worked. They use Phusion Passenger to allow you to deploy any rack based application. However, I did have to manually install my gem dependencies. This is probably not a scalable solution for a production application with many users. However, if you already have bluehost as a hosting provider and are willing to maintain your own server and deal with possible latency issues and downtime, it may be worth it for you. Here is my Ruby on Rails 4.0 "Hello World" application deployed to bluehost: http://hello.getplanit.com.

How to deploy Ruby on Rails application via cPanel on shared host?

I am in the process of learning Ruby on Rails and things have been going smoothly - up until I tried to deploy one of my test applications to my shared hosting account.
I use Host Gator and was able to successfully create a new Ruby on Rails app via cPanel and run it. The only problem is that when you create a new app this way, it populates its directory with a blank application - as would rails new app_name locally. When I delete the files and folders in this directory and replace them with my own, then attempt to run the app, cPanel says that it is running on the confirmation page but it never actually starts. I am not receiving any error messages either.
The host seemed rather stumped, stating that it should be a matter of deleting the initial files and folders and replacing them, then running. The app works fine locally so I do not think that it is a code issue. In my research I came across Passenger, although it is way over my head and it would appear that you really need to have total control over Apache to make it all work, including ssh.
If it makes any difference, the apps I made locally were put together using an installation of Rails Installer and are scaffolded. For testing I am using a bare minimum app with about three fields in the table.
What am I missing? Any help would be appreciated.
Maximum supported versions on 26/10/2013 are:
Ruby 1.8.7
RubyGems 1.8.25
Rails 2.3.18
Anything newer than that is a near guaranteed breakage and cPanel & WHM will be incapable of utilizing it in any way, shape, or form.
We can assist you with removing your existing Ruby on Rails installations and reverting them back to cPanel supported and sanctioned versions (Ruby 1.8, RubyGems 1.8, and Rails 2). That is the only thing we can do for you at this time.
If you want to use any versions newer than this, then you will be unable to use the cPanel & WHM interfaces or management tools for it -- they simply will not work. You will then have to manually manage your RoR install by yourself through command line exclusively. None of it would fall under the scope of cPanel support.
You can use http://ndeploy.in which is a third party plugin to integrate Rails Hosting via Phsuion Passenger in cPanel .
Just to let others who is using Cpanel with rails know.
I was able to use Cpanel to create a rails app, start it, and do the redirection all within Cpanel.
Nothing to modify or change. Quite straightforward for me.
So I guess it would be easier to do the development work straight on the server itself.
Have not tried to deploy a locally developed rails to shared server, or any per se. But I'm guessing we could create rails with Cpanel and replace the files in the directory generated.

Ruby on Rails on Linux hosting

I am about learning to program with Ruby on Rails but I'd like to know if web applications built on ROR can be hosted on the regular Linux servers.
Absolutely. One of the great reference books on Rails, "Agile Web Development with Rails" (written by the guys that created Rails), takes you through a whole demo app that includes server setup, configuration, deployements, everything. They deploy on Linux.
I also ran a site for over a year that was a Rails app, on Linux, and it totally rocked.
I think you'll also find that the broader Rails community prefers Linux. That means when you need help with something, you're much more likely to find someone else who has had your specific problem and is able to help you fix it.
You may also find this question helpful in choosing - how to select a Rails host (if you don't host it yourself).
Yes they can be and its advised to use Linux Hosting. I hardly if anybody uses windows hosting for Ruby on Rails. As for servers, You can use
A server called Mongrel ( in a cluster ) Behind Apache or Nginx.
Unicorn
Apache with Mod_Rails ( Phusion Passenger )

Rails application on shared hosting?

Is there a way that I can deploy my locally made rails app on a shared host that has Ruby installed?
Capistrano to deploy and (Mongrel or Passenger... preferably the latter... or if you HAVE to, FastCGI although FastCGI is pretty slow with Rails) to serve.
If you have a shared host you'll have to vendor your Rails version and all your gems, as you probably won't have access to install gems. Even if you did, you won't want Rails picking old versions of things.
Personally, I would use Capistrano. There are plenty of books and tutorials around that will tell you how to use it to deploy Rails applications. It is very easy to configure.
Dreamhost supports Rails, many others probably do also.
As for installation of your app: it depends a bit on what's already available on your shared host, and what you're allow to do / install / configure there. For Dreamhost, here's their documentation. Other shared hosting solutions may or may not be similar depending on their policy.
The best way I've found is to install the passenger gem. Once you've uploaded your app to your account all you need to do is add a few lines to your .htaccess file and you should be off.
Definitely capistrano + git (git, if you have SSH access, like f.e. in HostingRails shared host), nothing can be easier.
Neat Capistrano guide: http://www.linuxjournal.com/article/10100
How to config Capistrano + git: http://github.com/guides/deploying-with-capistrano
Some nice Capistrano recipes: http://github.com/josh/slicehost
Assuming your http server is nginx or apache, install Phusion Passenger
On the Passenger site, there are very good docs for configuring Apache/nginx with Rails
As a first step, just copy your Rails app somewhere to the host and get Passenger working
Once you have that working, you will need a better way to deploy/update the app; as others have suggested, Capistrano is a popular way to do it and you should have no problem finding some tutorials online to help you do it
I have done steps 1-3 and it is incredibly easy and works perfectly fine (I was just too lazy to do step 4).
Found a good reference : REFERENCE LINK this will help to deploy ROR App on a shared host.

Resources