Thursday, January 4, 2007

HOW TO RUN RUBY ON RAILS APPLICATIONS WITHOUT SSH ACCESS?

Dec 31 - 10:47 GMT
Customer
I hope you can answer this question!

Here some statements I found meanwhile
-------------------------------------------------
Using Ruby On Rails:

This is intended to be a brief introduction to developing ruby on rails applications on your account. At the bottom of this article you will find a number of resources to help you learn more about ruby on rails and related information, as well as links to some rails tutorials that will go into more depth than this document.

Before you start digging your feet into Ruby on Rails, you should understand exactly what it is. Ruby on Rails is an advanced object-oriented Model-View-Controller application framework. If you didn't fully understand the meaning of the previous sentence, you're going to need to put in some study time before you can jump into rails programming. Ruby On Rails is aimed at advanced programmers; jumping into it before you're ready is likely to be very very hard. This tutorial should be easy enough for anyone to follow, but there's a lot more to rails than you'll be learning here. This tutorial serves as a first step into ruby on rails development.

The Model-View-Controller (abbreviated to MVC) design pattern is fairly straight-forward, it simply means that your program is split into three separate components: The Model, View, and Controller. The "Model" is your data, no matter how it's stored. If you're writing a blog, this is where all of your posts and comments would go. The "View" is your interface. In the case of ruby on rails, we're talking about the part that displays your HTML. The controller handles the business logic, and ties the model to the view. MVC programming is beneficial for many reasons.

From this point on it is assumed that you have an understanding of both object-oriented design and MVC, and now you can get into how to develop rails applications. A few additional notes before you start:

---------------------------------------------------------
First of all, you need to have SSH access enabled.
---------------------------------------------------------

So how can this work if SERVAGE HOSTING says "yep we have ror support" but on the otherhand is denying ssh???
If SERVAGE HOSTING CUSTOMERS set up Ruby on Rails Websites like said in your FAQ they will receive nothing more then an error
Simple installation of RoR application >> check your FAQ
---------------------------------------------------------
Virtual host path to mount your root is yourapp/public.

permissions:

chmod 755 to the all folders/files in your application

change ownership of: yourapp/log/ yourapp/tmp/ (recusive, to 'webserver')

Paths:

change the path in yourapp/public/dispatch.cgi|fcgi|rb

to #!/usr/bin/ruby, from your local path.

.htaccess corrections: (to enable fast cgi)
This will enable your application, to use fcgi, with is about x10 faster then normal cgi

# General Apache options
AddHandler fcgid-script .fcgi
#AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
# RewriteRule .* - [L]

# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
#RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
# Alias /myrailsapp /path/to/myrailsapp/public
# RewriteBase /myrailsapp

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
#RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
#
# Example:
# ErrorDocument 500 /500.html

ErrorDocument 500 "

Application error

Rails application failed to start properly"

===================================================

Let's continue: - TRY THIS as you (support) have ssh access I guess ;-)
===================================================
To begin, log into the server using SSH. You'll need a work area for your rails application. Assuming ahead of time that you may eventually want multiple applications, you should make a work directory and then cd into it. You can name it whatever you would like, but this document assumes that it is called "rails".

% mkdir ~/rails
% cd ~/rails

Now you may create your application. As we are just making a simple Hello World application, we'll assume that the application is named "helloworld".

% rails helloworld
% cd helloworld

Next, we're going to set up a subdomain for this application to run on. Log into your Account, click on 'Web Server' and New Host, then type 'helloworld' into the first text box and click 'Add'. You've now created a new subdomain, helloworld.yourdomain.com, which will be the new home of your ruby on rails application. Now, we're going to make your application's "public" directory be the rootdir of that subdomain:

link it to helloworld/public

You should now be able to go to http://helloworld.yourdomain.com/, where you will see the Ruby on Rails welcome message. As the welcome page suggests, it is now time to set up your databases.

