Rails server starts app in another folder - ruby-on-rails

I'm running a ruby on rails app on Ubuntu, but I found something weird.
I was developing an app that was giving an error that I could not solve, so I thought about removing the folder and restarting from a previous saved version, but when I run
rails server
the application being referenced is still the old one, even if it is in the Trash (the error message now references file in the Trash).
What's going on?

Probably symlinked
You'll be much better suited to running the likes of Phusion Passenger, which handles the serving of Rails applications for you.

Related

How to start Puma/Rails/Nginx on Debian after boot

Ok, I'm deploying my Rails App using Capistrano. I'm also using Puma. I've followed this tutorial to get it to work, although I'm using Debian rather then Ubuntu.
Everything works fine and I can deploy my app without issues. However if my server crashes or the server restarts, the App doesn't restart itself and the only way I got it to restart was deploying it again with the following command cap production deploy from within my App in my local machine, which we all can agree that's not ideal.
There's loads of information on the web on how to deploy a Rails App with Passenger, which I'd rather avoid to use due to lack of resources on the server part. I've also found this tutorial which seems to be a bit outdated.
Can someone please point me to an updated tutorial or give some directions on how I could get my App to start/restart who the server?
Many thanks
EDIT
As per #mudasobwa's comments, I'm detailing the steps I've taken after reading this page:
I have copied the contents of https://github.com/puma/puma/blob/master/tools/jungle/init.d/puma into /etc/init.d/puma made it executable. I've also copied the contents of https://github.com/puma/puma/blob/master/tools/jungle/init.d/run-puma into /usr/local/bin/run-puma also made it executable.
Lastly I've created a puma.conf file in /etc.
After that I've created the following directory: /path/to/app/tmp/puma and added these two files: pid and state. Note that I've also added the aforementioned folders into Capistrano's shared links structure.
After the above I've restarted my server and the App did not start as I expected.
What am I missing here?

Ruby on Rails app : from Heroku to a local server : what are the main steps?

My Ruby on Rails app (basically a commenting and voting system) has been deployed and currently runs on Heroku. I need to deploy it on a local server to ensure an optimal performance for a customer-organized event in a location where the internet bandwidth is too low and unpredictable to support the 100+ simultaneous users.
Just as Ruby, Rails, Javascript, JQuery, AJAX and CSSs were new to me a few months ago, going local is something new I need and am eager to learn (which should also allow me to deploy onto a dedicated or virtual private server if needed).
The following elements are obviously on the way : choosing an operating system, installing Ruby on Rails, a web server, a database engine and deploying my app code and data of course but I need help to make sure I do not forget anything and really understand how all of these elements must be tied together to get my app running.
At a reasonably high level, starting with my app code, could you please share your experience and tell me the steps I need to take from scratch to have it run on a local server ?
If you have a Mac, then you're already most of the way there. I do all of my Rails development on OS X. The steps from there are pretty easy.
Install Homebrew. This will help you quickly install any dependencies on the Mac that your Rails app needs (such as a database). Since you're on Heroku, you're likely using Postgres. So with Homebrew, you can install Postgres via brew install postgresql.
Copy your app code somewhere that makes sense. I have all my apps inside my ~/Projects directory.
Recommended: Install RVM. This will help keep gemsets unique to projects and keep your global gemset clean.
If you're using bundler, do bundle install within your app's directory.
Within the app directory, do: rake db:setup (Note: This may require prepending bundle exec)
Start your server. I tend to use Unicorn (see Heroku's deployment with Unicorn for even more details), so this would just be unicorn. Else, rails s works as well.
Those are the high level steps to get a local server running.

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.

Preparing for Rails deployment

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.

Resources