View Full Version : Rails on Hostmonster
radiomouse
06-27-2007, 02:29 AM
Has anyone gotten a Ruby on Rails app to work on Hostmonster? I tried uploading an app I've been working on (set to production mode and updated config files to match the server) but couldn't get that to work. I tried the tutorial in the help center, but after creating an empty rails app and linking it to the 'first' subdomain, I get "Application error: Rails application failed to start properly"
So does anyone have a working rails app, and if so how did you deploy it to the server? Thanks!
charlesgan
06-27-2007, 04:01 AM
found these threads:
http://www.hostmonsterforum.com/showthread.php?t=56&highlight=rails
http://www.hostmonsterforum.com/showthread.php?t=786&highlight=rails
sabbirus
09-24-2007, 10:39 AM
Hi guys ,
I wanna deploy my rails application to hostmonster hosing package and for that i emailed the support team and they gave a link which should work properly but i found problem to execute the steps according to the doc.
The Url is
http://helpdesk.hostmonster.com/kb/index.php?x=&mod_id=2&id=232
See the steps i was following but i got the following error, i did not able to execute the " rails first " command ?
Please let me know what is the problem? did i miss anything ? But that was the second step , is not it and nothing is mentioned in the doc to do thing before this steps ... :mad:
-------------------------- SHELL ------------------------------------
[sabbirus@host149 ~]$ mkdir ~/rails
[sabbirus@host149 ~]$ cd rails
[sabbirus@host149 rails]$ pwd
/home/sabbirus/rails
[sabbirus@host149 rails]$ rails first
-bash: rails: command not found
[sabbirus@host149 rails]$
------------------------------------------------------------------------
Please let me know what to do ?
Thanks
Sabbir
shadmego
09-24-2007, 02:23 PM
The only thing I can suggest is to contact support. I just followed the steps in the link you gave and, .... well .... here you go (http://first.4christministry.org). It seems to have worked for me? I don't know what I did differently except to type
cd ~/rails instead of what you typed, but I don't see how that would affect things.
Let us know how it goes.
~regards, and welcome to the forums!
Shadmego
sabbirus
09-24-2007, 05:07 PM
cd ~/rails and cd rails is the same when im at the user root, see i have shown the working directory ...
[sabbirus@host149 rails]$ pwd
/home/sabbirus/rails
But here problem is to execute the "rails" command
[sabbirus@host149 rails]$ rails first
Have you setuped any path?
i think "rails" command is not exits somehow for me
i did these
[sabbirus@host149 ~]$ ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux]
[sabbirus@host149 ~]$ gem -v
0.9.2
[sabbirus@host149 ~]$ rails -v
-bash: rails: command not found
[sabbirus@host149 ~]$
do u get anything by executing "rails -v"
shadmego
09-24-2007, 05:53 PM
cd ~/rails and cd rails is the same ...
I know .. that's why I said it shouldn't have mattered.
do u get anything by executing "rails -v"
*# rails -v
Rails 1.2.3
I suggest contacting support and asking them about the error. They may have to tweak the path to rails for you.
~regards
sabbirus
09-25-2007, 09:53 PM
Hi shadmego,
I contracted with the support team, finally they fixed the rails path, now i can execute the rails command.
But still i have a problem. I have uploaded my application but still showing
Application error
Rails application failed to start properly"
when goto the url -> http://first.sabbir.us/admins/login .
But my application run locally and i use radrails for development. and i have uploaded all the folders and files to the ~/rails/first/ folder .
Will you able to say what is the mistake this time ?
Thanks
SABBIR
shadmego
09-25-2007, 09:58 PM
I would love to help you out with this problem, but I am decidedly NOT a rails expert ... or even a novice.
The first interaction I have had with rails was the other day when I installed it to see if it would work for me. That is the extent of my knowledge.
The only thing I can suggest is to attempt to reinstall it on your account (delete everything you created and go through the setup process again. Only thing I can think of is something screwy happened when you set it up the first time.
Other than that suggestion, I would have to wait for rails experts to comment on your problem.
Sorry I couldn't help any further ...
~regards,
Shadmego
sabbirus
09-27-2007, 10:47 PM
Hi everyone,
Can anyone plz help now ?
-
SABBIR
vizzy
10-01-2007, 06:28 PM
Hi guys!
I was struggling with same kind of problem for few hours, before I made the final discovery.. So check out that you have correct path to ruby in your railsApp/public/dispatch.cgi, dispatch.fcgi and dispatch.rb. When you copy your application from, let's say Windows env, you probably have those paths set incorrectly.
So check the first line of those files, it should be something like:
#!/usr/bin/ruby
Check also that you have execution permission set for those files, you might want to run this in your public dir:
chmod uog+x dispatch.cgi dispatch.fcgi dispatch.rb
Hopefully this solves your problem too. :)
-viz
HarryGuerilla
10-16-2007, 10:06 PM
I finally got everything working!
Thanks Vizzy your info was key!
A quick way to double check what your path should be set to in dispatch.cgi, dispatch.fcgi, and dispatch.rb is to create a test rails application from the command line directly on the server through SSH.
$ rails temp
$ cd temp/public
$ nano dispatch.cgi
The first line which is commented out should be the path you need. I had originally set up my application in windows so the path was set to #!C:\\something\etc which caused the "application failed to start" error
I found a link which details setting the permisions for the files (http://6brand.com/application-error-rails-app-failed-to-start-properly) as well which might be helpful
So after I got the application running correctly the next problem was to get it to show up with the url www.tonypelaez.com (http://www.tonypelaez.com) instead of the subdomain test.tonypelaez.com which I had originally set up with the symbolic link outlined in the host monster tutorial. I was able to set up the the symbolic link to the /public_html/ folder however this erased everything I had in the public_html folder. Needless to say that was not good, so I wouldn't recommend that you try it. My website is two parts one, the blog (created in Wordpress, which is php), and two, the main site (which is rails). The blog is set up as a subdomain blog.tonypelaez.com. When I set up the symbolic link for /public_html/ it redirected the root of my site to the rails application, and even when I copied my blog back to the rails public folder I kept on getting a rails "application failed to start" error. I'm assuming that this error was a result of rails trying to interpret the php.
So I had to try something else. I rebuilt the /public_html/ folder and put in two subfolders, one for the blog, and one for the main rials site. I recreated the subdomain for the blog, but instead of creating the subdomain for the main site I decided to leave it in the subfolder and create the symbolic link to the rails application. My application was working, but to get to it I had to type in www.tonypelaez.com/subfolder/ (http://www.tonypelaez.com/subfolder/). I found another tutorial on modifying .htaccess (http://helpdesk.hostmonster.com/kb/index.php?x=&mod_id=2&id=308) which allowed me to do some url rewriting. Now I had it working to the point where I could type in www.tonypelaez.com (http://www.tonypelaez.com) and get to my website without typing in the subfolder. However the links generated by rails still included the subfolder directory in each link. This was kind of annoying and I could not figure out how to changes config/routes.rb or .htaccess to keep it from including the subfolder in the url string. What I ended up doing was appending .gsub(/\/subfolder/, '') to every link in the application. That was kind of a pain to do, so if anyone knows of a better way please let me know.
Thanks,
tony
inguanzo
10-17-2007, 02:11 AM
Hi,
there is a problem in the rails enviroment locally in the host, so even if you create your rails enviroment in the hostmonster server it will point to /usr/bin/ruby1.8 which does not exist.
Thanks for the information I think is going to save a lot of headeaches :)
By the way, the performance is terrible :(
sabbirus
10-23-2007, 10:58 PM
Thanks for the reply.
support team of hostmonster found that the permission was not 755. so there was problem to start the application.
Thanks again
Sabbir.
sabbirus
10-24-2007, 02:31 AM
Hi guys,
In my site www.sabbir.us there is a link "song". When i click on song i get the song page. There are A - Z index at the page And here is the problem. When i click on the "A" then a page is coming and it offers to download. But locally in my pc i can get the page open when i click on the "A".
Can u guys tell me what kind of problem is this.
i have seen the source of the page and found that rails is writing something in the header of the page(see the html source by "view source" ) but the original html of the page started from these and i have used the same layout in all over the application.
-------------------------------XXX------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Welcome To SABBIR's home</title>
<meta name="keywords" content="sabbir, ashraf, java, j2ee, soap ,servlet, rmi, spring, framework, hibernate, mapping, page, mvc, hbm ,wicket ,ruby,ruby on rails, rails ,scaffod, controller, view ,ActiveRecord ,ActionController,ActionView, css, .net, microsoft, blog ,song, download,sakera,alima" />
<meta name="description" content="sabbir bin ashraf java j2ee soap servlet rmi spring framework hibernate mapping page mvc hbm wicket ruby rails scaffod controller view ActiveRecord ActionController ActionView css .net microsoft blog song download sakera alima" /><%= stylesheet_link_tag 'main.css' %>
</head>
<body> .....
-------------------------------XXX------------------------------------
Thanks
SABBIR
shadmego
10-24-2007, 05:51 AM
I'm not a Ruby developer, so if this is wrong, let me know ...
Your links to the Song downloads look like this in your source:
<a href="/me/movies/dn?alph=A">A</a>
Should they not look like this instead?
<a href="me/movies/dn?alph=A">A</a>
It looks to me like the page is looking for the download script from the root of the server instead of from the root of your public_html directory as in the second part.
Of course, if this were true, wouldn't the script not find anything and return a 404 error? I don't know. Wish I knew more about RoR. Also, all your links have that beginning slash.
I also noticed this part at the end of the source:
</p -->
</div><!-- end footer -->
</div><!-- end wrapper -->
</body>
</html>
</li>
</ul>
</div>
</div>
</div>
</body>
</html>
I doubt this has anything to do with your song links not working, but it might need to be fixed for semantic reasons.
Good looking site template anyway.
~regards
sabbirus
10-24-2007, 10:01 AM
Thanks for ur reply and comments.
Please see the source code which page is promoted to dn...
Source are like these
------------------------------ XXXX ----------------------------------
select * from movies where LCASE(LEFT(title,1))='A'
Content-Type: text/html; charset=utf-8
Set-Cookie: _Online_store_session_id=4c7c99f733529011b66553608 627506b; path=/
Status: 200 OK
Cache-Control: no-cache
Content-Length: 13310
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html >
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
------------------------------ XXXX ----------------------------------
There was one line code in one function in "movie" controller like this
puts ""
puts @sql
puts ""
when i was run the application it produced the output to my ide console but when i was running the application in the server then rails was writing something to the web page before the header by the puts method so i got the error.
I solved the problem :)
Thanks.
Sabbir.
Powered by vBulletin™ Version 4.0.5 Copyright © 2010 vBulletin Solutions, Inc. All rights reserved.