views:

74

answers:

2

I've deployed a Ruby on Rails application using mod_rails and nginx over Capistrano, and it's working perfectly, but I have a baffling problem.

When I run the following command on the server:

SHOW TABLES IN application_production;

MySQL returns:

Empty set (0.00 sec)

I know that information is being written to the database because I've entered data that is being saved. I've tried restarting the Rails application and the entire server, as well as accessing the site from other computers, and it's working perfectly, yet the query is still returning an empty set. I'm completely stumped.

Anyone have any idea what's going on? Thanks!

A: 

Of course, 10 minutes after I post the question I figure it out:

I hadn't committed my updated database.yml file to Mercurial before I deployed, so when it pulled down the latest changeset, the old database.yml (with the default production database) was used. Because of this, it was using an SQLite database in my project folder instead of MySQL.

Stupid mistake! Moral: ALWAYS make sure you commit before you deploy.

Grant Heaslip
I don't store the database.yml file in my repository. Instead I SFTP it to the shared/config directory and then have Capistrano create a symbolic link to it from within the Rails application.
John Topley
Is there any security risk to having it in the repository? There's only two of us working on the project, and we both have the password, so it doesn't really seem like a problem. Am I missing something?
Grant Heaslip
+2  A: 

Was your database.yml file set up correctly for the production environment?

John Topley