In your Account, click on 'MySQL Databases'. The first thing you'll want to do here is add an SQL user for rails to use. You can name this whatever you'd like. Remember all Data!!!

Next, we're adding a database. Name this database 'helloworld', to match your application name.

Now you should repeat this step, with 'helloworlddev' as the database name, and linking username_rails to it.

Now we're going to edit the database.yml file. Open ~/yourdomain/helloworld/config/database.yml in your favorite editor, and modify the 'development' and 'production' sections to contain the username, password, and database that you just created.

production:
adapter: mysql
database: helloworldDB
host: mysql_your_DB
username: helloworldUSER
password: password

development:
adapter: mysql
database: helloworldDBdev
host: mysql_your_DBdev
username: helloworldUSER
password: password

Next you should create the actual database data. Choose now your Database and you should find a 'phpmyadmin' link "View Database". Within phpmyadmin, select the "_first" database from the dropdown on the left, then click on the "SQL" tab along the top. Paste the following into your box and click 'Go':

CREATE TABLE `people` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(50) NOT NULL default '',
`street1` varchar(70) NOT NULL default '',
`street2` varchar(70) NOT NULL default '',
`city` varchar(70) NOT NULL default '',
`state` char(2) NOT NULL default '',
`zip` varchar(10) NOT NULL default '',
PRIMARY KEY (`id`),
KEY `name` (`name`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;

Now, click on the SQL tab one more time, and run this query:

INSERT INTO `people` VALUES (1, 'Superman', '123 Somewhere', '', 'Smallville', 'KS', '123456');

Now repeat these two sql queries for your helloworlddev database.

Now set owners of the following folders to "webserver"
app
config
db
log
test
tmp

The next step is to create a controller.

% ./script/generate controller First list view new edit

After that has been created, you will create your model.

% ./script/generate model Person

Now we're going to modify two files. First, open app/views/hello_world/view.rhtml and make it look like this:



Friends#view


This page will display one friend



<%= @person.name %>

<%= @person.street1 %>

<%= @person.street2 %>

<%= @person.city %>

<%= @person.state %>

<%= @person.zip %>





Next, open app/controllers/hello_world_controller.rb and modify the 'view' method to look like this:

def view
@person = Person.find(1)
end

Congratulations, You now have a working ruby on rails application which reads information from a database. Go to http://helloworld.yourdomain.com/view and you should see Superman's information.

-----------------------
Unfortunately you won't as still the routing will be wrong at SERVAGE and until now NONE of the SUPPORT staff was able to tell us the right routing informations ;-)
So Enjoy the ERROR Message:

Routing Error

no route found to match "/helloworld/view" with {:method=>:get}

-----------------------
Now ask the SUPPORT STAFF from SERVAGE HOSTING to give you all routing information. If you get them post them here - as we are still waiting ;-)

-----------------------

In our example:
Calling http://helloworld.t3pack.info/hello_world/view
results in this error message:
-----------------------
LoadError in Hello worldController#view

Expected /mounted-storage/home81c/sub004/sc44977-AQJR/www/HELLO_WORLD/app/controllers/hello_world_controller.rb to define HelloWorldController

RAILS_ROOT: /home81c/sub004/sc44977-AQJR/www/HELLO_WORLD/public/../config/..
Application Trace | Framework Trace | Full Trace

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:249:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:452:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:464:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/inflector.rb:250:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/string/inflections.rb:148:in `constantize'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/routing.rb:1317:in `recognize'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/dispatcher.rb:40:in `dispatch'
/home81c/sub004/sc44977-AQJR/www/HELLO_WORLD/public/dispatch.cgi:10

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:249:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:452:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:464:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/inflector.rb:250:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/string/inflections.rb:148:in `constantize'
/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_controller/routing.rb:1317:in `recognize'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/dispatcher.rb:40:in `dispatch'
/home81c/sub004/sc44977-AQJR/www/HELLO_WORLD/public/dispatch.cgi:10

Request

Parameters: None

Show session dump

---
flash: !map:ActionController::Flash::FlashHash {}


Response
Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}
------------------------

You should now go on to read other ruby on rails tutorials. You can find a lot of helpful information at http://wiki.rubyonrails.org/, as well as at http://rubyonrails.org/docs. You should also watch the Ruby On Rails Screencasts, which show you, among other things, how an experienced ruby on rails developer can create a fully functional application in a matter of minutes using ruby on Rails.

ADDITIONAL INFORMATION AND TUTORIALS:
More information on MVC: http://wiki.rubyonrails.com/rails/pages/UnderstandingMVC
Official Ruby On Rails Screencasts. You should watch these: http://media.rubyonrails.org/screencasts
Ruby on Rails wiki. The tutorials listed here are quite helpful: http://wiki.rubyonrails.org/
Why's poignant guide to ruby: You will either enjoy this or hate it, but it's a nice intro to the ruby language: http://poignantguide.net/ruby/
--------------

Found and adapted to SERVAGE HOSTING:
http://helpdesk.bluehost.com/kb/index.php?x=&mod_id=2&id=232

--------------------------------------------------------

Dec 31 - 13:56 GMT
Servage - Bob

Hello Andreas,

Thanks for updating ticket.

Please update us with exact requirements which you are looking for, so we can assist you accordingly.

We are looking forward reply from you!


Kind regards,
Bob, Support
Servage Hosting

Dec 31 - 19:14 GMT
Customer

Hi BOB

I posted meanwhile in many many places worldwide and received a bunch of mails already but all of them are warning me of SERVAGE HOSTING as the Support isn't able to get Ruby On Rails Aplication running and they also write often that they can initiate the process as no ssh is available and so on. I posted some of those places already in our blog where I write a detailed SERVAGE HOSTING SUPPORT REVIEW since 2 weeks.

We need to get
REDMINE
TYPO
RADIANT
TRAC
running

Those are the requirements. We tried already REDMINE
>> ERROR
TYPO
>> ERROR
HELLO WORLD EXAMPLE
>> ERROR

none RoR Application seems to be working on SERVAGE and until now we also received only letters from lots of people who experienced the same problems with SERVAGE and RUBY on RAILS. It does not seem to be possible to get any RoR running on SERVAGE and their ads are only junkfood to catch more people.

We asked SERVAGE several times to name us any RoR Application and website and its dispatch.fcgi and .htaccess settings but until now (2 weeks later) we still have no answer from them according to this question They only copy and Paste prepared sentences (which often has nothing to do with the case/problem at all)
Also their support isn't able to read/answer in German even it is a GERMAN COMANY! All Names of those Technicians are faked. I seems as if there is only one single person answering thhose post.

BOB if you can help to get i.e. REDMINE in /1_redmine called by http://www.t3log.info running we all would really appreciate your help. All this posting is only becoming so big because of UNQUALIFIED SUPPORT ANSWERS FROM SERVAGE TEAM MEMBERS

TRY TO GET EVEN THE hELLO WORLD EXAMPLE RUNNING i PRESENTED AS AN EXAMPLE - IT WON'T WORK ON SERVAGE hOSTING. And if you get it working then please let us know HOW you do this without ssh Thanks.

Dec 31 - 19:15 GMT
Customer

http://apapococ.blogspot.com/
THat's our Blog which is meanwhile full of Servage Suff

Dec 31 - 19:22 GMT
Customer

HAPPY NEW YEAR 2008 from Thailand we are already 2 hoursin an it is great 2008 only REDMINE and SERVAGE RoR Problems are still the same n-)

Jan 04 - 05:11 GMT
Customer

Hi Jan

Actually we still don't know HOW to run Ruby on Rails Application without SSH Access and a Support which wasn't really helpful.

But for now we wanna close this ticket and see if we also can find a good improvement here :-)

Andi

No comments: