views:

443

answers:

1

So I've just tried to migrate my first rails application from the development environment on my laptop to my hosted environment(just another machine that is externally facing), but I seem to keep getting errors with apache/passenger trying to run my app.

Basically I've configured apache and passenger correctly in that the main site still works without an issue, however when I try to browse to my subdirectory that runs the rails application I get the 500 error saying something went wrong. Upon looking at the production logs it says that there is no data

Processing CourseController#list (for 76.26.115.2 at 2009-11-25 09:30:13) [GET]
Parameters: {"action"=>"list", "controller"=>"course"}

ActiveRecord::StatementInvalid (SQLite3::SQLException: no such table: courses: SELECT * FROM "courses" ):
app/controllers/course_controller.rb:5:in `list'
passenger (2.2.5) lib/phusion_passenger/rack/request_handler.rb:95:in `process_request'
passenger (2.2.5) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
passenger (2.2.5) lib/phusion_passenger/railz/application_spawner.rb:378:in `start_request_handler'
passenger (2.2.5) lib/phusion_passenger/railz/application_spawner.rb:336:in `handle_spawn_application'
passenger (2.2.5) lib/phusion_passenger/utils.rb:183:in `safe_fork'
passenger (2.2.5) lib/phusion_passenger/railz/application_spawner.rb:334:in `handle_spawn_application'
passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:163:in `start'
passenger (2.2.5) lib/phusion_passenger/railz/application_spawner.rb:213:in `start'
passenger (2.2.5) lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
passenger (2.2.5) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
passenger (2.2.5) lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
passenger (2.2.5) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
passenger (2.2.5) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (2.2.5) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
passenger (2.2.5) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
passenger (2.2.5) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.5) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

Rendering /webapps/vitaal/public/500.html (500 Internal Server Error)

I've tried to load the development database multiple times through SQLite but just can't seem to get it I don't think. Is this an issue because I'm trying to run the development environment on a different machine? Do I need to migrate to production for this to work? It's interesting because these errors are only showing up in the production logs and not the development logs.

Any information would be helpful, thanks!

+4  A: 

Your error comes because you haven't migrated your production database correctly. Under config/database.yml you will find all the setup for the databases used. The underlying error is not originating from Rails or Passenger but from SQLite.

These are your options:

  • run a migration for the production database

    In your rails app
    rake db:create RAILS_ENV=production
    rake db:migrate:reset RAILS_ENV=production (running db:migrate:reset will remove any data in the database!)

OR

  • Change the configuration in you config/database.yml file so it points at your development database that seems to be available. (You should reconsider running SQLite in production and maybe take a look at MySQL instead). You could also copy your previous development.sqlite3 database and write over the production.sqlite3 database given that's the naming you've used in the database.yml file.

Because you are saying you have tried to "load the development database" my guess (if the above doesn't work) is to take a good look at the config/database.yml file and making sure you are using the right database for your production environment.

mrD