Ruby Passenger displays content from public instead of the app - ruby-on-rails

I have a server in the cloud. I've set up a Linux machine with Apache2 + Passenger(with the apache module installed).
I've configured by the book, set up the VirtualHost as the Passenger instructions tell me to.
I've created a default Ruby on Rails project in "RubyMine"(on the local machine), synchronized it with the server.
Here is the project file hierarchy:
Since the instructions ask me to point in the configuration file to /projectFolder/public, I did so. If there is no index.html in the public folder, it throws me an error, if I create one it displays it when I access the link.
But when on the local machine I deploy it, it instead launches the app from app->views->layouts.
How to make it run on the remote server my ruby code? My ruby "app"?

First try:
sudo passenger-status
This should show you if passenger is loaded and the applications group. If that is all good, delete the index.html from /public and restart apache.

Related

Ruby on rail migration

I have a backup of ruby on rail server working with mysql databse.
backup Folder contain many subfolder like Vendor, node_modules, lib, config, bin, app, db, public and some files.
Now i have configured a new ubuntu server with fresh install of ubuntu server and ruby on rail is showing welcome page on port 3000 on server ip.
Can you guide how i can restore that backup app to this server so the app starts working from this new server.
Copy the root folders of the app to your new computer
with the terminal go to the root of the directory
cd path/to/your/root/directory
check that you are in the root directory by running pwd in the terminal, it should return the root directory of your app
run the bundle install command in the terminal, it will install all the gems required for you app
trouble shoot potential errors by searching online for instructions, install all software required and read every error
run rails s and go to your webbrowser to test the development version of your app

How to Move A Ruby On Rails Website To New Server

I have a Ruby on Rails website which I have successfully tar the apps directory which included the current folder ect. Which I Wget to transfer the files over. The server I have moved to is setup to run Ruby on Rails but is there anything else I need todo to get it running?
Any commands via SSH?
My new server setups is Ubuntu 11.04 running ISPConfig 3 as the server admin.
Current the file are in the correct location with the correct permissions and owners. But all I'm getting is the default ISPConfig page.
(This is the default index page of your website.
This file may be deleted or overwritten without any difficulty. This is produced by the file index.html in the web directory.)
If anyone can point me in the right direction that would be great.
Have you tried creating a symbolic link on the server to the application something like
cd ~/public_html;
ln -s ~/rails-test-application/public rails3
http://www.site5.com/blog/programming/ruby-rails/how-to-deploy-phusion-passenger-to-a-subdirectory-routing-errors-and-restarting/20090414/

Developing & deploying Rails app from same machine

I have started developing a new Rails app on my server using RVM, Rails 3, & Ruby v1.9.2. I am using Git as my code repository. It's a simple app and I don't want to use an extra server. I just want to deploy my app directly from the same server I am developing on.
I've installed Phusion Passenger w/ Apache to serve my app, but have realized that I can't do that pointing to my development directory as my RAILS_ENV is set to "development". (I found I got file permission errors on the asset pipeline and other issues when I attempted to set RAILS_ENV to "production" and serve the app)
What's the simplest/easiest way to deploy the app? Can I simply:
1) Create a separate user to run rails production (Rails in dev currently runs as me on my Ubuntu server)
2) Clone my repo into a separate dir and configure Apache accordingly
3) Seed my database with the data needed for production (not much data needed here)
4) What else?
I've looked briefly at Capistrano, but it seems like overkill for this simple app. I only need to be able to provide a simple web interface for some data entry. Seems like git push should be sufficient, but I haven't done this before so maybe I'm wrong? Also, if I git push how do I ensure file permissions in the "production" directories are all set properly, particularly for any new files that get created in the originating app directory structure?
Thanks for any ideas.
No- you do not need Capistrano for the above; at this stage I feel it will only serve to confuse you further.
I'd suggest you first save your repo to a private Github or free BitBucket account. What you should do is keep one folder for 'development'.
Remember that Passenger is 'just' a module working with Apache. So what you need to do is setup a virtual host under apache and direct that to another folder on your system. For this example, consider:
~/rails/myapp_development/ and ~/rails/myapp_production/
Passenger always runs the app in production, so that should not be an issue. You can do bundle --without=production in your development setup to ignore any gems listed in the Gemfile under the production namespace, i.e. say you've got the mysql adaptor specified, you can ignore this and have Rails only rely on the SQlite gem.
You can now simply develop in the development folder, commit, push to BitBucket. Deploying will be as simply going into the production folder and doing a git pull and touch tmp/restart.txt.

rails app - sudden 403 after pull - how do I start to debug?

I'm been working on a rails 3.1 app with one other dev.
I've just pulled some of his recent changes, using git. And am now getting a 403 on any page I try to visit.
You don't have permission to access / on this server.
I'm running the site locally through passenger.
Oddly, when I start the app using rails' internal server. I can visit the site at http://0.0.0.0:3000
Looking at the changes in this recent pull, the only files have changed are some javascripts, some html the application.rb, routes.rb and a rake file.
How do I debug this, I'm a bit lost on where to start?
EDIT:
If I roll back to an earlier version the site works, through passenger. Which leads me to believe the problem is within the rails app, rather than an Apache error. Or it could be a permissions thing, can git change file permissions in this way?
IMHO this is a configuration error in Apache or wrong directory layouts. Make sure that the passenger_base_uri still points to the public folder inside your rails project and that there are no hidden .htaccess files which block access. Also verify that your sym-links are correct (if there are any). Also check your Apache error log.
Start by launching your console to see if rails and your app can be loaded.
In your application root directory type :
rails console

Apache/Rails/Passenger Displaying Site Index?

I have a Rails app that I have successfully tested with Mongrel and Webkit. Now I want to test deployment. I set up a VMWare Image using Ubuntu 8.04. I have installed Rails following this method https://help.ubuntu.com/community/RubyOnRails with the exception of using Gems 1.3 instead of 1.2. I have configured and installed Passenger. However, when I visit my sites index (http://some.ip.that.i'm.testing/) I simply get the directory index of my rails site. I should note that since I'm testing I just dumped my app in /var/www.
My Apache2 error.log file shows this and this only:
[Tue Sep 30 15:10:41 2008] [notice] Apache/2.2.8 (Ubuntu) Phusion_Passenger/2.0.3 configured -- resuming normal operations
Any idea what could be causing this problem? It seems Passenger is configured properly, but I'm not sure why my rails app is not displaying and why the site's directory listing is.
Thanks.
Two questions:
1) Is Rails running at all on the server? Passenger should start Rails automatically on first request - if you do a ps, do you see it running?
2) Which directory are you seeing - is it your rails directory or the public/ directory? If it's the former, your symlink is likely pointing the wrong place (it should go to public/).
(I've seen this problem before and am trying to remember how I debugged it... these are my first two thoughts.)

Resources