SitePoint Sponsor

User Tag List

Results 1 to 25 of 25
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    deployment issues

    Hello,

    I am still trying to deploy my first ruby on rails application, using the sitepoint book. Now that I have successfully completed the 'rake db:schema:load ......' command when I try this : ruby script/console production I get this error message
    Code:
    youtour@youtourism.org [~/public_html/youtour]# ruby script/console production
    Loading production environment (Rails 2.0.2)
    /usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
            from /usr/local/lib/ruby/1.8/irb/completion.rb:10
            from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
            from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
            from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup'
            from /usr/local/lib/ruby/1.8/irb.rb:54:in `start'
            from /usr/local/bin/irb:13
    or using
    mongrel_rails start -e production, I get
    Code:
    youtour@youtourism.org [~/public_html/youtour]# mongrel_rails start -e production
    -bash: mongrel_rails: command not found
    I think Mongrel is installed, but I can check with the server people.

    Appreciate any help received.

    CathyM

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This looks like a hosting issue more than anything else. I'd ask your hosting provider what's going on, and in the case of your first error, if you can get readline support in your ruby install.

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    When I checked the server people, they informed me that they use Fastcgi instead of mongrel. I changed dispatch.fcgi file, the .htaccess file and I changed the routes.rb file to show the name of the main controller, yet to no avail. Is there anything else that I need to do to deploy the website?

    Code:
    RewriteRule ^(.*)$ dispatch.fcgi?$1 [QSA,L]
    
    require 'fcgi_handler'
    require 'fcgi'
    require 'rubygems'
    require_gem 'fcgi'
    
     map.connect '', :controller => "content_controller"
    Thanks,

    CathyM

  4. #4
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your dispatch.fcgi looks a lot different than mine. This is the same one in your public folder of your project directory? Also, with configuring the routes, you'd want this to indicate the root controller:

    Code Ruby:
      # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
      # map.root :controller => "welcome"

  5. #5
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Chris,

    Tried it, replace welcome with the name of the main controller, and removed the # sign and still no go.

    What does your dispatch.fcgi file looks like?

  6. #6
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    where does the .htaccess reside? I have mine under the public subfolder. should it remain there?

  7. #7
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your .htaccess should be in the document root of your site (you'd have to ask your provider where that is). As for dispatch.fcgi, mine looks like this:

    Code Ruby:
    #!/usr/bin/ruby
    #
    # You may specify the path to the FastCGI crash log (a log of unhandled
    # exceptions which forced the FastCGI instance to exit, great for debugging)
    # and the number of requests to process before running garbage collection.
    #
    # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
    # and the GC period is nil (turned off).  A reasonable number of requests
    # could range from 10-100 depending on the memory footprint of your app.
    #
    # Example:
    #   # Default log path, normal GC behavior.
    #   RailsFCGIHandler.process!
    #
    #   # Default log path, 50 requests between GC.
    #   RailsFCGIHandler.process! nil, 50
    #
    #   # Custom log path, normal GC behavior.
    #   RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
    #
    require File.dirname(__FILE__) + "/../config/environment"
    require 'fcgi_handler'
     
    RailsFCGIHandler.process!

  8. #8
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Chris,

    Changed the dispatch.fcgi file, put th .htaccess file in the root folder, at least the application read it because it outputted the error page that was listed at the bottom. But where do I start debugging for the error that causes it not to start?

  9. #9
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you're getting that same error with:

    Code:
    /usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
    it means the host needs to configure ruby with readline support, or have them set it up for you. Unless you're on a dedicated server, there's nothing you can do as far as configuration goes.

  10. #10
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Chris,

    This is part of my .htaccess file,
    Code:
    RewriteRule ^$ index.html [QSA]
    RewriteRule ^([^.]+)$ $1.html [QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ dispatch.fcgi?$1 [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 "<h2>Application error</h2>Rails application failed to start properly"
    I get the error document with application error rails application failed......

    what configuration needs to change? so I can informed the server people

  11. #11
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I am still trying out my options to see if I can get the application to work. Apart from the .htaccess file which resides in the public_html directory, the other files reside in a folder, youtour in the public_html directory as in public_html/youtour. I then tried changing the Alias line in the .htaccess file as follows:

    Code:
    Alias /public_html/youtour/public
    RewriteBase /public_html/youtour
    but still the same error. Is the placement of the folders a problem, should they be placed in the root directory, or should the code in the .htaccess file be different?

    Any help appreciated.

  12. #12
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    changing the alias code also gave me an error, on the error log it read as alias not allowed there, so I guess that is not going to work

  13. #13
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I feel very silly, but the problem might be that the error occurs because the database is empty, as I just found out. Is there a easy way to send the information from the development database on my machine to the production database on the server without subversion or capistrano?

  14. #14
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sure, what database are you using?

  15. #15
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    using mysql

  16. #16
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In order to make this easy, if your machine is a windows based machine, you can use the MySQL Administrator, part of the MySQL GUI Toolkit package. This lets you do the backup of whatever database you need.

    Then from there, you'll need to copy this over to your site and have it restored there. As this is probably a much simplier process for your hosting company, I would just point them to the backup file and ask if they can populate your database with it.

    Another option is to check if they have a database control panel of some kind, where you can simply upload the backup file to a certain page, and it does everything for you.

  17. #17
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Chris, you've been a gem. They do have phpMyAdmin, I will see if I can use it, or else talk to the hosting company.

    Thanks again, I will try it out tomorrow and see how it goes. got to run

  18. #18
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    The mysql backup worked perfectly, and the database is now populated, but I am still getting errors deploying the application.

    I tried going into production mode through putty, and got the following error message:
    Code:
    youtour@youtourism.org [~/public_html/youtour]# ruby script/console production
    Loading production environment (Rails 2.0.2)
    /usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
            from /usr/local/lib/ruby/1.8/irb/completion.rb:10
            from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
            from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
            from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup'
            from /usr/local/lib/ruby/1.8/irb.rb:54:in `start'
            from /usr/local/bin/irb:13
    youtour@youtourism.org [~/public_html/youtour]#
    any idea how to decipher it?

    Also I put at the top of the dispatch.fcgi file

    #!/usr/bin/ruby

    should have the local somewhere within the path, or is it because I am trying to run it remotely from my machine?

  19. #19
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do this:

    Code:
    ls -la /usr/local/bin/ruby
    if that doesn't come up with an error, change that dispatch.fcgi file to have:

    Code:
    #!/usr/local/bin/ruby
    You don't need mongrel_rails in this case if they're using the dispatch.fcgi method. For the production console that's a bit of an issue, as debugging becomes a bit more difficult. I'd send your host this message:


    Hello,

    I'm trying to use the production console to test some environment settings in my ruby application, but I can't seem to run it, and it puts the following error:

    youtour@youtourism.org [~/public_html/youtour]# ruby script/console production
    Loading production environment (Rails 2.0.2)
    /usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
    from /usr/local/lib/ruby/1.8/irb/completion.rb:10
    from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
    from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
    from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup'
    from /usr/local/lib/ruby/1.8/irb.rb:54:in `start'
    from /usr/local/bin/irb:13
    Someone mentioned that ruby needs to have readline support according to this error message, so is that possible or will this setup be unusable.
    hopefully this will get what you need done.

  20. #20
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, hopefully something happens

  21. #21
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I tried one more test while waiting on the hosting company, running ruby dispatch.fcgi to see if I can get an idea what is happening, and got the following error message:

    youtour@youtourism.org [~/public_html/youtour/public]# ruby dispatch.fcgi
    Status: 500 Internal Server Error
    Content-Type: text/html

    <html><body><h1>500 Internal Server Error</h1></body></html>

    Any ideas?

  22. #22
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, with dispatch.fcgi, your browser is the one that communicates with that, you should be accessing it by accessing your url.

  23. #23
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Chris,

    Maybe it is just the readline error, I went to the production log, and made a change, it seems that it wanted the session_id in the environment.rb file. I place it there and from putty, it rendered the page to me. When I went to the production log, it gave me this:
    Code:
    Processing PagecontentController#index (for at 2008-03-27 17:30:10) [GET]
    Session ID: bbca9e5a5593f67d2d0efcd9bec2510d
    Parameters: {"action"=>"index", "controller"=>"pagecontent"}
    WARNING: You're using the Ruby-based MySQL library that ships with Rails. This library is not suited for production. Please install the C-based MySQL library instead (gem install mysql).
    Rendering template within layouts/standard
    Rendering pagecontent/index
    Completed in 0.03502 (28 reqs/sec) | Rendering: 0.02551 (72%) | DB: 0.00000 (0%) | 200 OK [http://:]
    Everything seems to be firing, except that I get the error on the screen instead of the page. This is extremely confusing.

  24. #24
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You know, I think you might just want to switch hosts, this whole thing seems pretty ridiculous if you ask me... I'll try and find some hosts for you after work.

  25. #25
    SitePoint Zealot
    Join Date
    Aug 2006
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •