Virtual hosts not using their own databases

Hi there!

I just set up 3 instances of the same Rails app (nginx+mongrel_cluster)
http://pastie.org/336677 – but for some reason site1 and site2
(despite their own database.yml) end up using site3’s database.

What on earth is going on here?

Thanks y’all,
RV

Redd V. wrote:

Does each virtual host have its own instance of the database server
running?

Norm wrote:

Does each virtual host have its own instance of the database server
running?

No actually I’m only running one MySQL 5.1 server instance. The OS is
FreeBSD.

Thank you.

Redd V. wrote:

When you say “their own database.yml” do you mean that you have
differently named databases in each database.yml? Stupid question but
stuff happens.

Norm wrote:

Redd V. wrote:

When you say “their own database.yml” do you mean that you have
differently named databases in each database.yml? Stupid question but
stuff happens.

Yes, exactly, like site1_production, site2_production and so on.

John Y. wrote:

So if you start only site2’s mongrel cluster it actually uses the data
site3_production, though it’s database.yml specifies site2_production?

also, I think you forgot the ‘t.’ in your rake tasks

task :install_site3 => :environment do |t|
t.load_database
t.create_keys
t.create_preferences
t.create_admin
end

Actually I fixed it now though. It turned out running “rake
install_site1 RAILS_ENV=production” also ran rake install_site2 and rake
install_site3 since they were all in the same directory. Deleting the
other rake scripts for each instance of my Rails app made everything
work just fine.

Much obliged everyone!

Redd V. wrote:

Norm wrote:

Redd V. wrote:

When you say “their own database.yml” do you mean that you have
differently named databases in each database.yml? Stupid question but
stuff happens.

Yes, exactly, like site1_production, site2_production and so on.

So if you start only site2’s mongrel cluster it actually uses the data
site3_production, though it’s database.yml specifies site2_production?

also, I think you forgot the ‘t.’ in your rake tasks

task :install_site3 => :environment do |t|
t.load_database
t.create_keys
t.create_preferences
t.create_admin
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs