UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  UK Web Hosting | Dedicated Server Windows and Linux VPS Forum > Technical Support > cPanel Shared Hosting

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-04-2008, 17:55
Chief Technical Officer
 
Join Date: Jun 2007
Posts: 43
Default Create Ruby on Rails application under your account

Hello,

The recommended way to run Ruby on Rails[ROR] in production is to use CGI or fastcgi.
You have to route requests to ROR applications through Apache via CGI or fastcgi.

Here is the step by step guide on how to:

1. Connect to the server via SSH using your cpanel's login details, provided you have the ssh access enabled for your account.
We do provide JailShell access on couple of servers.

2. Once you are connected to server via ssh, you will be in your home directory by default. You can verify it with "pwd" command.
You can see the output like this :
Code:
[username@server ~]$ pwd
/home/username
[username@server ~]$
3. Then run the following commands to generate a test rail application and its controller.
Code:
[username@server ~]$ rails demo
[username@server ~]$ cd demo
[username@server ~]$ ruby script/generate controller test
4. Now create a symlink in public_html so that application would be accessible via web browser :
Code:
[username@server ~]$ cd ../public_html
[username@server ~]$ ln –s ../demo/public rails
5. Modify the Rewrite rule under .htaccess under "demo/public" folder.
Code:
[username@server ~]$ cd ../demoapp/public
[username@server ~]$ vi .htaccess
Now, find the line in the .htaccess that looks something like this:

RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

And change “dispatch.cgi” to “dispatch.fcgi

Save the file and quit.

You can then visit http://yourdomain. com/rails/ and you should see a “Welcome Aboard” page which confirms successful installation and working of your rail application.


You can deploy any other standard Rail applications as well.
Most of them should work well with the preinstalled Gems modules on server.
You can check list of gem modules installed on server using following command:
Code:
[username@server ~]$ gem list
For any further assistance in this regard, you are most welcome to open a ticket with our support desk at http://support.eukhost.com

Regards,
Nick J.
Reply With Quote
  #2 (permalink)  
Old 16-04-2008, 13:42
Junior Member
 
Join Date: Jan 2007
Posts: 22
Default

Given that neither httpd, fcgi or ruby run as the user on shared hosting, how can we get fastcgi to "restart" in order to read changes in the application configuration? e.g. change between development and production modes.

Reading up on the topic, on other shared hosts you can either touch dispatch.fcgi or you have control of the fcgi process. Neither of these work on eukhost.

Also, oddly, removing disptach.fcgi results in a 403 forbidden error. Editing it to add rubbish does not result in an error, leading me to believe it's cached somewhere. Edit: Of course it cached!.. By the ruby process.

The only way I've found to change the app config is to copy disptach.fcgi to dispatch1.fcgi and edit the htaccess file to refer to this file instead. This however results in two ruby processes - one with dispatch.fcgi and one with dispatch1.fcgi - so this is not a good workaround at all.

Last edited by brighter : 16-04-2008 at 14:09.
Reply With Quote
  #3 (permalink)  
Old 16-04-2008, 14:25
Junior Member
 
Join Date: Jan 2007
Posts: 22
Default

I've read up on mod_fastcgi. It seems that the autoupdate option needs to be set in order for it to check the modification time of dispatch.fcgi (which would let users restart fastcgi with 'touch dispatch.fcgi'). I've submitted a support ticket requesting this feature.
Reply With Quote
  #4 (permalink)  
Old 16-04-2008, 14:51
Chief Technical Officer
 
Join Date: Jun 2007
Posts: 43
Default

You need edit a .htaccess file under respective "public" folder of a application if you are running multiple ROR applications under your account. It wont conflict but you need to make sure to terminate previously running dispatch.fcgi if there any for that application and then deploy it again. Just like a restart.

Do not use a generalized .htaccess file for all applications.

A good news for you is, mod_proxy has been enabled on server.
Reply With Quote
  #5 (permalink)  
Old 16-04-2008, 15:09
Junior Member
 
Join Date: Jan 2007
Posts: 22
Default

The problem is that I can't terminate dispatch.fcgi because my user does not own the associated processes.

It seems that the best way to give users control of fastcgi in a shared environment is to configure it with the autoupdate option, which will allow them to restart fastcgi by changing the modification time of dispatch.fcgi. If the users can't restart fastcgi then it's fairly useless because they'll not be able to change the application configuration without contacting eukhost to request a restart.

That's good news about mod_proxy, because it of course means that Mongrel can be used without displaying the port number in the URL. Thanks for that!

Can you configure fastcgi with the autoupdate option so that users have a choice of using Apache/fastcgi or Mongrel?
Reply With Quote
  #6 (permalink)  
Old 16-04-2008, 15:41
Chief Technical Officer
 
Join Date: Jun 2007
Posts: 43
Default

The FastCgiWrapper and AutoUpdate has been enabled under fastcgi configuration.
Now all those process would run under your account ownership and get terminated automaticaly if idle for more than 120sec.
Reply With Quote
  #7 (permalink)  
Old 16-04-2008, 16:27
Junior Member
 
Join Date: Jan 2007
Posts: 22
Default

I have tested and all works well. I can now restart fastcgi with 'touch dispatch.fcgi'. Mongrel works with mod_proxy hiding the port.

Many thanks.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 09:26.

 

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by Web Hosting 3.1.0
Copyright © 2001-2008, eUKhost.com. All rights reserved.

 
Site Map

knowledgebase articles

popular blog categories