Topic: Unable to deploy to Apache -- Please help

Hi All,

Can someone please help?  I've been banging my head against the wall
for 2 months now; most of which has been spent trying to set up ROR.  So I
actually haven't written 1 line of code :(  Any help would be greatly
appreciated :)

I'm following the 4th edition of "Agile Web Development with Rails".
So, I'm able to deploy the site via WEBrick.  However, when I go to my
URL (without using port 3000), I get what seems like a Phusion Passenger error.

*Please see entire list of errors (including backtrace) at the bottom of the post*

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

Also, this is the error in /var/log/httpd/error_log.

*** Exception PhusionPassenger::UnknownError in
PhusionPassenger::Rack::ApplicationSpawner (unable to open database
file (SQLite3::CantOpenException)) (process 3244, thread #<Thread:
0xa1db870>):

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

By the way, I'm running:

Ruby 1.9.3p0
Rails 3.1.3
Phusion Passenger version 3.0.11
CentOS release 5.6
Server version: Apache/2.2.3

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

This my vhost configuration from httpd.conf

<VirtualHost *:80>
ServerName www.mywebpage.com
DocumentRoot /home/rubys/work/depot/public/

<Directory /home/rubys/work/depot/public>
      Order allow,deny
      Allow from all
</Directory>

</VirtualHost>

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

Ruby (Rack) application could not be started
These are the possible causes:

There may be a syntax error in the application's code. Please check
for such errors and fix them.  A required library may not installed.
Please install all libraries that this application requires.  The
application may not be properly configured. Please check whether all
configuration files are written correctly, fix any incorrect
configurations, and restart this application.  A service that the
application relies on (such as the database server or the Ferret
search engine server) may not have been started.  Please start that
service.

Further information about the error may have been written to the
application's log file. Please check it in order to analyse the
problem.

Error message:
  unable to open database file (SQLite3::CantOpenException)
Exception class:
  PhusionPassenger::UnknownError
Application root:
  /home/rubys/work/depot
Backtrace:

#     File     Line     Location
0     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite3_adapter.rb     26     in `initialize'
1     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite3_adapter.rb     26     in `new'
2     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite3_adapter.rb     26     in `sqlite3_connection'
3     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb     304     in `new_connection'
4     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb     323     in `checkout_new_connection'
5     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb     265     in `block (2 levels) in checkout'
6     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb     261     in `loop'
7     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb     261     in `block in checkout'
8     /usr/local/lib/ruby/1.9.1/monitor.rb     211     in `mon_synchronize'
9     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb     260     in `checkout'
10     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb     162     in `connection'
11     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb     409     in `retrieve_connection'
12     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_specification.rb     115     in `retrieve_connection'
13     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_specification.rb     89     in `connection'
14     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/base.rb     703     in `table_exists?'
15     /usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/active_record/base.rb     798     in `attribute_names'
16     /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/action_controller/metal/params_wrapper.rb     168     in `_set_wrapper_defaults'
17     /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/action_controller/metal/params_wrapper.rb     128     in `inherited'
18     /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/abstract_controller/railties/routes_helpers.rb     7     in `block (2 levels) in with'
19     /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/action_controller/railties/paths.rb     7     in `block (2 levels) in with'
20     /home/rubys/work/depot/app/controllers/products_controller.rb     1     in `'
21     /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb     240     in `require'
22     /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb     240     in `block in require'
23     /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb     225     in `load_dependency'
24     /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb     240     in `require'
25     /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb     348     in `require_or_load'
26     /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb     302     in `depend_on'
27     /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb     214     in `require_dependency'
28     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb     417     in `block (2 levels) in eager_load!'
29     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb     416     in `each'
30     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb     416     in `block in eager_load!'
31     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb     414     in `each'
32     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb     414     in `eager_load!'
33     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application/finisher.rb     51     in `block in '
34     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb     30     in `instance_exec'
35     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb     30     in `run'
36     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb     55     in `block in run_initializers'
37     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb     54     in `each'
38     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb     54     in `run_initializers'
39     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb     96     in `initialize!'
40     /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb     30     in `method_missing'
41     /home/rubys/work/depot/config/environment.rb     5     in `'
42     config.ru     3     in `require'
43     config.ru     3     in `block in '
44     /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb     51     in `instance_eval'
45     /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.6/lib/rack/builder.rb     51     in `initialize'
46     config.ru     1     in `new'
47     config.ru     1     in `'
48     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb     225     in `eval'
49     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb     225     in `load_rack_app'
50     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb     157     in `block in initialize_server'
51     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb     572     in `report_app_init_status'
52     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb     154     in `initialize_server'
53     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb     204     in `start_synchronously'
54     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb     180     in `start'
55     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb     129     in `start'
56     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb     253     in `block (2 levels) in spawn_rack_application'
57     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb     132     in `lookup_or_add'
58     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb     246     in `block in spawn_rack_application'
59     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb     82     in `block in synchronize'
60     < td=""> <>    prelude>     10:in `synchronize'
61     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb     79     in `synchronize'
62     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb     244     in `spawn_rack_application'
63     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb     137     in `spawn_application'
64     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb     275     in `handle_spawn_application'
65     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb     357     in `server_main_loop'
66     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb     206     in `start_synchronously'
67     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server     99     in `'

Last edited by kal (2012-03-29 00:55:07)

Re: Unable to deploy to Apache -- Please help

From looking at my virtual host files that work I would say that your line that reads

<Directory /home/rubys/work/depot/public>

should read

<Directory /home/rubys/work/depot>

Re: Unable to deploy to Apache -- Please help

Post your database.yml file

It's telling you it can't initialize a SQLite3 database.

Are the entries from development and production the SAME?

If they are not,  then you've probably failed to set up the production version of the database,  Passenger defaults to the production environment.

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Unable to deploy to Apache -- Please help

Thanks Norm, but  I don't think my problem with the vhost section.  Regardless, I did it your way and it still didn't work.  Thank you for your suggestion though; I appreciate your assistance :)

Thanks Brad, I think you are correct.  I had neglected to set up a production version of the database.  I just ran "rake db:migrate RAILS_ENV=production"  but now I get a new error :(

Anyway, here is the database.yml file and error from production.log.  Any ideas?

Thanks,

Kal

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

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

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

  Processing by StoreController#index as HTML
Rendered store/index.html.erb within layouts/application (17.9ms)
Completed 500 Internal Server Error in 38ms

ActionView::Template::Error (all.css isn't precompiled):
    2: <html>
    3: <head>
    4:   <title>Depot</title>
    5:   <%= stylesheet_link_tag :all %>
    6:   <%= javascript_include_tag :defaults %>
    7:   <%= csrf_meta_tag %>
    8: </head>
  app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__750878_73537400'

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

Last edited by kal (2012-03-29 22:25:49)