View Full Version : Rails: Error trying to install Typo
roderickvd
02-16-2006, 04:16 AM
Thumbs up for supporting Rails! Just tried to install Typo, but it seems that my setup isn't working properly. Here's what I did:
Put Typo in /home/username/typo
Created a symlink pointing /home/username/public_html/blog to /home/username/typo/public
Chmodded /home/username/typo/log and /home/username/typo/public and everything in them to 777
Configured /home/username/typo/config/database.yml and /home/username/typo/public/.htaccess (see below)
Edited /home/username/typo/config/environment.rb to run in production mode
But alas, pointing my browser at http://www.domain.tld/blog gives: "Application Error - Typo could not be reached"
Here's my /home/username/typo/public/.htaccess:
# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI
# Redirect all requests not available on the filesystem to Rails
RewriteEngine On
# Uncomment this if you're not running Typo in the root of your
# webserver's URL space (i.e. http://www.example.com/blog):
#
RewriteBase /blog/
# try to suggest current rss subscribers that the url moved permently
RewriteRule ^xml/([a-z]+)$ /xml/$1/feed.xml [R=301]
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
# In case Rails experiences terminal errors
ErrorDocument 500 "<h2>Application Error</h2>Typo could not be reached
Tried dispatch.cgi too, but to no avail.
Any help would be greatly appreciated!
roderickvd
02-16-2006, 07:20 AM
I've been banging my head on this for too long now. :rolleyes:
Here's some additional debug information. Running in FastCGI, the error log displays:
[warn] FastCGI: (dynamic) server "/home/username/public_html/blog/dispatch.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
Unfortunately, nothing gets logged to /home/username/typo/log.
In CGI, it displays:
Premature end of script headers: /home/username/public_html/blog/dispatch.cgi
I double-checked that UNIX linebreaks were preserved while uploading and all the dispatch.* files were chmodded 777. At a loss here!
macgyver2
02-16-2006, 08:01 AM
A preliminary question/suggestion, noting that I have minimal experience with Rails...
Why did you immediately switch to 'production'? I would think there might possibly be better error messages under 'development', no?
roderickvd
02-16-2006, 08:06 AM
You'd say so, but apparantely it doesn't really matter when Rails won't run in the first place (i.e. a HTTP 500 error code).
So yes, I tried, but whatever I'm doing wrong must be occurring before Rails has the chance to log anything at all.
macgyver2
02-16-2006, 08:21 AM
Have you tried the Typo troubleshooting guide (http://www.typosphere.org/trac/wiki/TroubleShooting)? I know you've covered some of the things in the list, but maybe not all of them.
If I'm not helping, just tell me to go away... :)
roderickvd
02-16-2006, 08:45 AM
Any help is highly appreciated.
Unfortunately, there's not much else I can do... I don't have shell access, so I can't run the command by hand. However, I did double-check uploading so no Windows linefeeds would slip in, and I tried manually specifying the Ruby interpreter.
I believe I've got all the rest covered.
macgyver2
02-16-2006, 08:57 AM
Ah, well the first thing I'd suggest is get shell access. I know with the security requirements Bluehost has in place it's a bit hard for some users. I wound up taking a picture of my license with my digital camera and emailing to support as I don't have access to a fax machine or scanner I can use for personal business.
cfjrb
02-16-2006, 09:12 AM
I'm a newbie so take this with a grain of salt but it seems to me that it would be useful to perform a test in order to distinguish between some fundamental problem with the ROR hosting on bluehost and some problem with typo itself or your upload of it.
Suggest creating a blank rails app using
rails railstest
ln -s /home/username/railstest/public ~/public_html/railstest
then at
www.yourdomain.com/railstest/
you should get a welcome page saying your riding the rails. I see that you don't have shell access yet so I made such a directory tree and left it for you at
www.test2teach.com/railstest.zip
I know that rails does some permission setting when it creates these files and directories so this may not work in which case I think you'll have to setup shell access.
I'm just starting to dabble with ror and so far, my railstest works but when I try to copy the typo directories from my windows instant rails host (where they do work) to bluehost they do not work. In my case I get error messages about a bad path. Being new to rails I don't know how portable apps are supposed to be so I'm experimenting.
Hope this helps...
cfjrb
02-16-2006, 09:25 AM
Interestingly, zipping the railstest dir and unzipping it over itself (or perhaps naming railstest.zip in public_html) has killed that ROR app. To see what the "welcome you're up and running" screen should look like, you can go to
http://www.test2teach.com/todo/
roderickvd
02-16-2006, 10:46 AM
Could you do a "ls -lR" in your sample RoR directory and post the results here?
I can then compare my file permissions to what they ought to be.
roderickvd
02-16-2006, 10:59 AM
Two other things that caught my eye:
1. Your public/dispatch.* files directly list #!/usr/bin/ruby as their interpreter. Typo has (the newer) #!/usr/bin/env ruby. Does the latter work? (Tried changing it to #!/usr/bin/ruby but without success.)
2. Am I right that you didn't have to set RewriteBase in your public/.htaccess for the Rails application to work in a subdirectory? (Again, tried to this too - no luck here.)
Thanks for your help!
cfjrb
02-16-2006, 05:18 PM
./app:
total 24
drwxr-xr-x 6 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 13 username username 4096 Feb 15 16:21 ../
drwxr-xr-x 2 username username 4096 Feb 15 19:18 controllers/
drwxr-xr-x 2 username username 4096 Feb 15 19:18 helpers/
drwxr-xr-x 2 username username 4096 Feb 15 16:21 models/
drwxr-xr-x 4 username username 4096 Feb 15 19:18 views/
./app/controllers:
total 16
drwxr-xr-x 2 username username 4096 Feb 15 19:18 ./
drwxr-xr-x 6 username username 4096 Feb 15 16:21 ../
-rw-r--r-- 1 username username 216 Feb 15 16:21 application.rb
-rw-r--r-- 1 username username 123 Feb 15 19:18 friends_controller.rb
./app/helpers:
total 16
drwxr-xr-x 2 username username 4096 Feb 15 19:18 ./
drwxr-xr-x 6 username username 4096 Feb 15 16:21 ../
-rw-r--r-- 1 username username 115 Feb 15 16:21 application_helper.rb
-rw-r--r-- 1 username username 25 Feb 15 19:18 friends_helper.rb
./app/models:
total 8
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 6 username username 4096 Feb 15 16:21 ../
./app/views:
total 16
drwxr-xr-x 4 username username 4096 Feb 15 19:18 ./
drwxr-xr-x 6 username username 4096 Feb 15 16:21 ../
drwxr-xr-x 2 username username 4096 Feb 15 19:18 friends/
drwxr-xr-x 2 username username 4096 Feb 15 16:21 layouts/
./app/views/friends:
total 24
drwxr-xr-x 2 username username 4096 Feb 15 19:18 ./
drwxr-xr-x 4 username username 4096 Feb 15 19:18 ../
-rw-r--r-- 1 username username 69 Feb 15 19:18 edit.rhtml
-rw-r--r-- 1 username username 69 Feb 15 19:18 list.rhtml
-rw-r--r-- 1 username username 67 Feb 15 19:18 new.rhtml
-rw-r--r-- 1 username username 69 Feb 15 19:18 view.rhtml
./app/views/layouts:
total 8
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 4 username username 4096 Feb 15 19:18 ../
./components:
total 8
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 13 username username 4096 Feb 15 16:21 ../
./config:
total 28
drwxr-xr-x 3 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 13 username username 4096 Feb 15 16:21 ../
-rw-r--r-- 1 username username 548 Feb 15 16:21 boot.rb
-rw-r--r-- 1 username username 2138 Feb 15 16:21 database.yml
-rw-r--r-- 1 username username 2109 Feb 15 16:21 environment.rb
drwxr-xr-x 2 username username 4096 Feb 15 16:21 environments/
-rw-r--r-- 1 username username 772 Feb 15 16:21 routes.rb
./config/environments:
total 20
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 3 username username 4096 Feb 15 16:21 ../
-rw-r--r-- 1 username username 800 Feb 15 16:21 development.rb
-rw-r--r-- 1 username username 784 Feb 15 16:21 production.rb
-rw-r--r-- 1 username username 856 Feb 15 16:21 test.rb
./db:
total 8
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 13 username username 4096 Feb 15 16:21 ../
./doc:
total 12
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 13 username username 4096 Feb 15 16:21 ../
-rw-r--r-- 1 username username 188 Feb 15 16:21 README_FOR_APP
./lib:
total 12
drwxr-xr-x 3 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 13 username username 4096 Feb 15 16:21 ../
drwxr-xr-x 2 username username 4096 Feb 15 16:21 tasks/
./lib/tasks:
total 8
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 3 username username 4096 Feb 15 16:21 ../
./log:
total 8
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 13 username username 4096 Feb 15 16:21 ../
-rw-rw-rw- 1 username username 0 Feb 15 16:21 development.log
-rw-rw-rw- 1 username username 0 Feb 15 16:21 production.log
-rw-rw-rw- 1 username username 0 Feb 15 16:21 server.log
-rw-rw-rw- 1 username username 0 Feb 15 16:21 test.log
./public:
total 56
drwxr-xr-x 5 username username 4096 Feb 15 16:28 ./
drwxr-xr-x 13 username username 4096 Feb 15 16:21 ../
-rw-r--r-- 1 username username 1292 Feb 15 16:28 .htaccess
-rw-r--r-- 1 username username 235 Feb 15 16:21 404.html
-rw-r--r-- 1 username username 318 Feb 15 16:21 500.html
-rwxr-xr-x 1 username username 473 Feb 15 16:21 dispatch.cgi*
-rwxr-xr-x 1 username username 855 Feb 15 16:21 dispatch.fcgi*
-rwxr-xr-x 1 username username 473 Feb 15 16:21 dispatch.rb*
-rw-r--r-- 1 username username 0 Feb 15 16:21 favicon.ico
drwxr-xr-x 2 username username 4096 Feb 15 16:21 images/
-rw-r--r-- 1 username username 7551 Feb 15 16:21 index.html
drwxr-xr-x 2 username username 4096 Feb 15 16:21 javascripts/
-rw-r--r-- 1 username username 99 Feb 15 16:21 robots.txt
drwxr-xr-x 2 username username 4096 Feb 15 16:21 stylesheets/
./public/images:
total 12
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 5 username username 4096 Feb 15 16:28 ../
-rw-r--r-- 1 username username 1787 Feb 15 16:21 rails.png
./public/javascripts:
total 136
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 5 username username 4096 Feb 15 16:28 ../
-rw-r--r-- 1 username username 25519 Feb 15 16:21 controls.js
-rw-r--r-- 1 username username 18709 Feb 15 16:21 dragdrop.js
-rw-r--r-- 1 username username 30257 Feb 15 16:21 effects.js
-rw-r--r-- 1 username username 47603 Feb 15 16:21 prototype.js
./public/stylesheets:
total 8
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 5 username username 4096 Feb 15 16:28 ../
./script:
total 48
drwxr-xr-x 4 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 13 username username 4096 Feb 15 16:21 ../
-rwxr-xr-x 1 username username 95 Feb 15 16:21 about*
-rwxr-xr-x 1 username username 102 Feb 15 16:21 breakpointer*
-rwxr-xr-x 1 username username 97 Feb 15 16:21 console*
-rwxr-xr-x 1 username username 97 Feb 15 16:21 destroy*
-rwxr-xr-x 1 username username 98 Feb 15 16:21 generate*
drwxr-xr-x 2 username username 4096 Feb 15 16:21 performance/
-rwxr-xr-x 1 username username 96 Feb 15 16:21 plugin*
drwxr-xr-x 2 username username 4096 Feb 15 16:21 process/
-rwxr-xr-x 1 username username 96 Feb 15 16:21 runner*
-rwxr-xr-x 1 username username 96 Feb 15 16:21 server*
./script/performance:
total 16
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 4 username username 4096 Feb 15 16:21 ../
-rwxr-xr-x 1 username username 117 Feb 15 16:21 benchmarker*
-rwxr-xr-x 1 username username 114 Feb 15 16:21 profiler*
./script/process:
total 20
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 4 username username 4096 Feb 15 16:21 ../
-rwxr-xr-x 1 username username 108 Feb 15 16:21 reaper*
-rwxr-xr-x 1 username username 109 Feb 15 16:21 spawner*
-rwxr-xr-x 1 username username 109 Feb 15 16:21 spinner*
./test:
total 28
drwxr-xr-x 6 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 13 username username 4096 Feb 15 16:21 ../
drwxr-xr-x 2 username username 4096 Feb 15 16:21 fixtures/
drwxr-xr-x 2 username username 4096 Feb 15 19:18 functional/
drwxr-xr-x 4 username username 4096 Feb 15 16:21 mocks/
-rw-r--r-- 1 username username 1317 Feb 15 16:21 test_helper.rb
drwxr-xr-x 2 username username 4096 Feb 15 16:21 unit/
./test/fixtures:
total 8
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 6 username username 4096 Feb 15 16:21 ../
./test/functional:
total 12
drwxr-xr-x 2 username username 4096 Feb 15 19:18 ./
drwxr-xr-x 6 username username 4096 Feb 15 16:21 ../
-rw-r--r-- 1 username username 486 Feb 15 19:18 friends_controller_test.rb
./test/mocks:
total 16
drwxr-xr-x 4 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 6 username username 4096 Feb 15 16:21 ../
drwxr-xr-x 2 username username 4096 Feb 15 16:21 development/
drwxr-xr-x 2 username username 4096 Feb 15 16:21 test/
./test/mocks/development:
total 8
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 4 username username 4096 Feb 15 16:21 ../
./test/mocks/test:
total 8
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 4 username username 4096 Feb 15 16:21 ../
./test/unit:
total 8
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 6 username username 4096 Feb 15 16:21 ../
./vendor:
total 12
drwxr-xr-x 3 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 13 username username 4096 Feb 15 16:21 ../
drwxr-xr-x 2 username username 4096 Feb 15 16:21 plugins/
./vendor/plugins:
total 8
drwxr-xr-x 2 username username 4096 Feb 15 16:21 ./
drwxr-xr-x 3 username username 4096 Feb 15 16:21 ../
username@test2teach.com [~/todo]#
cfjrb
02-16-2006, 05:24 PM
Two other things that caught my eye:
1. Your public/dispatch.* files directly list #!/usr/bin/ruby as their interpreter. Typo has (the newer) #!/usr/bin/env ruby. Does the latter work? (Tried changing it to #!/usr/bin/ruby but without success.)
2. Am I right that you didn't have to set RewriteBase in your public/.htaccess for the Rails application to work in a subdirectory? (Again, tried to this too - no luck here.)
Thanks for your help!
You are beyond a humble windows user here. I just did
rails railstest
ln -s /home/username/railstest/public ~/public_html/railstest
and that is all I did.
(If this is incomplete it is because putty only let me copy and paste that much. I took all that was there to take.)
I'm also trying to get Typo running and am having troubles. Came here to see if I could find anything and I'm glad to see this thread. (misery loves company)
I independently followed a similar process, installed typo in a directory under my user account (not in the web root) and created a symlink to the public directory from /blog in my webroot.
I'm getting the same error from FastCGI.
I do have shell access and am coming to the (possibly incorrect) conclusion that there's something not right with he mysql connectivity.
When I run webbrick (./script/server), it loads properly, and I can access it via browser on port 3000, but I get an empty response.
And when I try executing commands from the console, I get the following:
# ./script/console
Loading development environment.
>> Article.find(:first)
ActiveRecord::StatementInvalid: Mysql::Error: Lost connection to MySQL server during query: SELECT * FROM articles LIMIT 1
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in `log'
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:180:in `execute'
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:322:in `select'
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:171:in `select_all'
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:431:in `find_by_sql'
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:395:in `find'
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:393:in `find'
from (irb):1
I believe that the config/database.yml is set up properly. I have created databases and loaded schemas. I've doublechecked usernames/passwords, etc.
I see a note in the troubleshooting doc about specifying a socket file in the database.yml file, but I cannot find the mysql socket file on my server.
It's been a week since any post in this thread. Did you guys have any luck?
My next step is to try a simple app from scratch.
roderickvd
02-24-2006, 03:24 AM
Your symptoms seem familiar. Here's what I've been up to:
- First I installed Typo current, which has been updated to use the latest Rails framework. Typo 2.6.0 stable didn't do the job and backed out on config/environment.rb.
- Then, I noticed that Bluehost doesn't have the MySQL binary driver installed. This causes problems like yours below when you use a password-protected database. I opened a support ticket on this but haven't received a response yet. For now, a workaround is to connect through a database user with a blank password.
- Lastly, I found out that FastCGI wasn't installed, or at least, it wasn't on the box I'm on. Filed a support ticket on this too, but once again, no response yet. Stuck on CGI for now, which causes such a CPU load that I can't do a thing with Typo or my account gets be temporarily suspended.
Nothing like living on the bleeding edge, eh roderickvd? :)
If BH wants to support RoR, they need to get this stuff figured out.
I've set up a few dev servers with RoR myself and I know the FastCGI and other quirky things can be a bear. I've already had to give up on another host who couldn't get a stable environment running.
I need a RoR host. I'd really like it to be bluehost, so I'll stick this out for a bit.
As you may have seen in my RoR / mysql thread, I've got the mysql problem licked and can run Typo on Webbrick using ./script/server.
I'm getting the 500 error now:
Application Error
Typo can not be reached.
more details...
I've tried both cgi and fcgi
I've tried both development and production in environment.db
I'm running the stable version 2.6.0
I'm running in a subdir, /blog/ and have done the symlink thing as well as the .htaccess edit to set the rewritebase.
I'm also going to continue on with getting a test app running.
one more update.
My simple hello-world test app (that does not access mysql) works in cgi, but not fcgi.
sorry for the stream of conscious.
I've caught up with you rodervickvd. Typo's now running in CGI. It was a stupid error, as is so easy to do with RoR apps.
I still get the application error with FastCGI. I'm always leery that it's another stupid error, but perhaps my box doesn't support FCGI yet either.
That's enough thrashing for one morning!
roderickvd
02-24-2006, 07:55 AM
You could check by running 'ruby public/dispatch.fcgi'. Which box are you on? I'm suspecting we're cursed for being on older installs. Really hoping the system administrators (Rando?) can fix my box up!
I get this...
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in `const_missing': uninitialized constant RailsFCGIHandler (NameError)
from ./dispatch.fcgi:24
Looking at the gem list, fcgi isn't installed there either.
I tried a quick gem install -i ~/mydir fcgi like I did to get mysql installed and it failed. a bit over my head on that one.
roderickvd
02-24-2006, 09:09 AM
Yeah, that's Rails-speak for "FastCGI gem not installed." :rolleyes:
Perhaps the following can be of use: http://marsorange.com/articles/2005/08/07/gem-install-a-non-standard-include-directory
Let me know!
Good link. I started to go down that road and that'll help, but I'm really just hoping for a bluehost guy to ride in on his horse with a solution.
At least Apache has FastCGI installed, which is encouraging, as that's one thing that I have zero control over from my little ol' user directory.
Apache/1.3.33 (Unix) mod_fastcgi/2.4.2 mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.7a PHP-CGI/0.1b
success. I've got Typo running on FastCGI.
I wrote up what I did IN typo...
http://www.jangy.com/blog/articles/2006/02/24/ruby-on-rails-and-fastcgi-on-bluehost
Rando may make this obsolete if he adds the fcgi gem along with the mysql one, but there you have it.
roderickvd
02-25-2006, 01:42 AM
Great stuff. Good luck riding on Rails, and in the meantime I'll be making glad use of your documented hours spent. :)
BartG
08-07-2006, 08:06 PM
Thanks for your help guys. I got my Typo up and running. I wrote up how I installed ver 4.0.0 on my account. It also includes instructions with and without shell access, and how to do it without using Gems or Rake, as mine didn't work. Also, noticed Bluehost now has FastCGI installed, so I included a bit about that too.
Hope it helps others.
http://bartgdev.com/articles/2006/08/07/installing-typo-on-bluehost
Bart
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.